how to pass the commandline arguments in eclipse 3.1? if any body knows plz tell me...

Dani AI

Generated

Brief clarification and a few practical tips to supplement and : the Arguments tab mentioned in the replies is the right place, but there are a few common confusions that people hit with Eclipse (especially older releases like 3.1).

Program vs VM arguments — Program arguments appear in main(String[] args); VM arguments (e.g. -Xmx512m or -Denv=dev) configure the JVM and do not show up in args. A tiny test program that prints both helps diagnose what you actually receive:

public static void main(String[] args) {
    System.out.println(java.util.Arrays.toString(args));
    System.out.println("env=" + System.getProperty("env"));
}

Quoting and escaping — wrap any argument that contains spaces in double quotes so it becomes a single args[] element (for example: arg1 "arg two" arg3). If you need literal quotes or backslashes inside an argument, escape them; when unsure, add the debug print above and try different forms until you see the exact value you expect.

Persistence and sharing — Eclipse sometimes creates a temporary launch configuration when you Run from the editor. To keep arguments, open Run Configurations, edit the specific Java Application entry, click Apply, and optionally use the Common tab to save as a shared .launch file in the project (useful for team projects/version control).

Special cases — JUnit test launches do not use program arguments the same way; use VM -D properties or configure the test setup instead. For webapps, pass values via server VM args or web context-param rather than program args.

If arguments still don’t seem to apply, confirm you’re editing the same launch configuration you’re actually running (check the Main tab) and press Apply before Run/Debug.

Recommended Answers

All 2 Replies

check this out you should find answer

1. open the Java program in Eclipse IDE
2. right click at the content area of the Java Program
3. select Run As -> Run
4. select the Arguments tab
5. enter the command line argument value in Program Arguments or click Variables and choose or edit variable with value
6.click run

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.