-1

I am trying to compile a Java source file on command prompt with the following command

C:\temp\test>javac -cp ".\*;"  *.java

but the class does not get compiles, I have errors of type files not found, or could not find resource.

Even though the jars are present in the same directory as the Java files.

4

2 回答 2

2

C:\temp\test>javac -cp ".;*.jar" *.java

请参阅http://java.sun.com/javase/6/docs/technotes/tools/windows/classpath.html

于 2009-06-10T10:13:15.357 回答
0

很容易忘记.jar文件是压缩文件系统结构,而不是.class文件。当您在 中指定目录时,该目录中的-classpath所有.class文件都可供加载程序使用。指定.jar文件类似于指定目录,但除了文件根目录.class中的文件外.jar,它还使压缩到结构.class中的包中的文件可用。.jar请记住,包结构反映了目录结构。

于 2009-06-10T12:33:55.133 回答