Question

I have a simple application consisting of 3 classes which are PercentIdentity.java, GUI.java and Aligner.java

I am working with Intellij Idea 11.1.3 (I also tried it with Eclipse) and JRE 1.7. My operating system is Win 7 x64.

My program works fine when I double click the jar file I created by using Intellij. Also, it works when I execute the command "java -jar *.jar" where * is the name of my jar file.

Now I want to create an .exe file, so I can run the program on the other computers.

I opened the .jar file with Winrar and i can see the manifest file (MANIFEST.MF) inside the META-INF folder.

My manifest file:

Manifest-Version: 1.0
Main-Class: com.example.PercentIdentity (with an empty line in the end)

After spending a lot of time on Launch4j, JSmooth and IExpress, I managed to create .exe files which are running perfectly on my computer. However, when I run the .exe file on another compuer (again with Win 7 x64) it gives the error:

"Java Virtual Machine Launcher: Could not find the main class: com.example.PercentIdentity. Program will exit."

My JSmooth settings are as follows:

Skeleton Selection: Window Wrapper

Executable: test.exe

Current Directory: . (not sure what to put)

Main Class: com.example.PercentIdentity

Embedded Jar: *.jar

Classpath: *.jar (the same with above)

Min JVM Version: 1.0 Max JVM Version: 1.7

The settings I am using in Launch4j:

Output file: C:\Users\{name}\Desktop\test.exe

Jar: *.jar

(I am not checking the checkbox "Don't wrap the jar")

Manifest: (empty)

Min JRE Version: 1.0

I read an answer in another similar question that the problem may occur because of JRE 1.7, so I tried 1.6 also. However, this time it didn't run even on my own computer.

Anyone have an idea how I can overcome this problem?

Thanks in advance.

No correct solution

OTHER TIPS

In Jsmooth , is classpath for the .jar? Don't say it matters and can be left blank for the jar (implicit location), current directory maybe left blank better than a dot, if anything probably .\ (with a backslash for windows - means current directory).

for main class you can probably just say "PercentIdentity" as the classpath and paths get searched so if there is only one there in the .jar it will be chosen.

about implying where the jar is it is probably given a blank notation or in some configuration documents it is given the notation . , dot is usually used for web sever purposes unless it is part of . in windows or ./ in unix meaning "this directory its in".

If you wish to learn a small quantity of C/C++ you can get away with a short one liner using execv() function and an array or execlp() function and a list, However you will need to learn a large quantity of C/C++ to use the **args pointer array to pass command line parameters.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top