简体   繁体   中英

difference between classpath and sourcepath?

I have this confusion regarding the classpath and sourcepath.I have referred to theselinks too but i aint getting it right. REFERENCES--

Differences between classpath and sourcepath options of javac

-sourcepath vs -classpath

Regarding automatic recompilation, I can't spot the difference between javac's -classpath and -sourcepath options

Does it mean if we dont edit the source file,both classpath and sourcepath wouldnt be recompiled? Specifically,this line troubled me! Note that classes found through the classpath are subject to automatic recompilation if their sources are found. Can anyone explain this in simple language with SIMPLE EXAMPLES?It would be of great help!

The sourcepath is the path to the sources you are compiling.

The classpath is a path (or multiple paths) to libraries you are compiling against. These are compiled classes, either in folders or Jar files.

Sourcepath tells javac where to grab the source code from. Classpath tells javac where to grab other class files that will allow your source code to compile.

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