我是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。
我不确定这是什么或为什么开始这样做。我如何修复编译器以便继续学习?
答案 0 :(得分:2)
我也遇到过这个问题。尝试重新启动Eclipse。如果这不起作用,请重新启动计算机。如果即使这样也不起作用,请重新安装Java。它是一个烦人的错误,通常在计算机在Eclipse上运行时进入待机状态时发生。
编辑:如果问题仍然存在,你可以创建一个小的javac程序来编译给定目录中的任何代码。
希望我帮忙!
答案 1 :(得分:2)
这是因为您没有安装JDK而只安装了JRE。安装JDK以使其工作。