【问题标题】:Why can't my VM Argument's path not be found when I try to run my project in Eclipse?当我尝试在 Eclipse 中运行我的项目时,为什么找不到我的 VM Argument 的路径?
【发布时间】:2011-11-19 01:58:42
【问题描述】:

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

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

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

在默认 VM 参数:框中,我输入了以下内容:

-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。

【问题讨论】:

  • 您使用的是哪个版本的 Eclipse?万一这很重要;-)
  • 好点。 Eclipse Java EE 1.4.1.2

标签: eclipse virtual-machine java jvm-arguments


【解决方案1】:
-D org.owasp.esapi.resources="c:\.esapi"
  ^

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

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

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

【讨论】:

  • 是的,这有帮助。正是它与其他一些事情相结合,但帮助我解决了这个问题。谢谢。
【解决方案2】:

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

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

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

干杯。基思。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 2019-09-17
    • 1970-01-01
    • 2015-01-24
    • 2014-01-09
    • 2011-07-29
    • 2016-04-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多