Results 1 to 3 of 3
  1. #1
    DonCash's Avatar
    DonCash is offline Moderator
    Join Date
    Aug 2007
    Location
    London, UK
    Posts
    240
    Rep Power
    8

    Question [SOLVED] Passing parameters in Eclipse

    Hello,

    Does anyone here know how to pass parameters in Eclipse :confused:

    For example:

    Java Code:
    public static void main(String[] args) {
    
       String test = args[0];
       System.out.println(test);
    
    }
    How do you pass a parameter to Eclipse when you Run the code?

    Thanks.
    Last edited by DonCash; 04-08-2008 at 04:47 PM. Reason: Added semicolon!
    Did this post help you? Please me! :cool:

  2. #2
    Join Date
    Apr 2008
    Location
    Fort Wayne, Indiana
    Posts
    62
    Rep Power
    0

    Default

    First of all...don't forget your semicolon at the end of "String test = args[0]" ;)

    Go to the "Run" menu and click "Open run dialog..." and you will be at the Main tab. To the right of that is the Arguments tab. Program arguments is where you put stuff separated by spaces(strings can have spaces by using quotes around it). Hope this meets all your needs.

  3. #3
    DonCash's Avatar
    DonCash is offline Moderator
    Join Date
    Aug 2007
    Location
    London, UK
    Posts
    240
    Rep Power
    8

    Default

    First of all...don't forget your semicolon at the end of "String test = args[0]"
    Ah yeah, I didnt notice that! I wasn't actually using this code. Its just an example.

    Brilliant. That worked perfectly in Eclipse. Nice one for that!!
    Did this post help you? Please me! :cool:

Similar Threads

  1. Passing a value..
    By Lagarto in forum New To Java
    Replies: 3
    Last Post: 01-23-2011, 05:58 PM
  2. JNI - passing and returning parameters by value
    By java_to_c in forum New To Java
    Replies: 0
    Last Post: 01-31-2008, 08:49 PM
  3. Passing Environment Variable in Eclipse Europa
    By ajaymenon.k in forum Eclipse
    Replies: 0
    Last Post: 11-19-2007, 10:08 AM
  4. Replies: 0
    Last Post: 11-10-2007, 04:47 PM
  5. get parameters in jsp
    By cecily in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 08-05-2007, 04:29 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •