I saw some other similar posts, but they didn't seem to answer my question.
I have a package of java files, and the java functions inside one file call java functions from a different file. Right now I am limited to run my program from the parent directory of gitlet as shown in the screenshot. Is there a way to run my java program from any arbitrary directory?
PS I am hoping to get a solution that can be done just inside terminal.
从任何地方
java -cp path/to/my/compiled/classes/directory1 fully.qualified.name.of.BootstrapClass
Is there a way to run my java program from any arbitrary directory?
Yes, you can add the base directory that contains the compiled .class
files to the CLASSPATH
environment variable.
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.