原程序是
HelloWorld.javapublic class HelloWorld{
public static void main ( String args[] ) {
System.out.println("hello world!"); }
}
HelloWorld.javapublic class HelloWorld{
public static void main ( String args[] ) {
System.out.println("hello world!"); }
}
为什么不在java文件所在目录底下编译?
难道加个path显出水平?
classpath=,;c:\j2sdk14\lib\tools.jar;c:\j2sdk14\lib\dt.jar;
c:\j2sdk14\bin;
javahome=c:\j2sdk14;
我的电脑右键属性,高级里环境变量有没有问题?
环境变量没有错
编译的时候不用设置classpath的吧
不可以这么写!还是把当前目录换成e:\pro后,用javac HelloWorld.java命令编译吧!
改成:
c:\>cd e:\pro<-
e:\pro>javac HelloWorld.java<-
注意前面一定要加个分号,表示当前目录。然后进入
e:\pro 运行javac HelloWorld.java看看行不行?还不行的话,把错误代码贴上来
C:\>javac -cp e:\pro\HelloWorld.java
C:\>javac -classpath e:\pro\HelloWorld.java
出现这样的错误
javac: no source files
Usage: javac <options> <source files>
where possible options include:
-g Generate all debugging info
-g:none Generate no debugging info
-g:{lines,vars,source} Generate only some debugging info
-nowarn Generate no warnings
-verbose Output messages about what the compiler is doing
-deprecation Output source locations where deprecated APIs are us
ed
-classpath <path> Specify where to find user class files
-sourcepath <path> Specify where to find input source files
-bootclasspath <path> Override location of bootstrap class files
-extdirs <dirs> Override location of installed extensions
-d <directory> Specify where to place generated class files
-encoding <encoding> Specify character encoding used by source files
-source <release> Provide source compatibility with specified release
-target <release> Generate class files for specific VM version
-help Print a synopsis of standard options