Search code examples
eclipsevirtual-machinejavajvm-arguments

Why can't my VM Argument's path not be found when I try to run my project in Eclipse?


I have a couple of .properties files I want Eclipse to pick up. According to the directions to install ESAPI it says I can add them to my project by doing the following:

In Eclipse I am going to Window > Preferences > Java > Installed JREs

From there I select my only option jre7 and click the Edit... button.

In the Default VM Arguments: box I have typed the following:

-D org.owasp.esapi.resources="c:\.esapi"

Yet when I try to run my project I get the following error:

Error: Could not find or load main class org.owasp.esapi.resources=c:\.esapi

Even though the directory and files are right there. I've tried other locations with no luck. Any thoughts?

UPDATE: When I try:

-Dorg.owasp.esapi.resources="c:\.esapi"

I just get this output as if it does not like the option used:

Usage: javaw [-options] class [args...]
           (to execute a class)
   or  javaw [-options] -jar jarfile [args...]
           (to execute a jar file)
where options include:
    -d32      use a 32-bit data model if available
    -d64      use a 64-bit data model if available
    -server   to select the "server" VM
    -hotspot      is a synonym for the "server" VM  [deprecated]
                  The default VM is server.

-cp <class search path of directories and zip/jar files>
-classpath <class search path of directories and zip/jar files>
              A ; separated list of directories, JAR archives,
              and ZIP archives to search for class files.
-D<name>=<value>
              set a system property
-verbose[:class|gc|jni]
              enable verbose output
-version      print product version and exit
-version:<value>
              require the specified version to run
-showversion  print product version and continue
-jre-restrict-search | -no-jre-restrict-search
              include/exclude user private JREs in the version search
-? -help      print this help message
-X            print help on non-standard options
-ea[:<packagename>...|:<classname>]
-enableassertions[:<packagename>...|:<classname>]
              enable assertions with specified granularity
-da[:<packagename>...|:<classname>]
-disableassertions[:<packagename>...|:<classname>]
              disable assertions with specified granularity
-esa | -enablesystemassertions
              enable system assertions
-dsa | -disablesystemassertions
              disable system assertions
-agentlib:<libname>[=<options>]
              load native agent library <libname>, e.g. -agentlib:hprof
              see also, -agentlib:jdwp=help and -agentlib:hprof=help
-agentpath:<pathname>[=<options>]
              load native agent library by full pathname
-javaagent:<jarpath>[=<options>]
              load Java programming language agent, see java.lang.instrument
-splash:<imagepath>
              show splash screen with specified image

See http://java.sun.com/javase/reference for more details.


Solution

  • -D org.owasp.esapi.resources="c:\.esapi"
      ^
    

    See that space between -D and the rest? Remove that.

    -Dorg.owasp.esapi.resources="c:\.esapi"

    -D isn't followed by a space, but rather directly by the thing you wish to define.