Java program that comes with JRE

Asked

Viewed 381 times

6

I want to create a program in Java, but that the person does not need to have Java installed on their computer. Can I put an JRE next to my program with only the necessary classes?

An example is: I created a program and only used the System class and the classes that System calls. There is no way I can do an JRE with only the classes being used?

Other than that, what I need most is to have the JRE join the program, and when I put the program on the person’s pc, it installs the JRE (compressed or not) and the program can run

Do you understand? If not, let me know.

  • Igor, from what I understood what you should do is create a custom install that would install/update the java in addition to installing your software. Look for software created from installation that can solve your problem

  • Using Javafx is exactly what happens when using Native Packaging.

1 answer

6


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

Example:

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

pacote

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

Important

Since it has not been installed, this specific JRE will not be updated automatically (unless you also do so) and may compromise the safety of the environment.

  • Very good. Just one more thing: would bat code run java.exe? Type: jre/.../java Program.class

  • @Igorcostamelo exactly.

Browser other questions tagged

You are not signed in. Login or sign up in order to post.