[英]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. 在Linux上,使用bash命令行,我正在运行Java以生成一些plantuml图。 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: 我做了一个“找到plantuml.jar”并找到了它,因此我使用了JAR文件的完整路径,并且该命令起作用了:
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? 我是否需要设置一些Java路径才能使Java找到JAR文件? or must I always use the full path?
还是必须始终使用完整路径? or do I need to move the JAR file to some special location?
还是需要将JAR文件移动到某个特殊位置?
"java -jar" looks for the named JAR file by its relative or absolute filename as given. “ java -jar”通过给定的相对或绝对文件名查找命名的JAR文件。
It seems you are using plantUml from an Eclipse-based installation. 看来您正在使用基于Eclipse的安装中的plantUml。 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.
如果需要重复执行此操作,则可以创建所需的JAR文件的副本,或创建供您使用的Shell脚本。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.