简体   繁体   中英

does javac sourcepath work?

I am trying to use javac -sourcepath but I feeling I am doing something really stupid.

[leoks@x ~]$ pwd
/home/leoks

[leoks@x ~]$ /opt/jdk1.7.0_40/bin/javac -sourcepath /home/leoks/EclipseIndigo/workspace2/sand/src/ Hello.java
javac: file not found: Hello.java
Usage: javac <options> <source files>
use -help for a list of possible options

[leoks@x ~]$ /opt/jdk1.7.0_40/bin/javac             /home/leoks/EclipseIndigo/workspace2/sand/src/Hello.java

[leoks@x ~]$ /opt/jdk1.7.0_40/bin/javac -help
Usage: javac <options> <source files>
where possible options include:
(...)
-sourcepath <path>         Specify where to find input source files

I know nobody uses this option, but is this option broken? Or am I missing something here?

Put your source into a package and try again:

[leoks@x ~]$ /opt/jdk1.7.0_40/bin/javac -sourcepath /home/leoks/EclipseIndigo/workspace2/sand/src/ t/Hello.java

It is not good practice to put classes into the default package .

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM