Java program that comes with JRE

4

I want to create a program in Java, but you do not need to have Java installed on your computer. How do I put a JRE next to my program with just the required classes?

An example: I created a program and only used the System class and the classes that System calls. Can not you do a JRE with just the classes being used?

Did you understand? If not, let me know.

    
asked by anonymous 25.08.2014 / 02:36

1 answer

4

You can add the JRE (or JDK depending on your application) to the installation directory for your program. To do this, download the JRE in compressed format (tar.gz) and unzip to a directory inside the installation directory of your program. When you run your program, use the Java executable in that new directory.

Example:

Assuming you want to use JRE 1.7 in a 64-bit windows 7 environment, you should download in this link of the jre-7u67-windows-x64.tar.gz file. If your program uses the structure below:

Just unpack the JRE into a directory, for example jre_internal. Then just edit the bat file to use the new JRE.

Important

Because it has not been installed, this particular JRE will not automatically update (unless you do so too), which may compromise the security of the environment.

    
25.08.2014 / 16:41