If you configure the JRE environment, you now have a packaged jar file that you can start executing
Java-classpath Example.jar MainClass
-classpath tells the virtual machine where to find the byte code of the class, by the way, the virtual machine load class is lazy loaded, only the time to load, the virtual machine in the following order to search and load:
1 bootstrap classes, basic class, such as Java Library class
2 extension classes, extended class, such as class under/jre/lib/ext
3 user-defined classes, user-defined classes, such as the top MainClass.
However, sometimes the following error occurs when executing the above command,
Java.lang.SecurityException:no manifest section for signature file entry ...
This is because some files require signature verification, we can manually remove these files to achieve the purpose of running. Delete the SUN_MICR under the Meta-inf folder. RSA and SUN_MICR. SF file.
mkdir tmp
CD tmp
JAR-XVF. /hongchangfirst.jar
RM meta-inf/sun_micr.*
Jar CVF. /hongchangfirst.jar *
Cd..
RM-RF tmp
Original: http://blog.csdn.net/hongchangfirst/article/details/25606509
Author: Hongchangfirst
Hongchangfirst's homepage: http://blog.csdn.net/hongchangfirst
How to execute a jar file with the command line