简体   繁体   中英

When running java how do I get around the need to enter the full path of my JAR file?

On linux, using bash command line, I am running java to produce some plantuml diagrams. If I run the following:

java -jar plantuml.jar Radio_1.2Rad_1200K.uml

I get the error:

ERROR: Unable to access jarfile plantuml.jar

I did a "locate plantuml.jar" and found it, so then I used the full path of the JAR file and the command works:

java -jar /usr/lib/eclipse/configuration/org.eclipse.osgi/384/0/.cp/lib/plantUml/plantuml.jar Radio_1.2Rad_1200K.uml

Is there some java path I need to setup in order for java to locate the JAR file? or must I always use the full path? or do I need to move the JAR file to some special location?

"java -jar" looks for the named JAR file by its relative or absolute filename as given.

It seems you are using plantUml from an Eclipse-based installation. If you need to do that repeatedly, you could create a copy of the JAR file that you need, or create a shell script for you to use.

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