Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Accessing Java Packages in different Drives

Tags:

java

windows

Consider if I have got a Package in my C:\x\y\z and another package in D:\m\n\o. How can I access them in my java program? Do I need to set any path?

like image 824
1s2a3n4j5e6e7v Avatar asked Dec 08 '25 10:12

1s2a3n4j5e6e7v


1 Answers

You need to set your classpath to add each directory. Assuming that your package structure begins underneath each of those directories:

java -classpath C:\x\y\z;D:\m\n\o <MyClassName>

See docs.

like image 164
skaffman Avatar answered Dec 09 '25 23:12

skaffman



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!