2012-03-25 99 views
4

我是新来的java世界,并且一直在关注一些在线教程以开始。一切都很顺利,程序编译完美,然后突然间,没有我看似改变任何东西,只要直接归因于Eclipse的偏好,它就停止编译任何代码。即使简单的Hello World代码也不会编译。所有我在控制台线获得的任何代码是:在Eclipse中编译任何java代码时遇到问题

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了解更多详情。

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

+1

Eclipse的一个很好的教程,对于初学者是在http://www.vogella.de/articles/Eclipse/article.html。请执行上述步骤并检查它是否有效。如果不是,那么我们会弄清楚什么可能是错的。 – 2012-03-25 16:57:09

回答

2

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

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

希望我帮了忙!

+0

我试过重新启动Eclipse,我的电脑,重新安装了Eclipse,并重新安装了Java。我仍然显示相同的错误消息。我一直在关注http://thenewboston.org/list.php?cat=31的教程,并完全按照他的指导。我不明白,究竟是什么导致这些问题如此突然。 – 2012-03-25 17:53:37

+0

看看控制台的响应,我会建议你试试这个: 制作一个使用javac命令的批处理文件,看看是否有效。如果它仍然没有,我会建议你向Eclipse提交一个错误报告。 – Xyene 2012-03-25 19:12:36

+0

嗯,我通过javac命令成功编译了一个批处理文件,所以我想我坚持发送一个错误报告。感谢您的建议和帮助。 – 2012-03-25 19:30:29

2

发生这种情况是因为您尚未安装JDK,但只安装了JRE。安装JDK以使其工作。

Source

+0

就是这样。谢谢。 – 2017-07-08 09:39:02