I have a jar file which I'm using to run as an application. However, every time I run my application I need to add -cp "jar name" to compile it and then run the java application.
How can I make a permanent change so that I don't have to use the command line commands for this task? Can I put that in certain lib location?
Note: I don't have to use any IDE. It has to be from a terminal.
Add your custom JAR in the CLASSPATH
. Steps to setup and verify are available here: JAVA PATH & CLASSPATH
您可以将您的lib或其他jar复制到JAVA_HOME / lib / ext或系统变量CLASSPATH中的任何目录中
One more solution: extension libraries, put your jar into $JAVA_HOME/lib/ext
One needs to be careful - every java application will pick up this jar
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.