Current location - Health Preservation Learning Network - Slimming men and women - Java program running, I wrote my own Java program, I want to run it on a computer without virtual connection. How can it be achieved?
Java program running, I wrote my own Java program, I want to run it on a computer without virtual connection. How can it be achieved?
1. Copy the full version of the jre folder to drive D.

2. Delete all files or directories under the bin and lib directories in the jre directory.

3. Open the cmd window, set path path to null, go to the D:\jre\bin directory, and run java -version. Displays the current version of Java normally.

4. Create a new temp directory under the bin directory, and move all directories except java.exe and java.dll to the temp directory.

5. Run the java -version command again, indicating that verify.dll was not found. Move the verify.dll in the temporary directory to the bin directory.

6. Run the java -version command again, prompting that the java virtual machine cannot be created. Mistake.

7. According to the test: hpi.dll and zip.dll should also be placed in the bin directory.

8. Run the java -version command again, OK, and the version information will appear again. At this point, you can move the temp directory out of the bin directory. (Put it on the desktop first)

9. Delete files in the client directory except jvm.dll. Go to the jre directory and check the size of the bin directory, 2.89MB, but there are still more than 60M lib directories at this time.

10. Go to the lib directory, create a new temp directory, move all directories except i386 to the temp directory, and run the java -version command again, OK.

1 1. Create a new temp2 directory, move all files except charsets.jar and rt.jar to the temp2 directory, and run the Java -version command again, OK.

12. Move the temp2 and temp directories to the desktop. At this time, lib is still 48.7M, close to 50M. (Still have to work hard)

13. Restore charsets.jar and rt.jar (you can use the 7z tool to view and modify the contents of "directly add and delete" jar files). Prepare to make a software to realize it.

14. Reduction principle. Run Java-verbose: class-version >; Temp.java command, at this time in the bin directory generated a temp.java file, open it with EditPlus, look, what you want to load are those classes, just delete all the unnecessary ones.

15. As a result, charsets.jar was not loaded. Delete it directly and run the java -version command again, OK.

16. The next job is to cut rt.jar slowly. You can also make a software to complete it. You can download a GreenJVMMake.jar to do this. But sometimes it seems that some classes are not loaded. It's time to consider updating.

17. After cutting and playing rt.jar, run java -version again, and version information will appear. good

18. Go to D to check the simplified jre, which is only 4.47MB, less than 5 meters. good

19. The smallest jre is completed.