开发者

javac no source files found

I have the .java file on the current working directory but javac reports:

javac: no source files
Usage: javac <options> <source files>
use -help for a list of possible options

I'm working on ubu开发者_JAVA技巧ntu.


From your comment above, it looks like you tried:

javac -cp .;lib.jar a.java on your Ubuntu system. The CLASSPATH separator is : on Unix systems and ; on Windows.

Ubuntu considered the command up to the ;, java -cp . and thus gave the message.

javac -cp .:lib.jar a.java should compile fine.


For anyone who is using powersehll on windows use CLASSPATH separator : instead of ;


I tried a similar thing and found that you need to mention the absolute path when you are using the -cp and -d option with javac like this

javac -cp 'ur location of jars & files'; -d 'location to add your classes to' 'absolute path of file'

eg:

javac -cp C:\home\lib\mywork; -d c:\home\classes c:\home\files*.java


for javac, there are options and arguments arg: it takes argument as path of source file options: we require for basic compilation

-sourcepath: the path of dependent source files -d: directory path of output classes


javac -sourcepath './src' -d './bin' -verbose './src/App.java'

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜