0

I have the JSmooth software in my local system. I am trying to generate my jar file as exe but I am getting error when I click on run the exe it is showing.

java virtual machine launcher --->
    Could not find main class: MainClass .Program will exit.

How to use JSmooth software to create a working executable?

Andrew Thompson
  • 168,117
  • 40
  • 217
  • 433
sateesh
  • 1
  • 1
  • 3

3 Answers3

3

Can you execute your jar file by double clicking on it ? Any jar package for executing will need a file named MANIFEST.MF which located in META-INF directory in that package. In that file you can tell VM where to find main method of your program to start execution. Many IDE's like netbeans by default will generate an executable jar file (I mean JVM executable package and not binary exe file!) when you build your project.
I don't know about JSmooth, but for running a jar file, you must say jvm where to find main method. So you may want to check your jar file & your MANIFEST.MF should contain something like this:

Manifest-Version: 1.0
Ant-Version: Apache Ant 1.x.x
Created-By: 1.x.x (Sun Microsystems Inc.)
Class-Path: 
X-COMMENT: Main-Class will be added automatically by build
Main-Class: path.to.main.class
Ehsan Khodarahmi
  • 4,772
  • 10
  • 60
  • 87
  • +1 - the most likely problem here is that the JAR file has not been properly constructed as an *executable* JAR file. And that will trip up JSmooth. – Stephen C Apr 25 '12 at 07:09
  • no, it is netbeans generated jar i am giving it to JSmooth App event though same problem?. – sateesh Apr 25 '12 at 11:45
  • if it is a netbeans generated jar file, make sure that you have the main method (i mean "public static void main") & you must set the class containing main as you Main Class in project properties -> run – Ehsan Khodarahmi Apr 25 '12 at 12:01
  • thanque very much yes as u said it is working fine now problem in jar file only.After adding correct manifest file it is working fine now. – sateesh Apr 26 '12 at 06:30
  • +1 for this answer. I hadn't realized that instead of targeting my jar directly, I should have instead been targeting the directory that my jar and manifest were in. Everything works as expected now. – arkon May 30 '12 at 10:37
1

JSmooth has issue for import files. Better you can go with Launch4j tool. Its working perfectly.

just download it from http://sourceforge.net/projects/launch4j

Steps to be followed 1. give any name as output file with .exe extension and select yr jar file under basic tab 2. mention Min JRE version as 1.4.0 under JRE tab 3. Save it and execute. It creates exe file.

0

I found that the MANIFEST.MF had listed my main class as "Main", and not "Main.class". Adding the class extension fixed it for me.