Current location - Health Preservation Learning Network - Healthy weight loss - How can urgent java be packaged into an exe file to run on a computer without jre?
How can urgent java be packaged into an exe file to run on a computer without jre?
There is a simple way: copy the jre running environment to your program directory. You can create a separate directory for your class files or jar files as the home directory of your program, and then copy the directory (usually called java_home) in the jre unzipped folder to your newly created home directory, and put the classes or jar packages in the home directory. Then create a file with a suffix. Bat in this directory, open it with Notepad, and write commands directly when running java, but the java program you use here is the jre in this folder, not the jre in the environment variable, so it should be a relative path, bin\java class name, (jar package is the same), save the following, and double-click to run it. Moreover, this running environment follows your program, even if you go to a strange machine, you can double-click to run it, and you can also run this bat file. The general steps are as follows. There seems to be a lot of words, but there are not many real steps. Understanding is very important.