0

I am trying to run an example java file which require specifying the path of the properties file (which in this case is an XML file) as the first parameter under Run Configurations in Eclipse. The XML file is located outside of my Eclipse project.

If I go to Run > Run Configurations > Arguments 

Option 1: C:\FILEPATH\filename.xml
Option 2: C:/FILEPATH/filename.xml

Should the path be the first or the second? I tried both and they don't seem to work. Is that all I need to specify so that the properties file is listed as the first parameter under the Run Configurations?

Any help would be wonderful. Thanks!

Cryssie
  • 3,047
  • 10
  • 54
  • 81

1 Answers1

1

The arguments you are asking about are command line arguments in Java which are always Strings as explained in What is "String args[]"? parameter in main method Java.

Eclipse allows you to define them in the IDE for specific run configuration.

The format of the String dependends on its usage. Could you show the code of your example?

To see what arguments you get in the application you can run the following example from the documentation:

public class Echo {
    public static void main (String[] args) {
        for (String s: args) {
            System.out.println(s);
        }
    }
}
Community
  • 1
  • 1
Olivier.Roger
  • 4,241
  • 5
  • 40
  • 68