3

I've made a little GUI program to enter contents then send "javamail" to my email. I have to import many jar libraries from javamail-1.4.5 and then I build it (shift + f11) to jar, then use exe4j to make it exe (also add all the jars from the libraries in the /dist/lib) and version of jre from 1.5 to 1.7 (I'm using 1.7 to make this app). It works smoothly on my computer but when I give the exe to others computer. It said:

"No JVM could be found on your system. Please define EXE4J_JAVA_HOME to point to an installed 32-bit JDK or JRE or download a JRE from www.java.com"

I think they must install the JDK in order to be able to run the app. But it may be confusing to many of my friends who don't know about computing. Is there anyway can they use that send-javamail-app without asking them to install the JDK?

Thanks in advance and sorry for my English!

MC Emperor
  • 17,266
  • 13
  • 70
  • 106
Tran Hoai Nam
  • 999
  • 1
  • 13
  • 23
  • You don't need jdk, you need JRE, jsut be sure target machine has one (most modern PC have it anyway) and set EXE4J_JAVA_HOME accordingly – BigMike Nov 12 '12 at 11:44
  • 1
    have a read here: http://stackoverflow.com/questions/7071133/how-to-bundle-a-jre-with-launch4j – bobah Nov 12 '12 at 11:51

4 Answers4

3

It's quite simple.

After you have done basic steps as set the name, icon, etc, in step number 6 JRE is where the magic happens:

  1. Click Advanced Options and select Search sequence

enter image description here

  1. Click to add new item + and select directory

enter image description here

  1. Select your jre directory, it must be a relative path

enter image description here

  1. Put your new item at the first position in list enter image description here

After that what you have to do is release your exe with the jre directory together, to do that usually I use Inno Setup Compiler to create a installer.

Victor Laerte
  • 6,020
  • 12
  • 50
  • 93
1

You can bundle the JRE with your product, this is the best way you can achieve without bothering your buddies. The size of your application will increase.

JRE is required to run any java application.

Hope this helps.

rxx
  • 718
  • 6
  • 14
0

Java Runtime Environment (JRE) is required to run the Java application. In order to install JRE on a computer without Java installed, you must either bundle it (put it inside your application), or ask your friends to download JRE.
I don't know exactly how to bundle JRE, but the question Bundling the JRE with a Java application can probably help.

Community
  • 1
  • 1
MC Emperor
  • 17,266
  • 13
  • 70
  • 106
0

Maybe my personal project Java Customization Builder can help you, it analyzes the classes used by your program, and slim these classes from jars, and it also analyzes jvm files used by your program. Then it make an executable file and pack200 the jre runtime and your program.

JCB Project Introduction:

Java Customization Builder is a tool which customizes your java application and JRE.

It is a java application building tool enabling you to generate a very small java archive package which has a slimmed jre. For the swing application, the archive is less than 5M, for the SWT application, the archive is less than 3M usually. And the customed java applicaton can run on the Windows which doesn't install a JRE, and be loaded by an executable.

JCB project page: http://jcb.sourceforge.net

user1112699
  • 187
  • 3
  • Can you give me a link for a tutorial? I've been clicking and after compiling I have a exe file with 2 folders, and the exe can't run without those folder... I'm kinda confuse now – Tran Hoai Nam Nov 12 '12 at 14:36