Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

difference between classpath and sourcepath?

Tags:

java

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!

like image 491
newuser Avatar asked Apr 12 '26 23:04

newuser


1 Answers

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.

like image 177
Sean Patrick Floyd Avatar answered Apr 15 '26 12:04

Sean Patrick Floyd



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!