What is the classpath in Java?
•
Java
I wrote a program that works on my laptop, but I really hope it works on the server I own Using netbean, I have cleaned up and built the project I copied the contents of the folder dist on my server, but I can't seem to use the command Java - jar nameoffile jar
I got the wrong Java lang.NoClassDefFoundError:org / ….
I've been doing some reading, and what I've collected is that I need to almost specify the location of the library I use They are located in a subfolder called lib
So what do I need to do to run my jar?
Solution
Try:
java -classpath "$CLASSPATH:nameOfFile.jar:lib/*" path.to.your.MainClass
This is done by setting the classpath to the value of $classpath plus nameoffile Jar, and all in lib / Jar file
The content of this article comes from the network collection of netizens. It is used as a learning reference. The copyright belongs to the original author.
THE END
二维码