As a downright rookie, recently need to run the code on the server, the worry is really a lot of things.
After writing the code locally, it has to be packaged and uploaded to the server. The question comes, so what about the third-party jar package?
Either hit the runnable jar bag, each time the package is big, upload efficiency is too low. If there's a lot of code in that kind of bug, that's enough trouble. It is also possible to change the value of the Classpath in the profile (Linux system) by either hitting the normal jar package, not including the third-party package, and then modifying the classpath if there is a lot of jar packages for the third party.
So, the way I use it,
1. The first time you pack the jar package into runnable (you need to specify MainClass), so that the project needs the jar package is included in the jar package, such as the generation of A.jar, upload the jar to the server, you can run directly, you can use the command:
Java A.jar
(I feel like it is inconvenient, if you need to execute multiple classes at the same time, but runnable can only specify a mainclass, what to do?) )
2. Upload the compiled class file (folder) to the server and execute the class test using the following command:
JAVA-CP A.jar TEST-CP Specifies that the classpath is a previously packaged jar package, so that the required class can be found in the jar package. Test is the main class to execute
This method can execute multiple classes at the same time, and ensures that all third-party jar packages can be found. Also, if you modify one of the classes locally, you just need to re-upload the. class file for the modified class, and it's convenient. Do not know if there is a wrong place, please correct me.
|
The things that the jar packages upload to the server side