2

我有几个 .properties 文件希望 Eclipse 获取。根据安装 ESAPI 的说明,我可以通过执行以下操作将它们添加到我的项目中:

在 Eclipse 中,我将转到 Window > Preferences > Java > Installed JREs

从那里我选择我唯一的选项 jre7 并单击 Edit... 按钮。

在 Default VM Arguments: 框中,我输入了以下内容:

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

然而,当我尝试运行我的项目时,出现以下错误:

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

即使目录和文件就在那里。我试过其他地方没有运气。有什么想法吗?

更新:当我尝试:

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

我只是得到这个输出,好像它不喜欢使用的选项:

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

有关详细信息,请参阅http://java.sun.com/javase/reference 。

4

2 回答 2

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

看到-D和其余部分之间的空间了吗?删除它。

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

-D后面不是空格,而是直接跟你要定义的东西。

于 2011-11-19T02:07:58.517 回答
0

我不知道为什么,但我可以告诉您 Eclipse 将您的 JVM 选项解释-D org.owasp.esapi.resources="c:\.esapi"为“主类”......即包含您的public static main方法的类。

我猜 Ecriples (哈哈)在执行 JVM 时没有识别或尊重 -D 选项(用于定义符号)。

我希望其他人可以填补关于 Eclipse 如何执行 JVM 的缺失知识。

干杯。基思。

于 2011-11-19T02:09:05.773 回答