java - 在 Eclipse 中编译任何 Java 代码时遇到问题

标签 java eclipse compilation

我是 Java 世界的新手,并且一直在关注一些在线教程来入门。一切进展顺利,程序编译完美,然后突然间,我似乎没有改变任何东西,就直接归因于 Eclipse 的首选项而言,它根本停止编译任何代码。即使是简单的 Hello World 代码也无法编译。我在任何代码的控制台行中得到的是:

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://www.oracle.com/technetwork/java/javase/documentation/index.html了解更多详情。

我不确定这是什么或它为什么开始这样做。我该如何着手修复编译器以便继续学习?

最佳答案

我也遇到过这个问题。尝试重新启动 Eclipse。如果这不起作用,请重新启动计算机。如果仍然不起作用,请重新安装 Java。这是一个恼人的错误,通常在您的计算机进入待机状态时发生,而程序正在 Eclipse 上运行。

编辑:如果问题仍然存在,您可以编写一个小的 javac 程序来编译给定目录中的任何代码。

希望我有所帮助!

关于java - 在 Eclipse 中编译任何 Java 代码时遇到问题,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/9862037/

相关文章:

Java Runtime.exec() -- 是否可以将流输出与 wait()/notify() 同步?

eclipse - junit.framework.AssertionFailedError : No tests found in xyz package

eclipse - 我在m2eclipse上有构建错误,但在命令行上没有maven2 -我的m2eclipse配置错误吗?

c++ - 我可以在GCC和Clang中为单个功能启用严格的浮点行为吗?

java - 代号一 - 条码扫描仪

java - 未获得预期的 JSON 格式

java - 使用方法将数据添加到父类(super class)和数组

c++ - 为什么要在 eclipse 中使用 Cmake

c++ - 操作系统编译时间

scala - SBT 错误的编译顺序