简体   繁体   中英

Why does this javac command not work?

javac -cp .:gson-2.3.1.jar:commons-io-2.4.jar File.java

The above command works on one of my linux machines. However it does not work on another one even though it is the same distro! (Debian)

The shell does not throw any errors of any sort which suggests it is finding the .jar files just fine, however the java compiler throws errors wherever I have used the .jar files in my code eg "the import org.apache cannot be resolved" , "the import org.gson cannot be resolved" etc.

The Java file and both the required .jar files are in the current directory. I am using Java 1.6. What is going wrong here?

FIXED. Out of desperation I changed javac -cp to javac -classpath and it magically worked. Always pays to be explicit!

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