gmseed
Posts: 5
Joined: Thu Mar 14, 2013 11:24 am

can't find main class

Thu Mar 14, 2013 11:38 am

Hi

Using the 30 day trial version, I built an installer for a NetBeans Java project and followed the instructions at:

http://www.advancedinstaller.com/user-g ... -java.html

It builds and saves ok but when I run it pops up with a the dialog box stating that the main class cannot be found.

It's weird because as soon as I add the application .jar file it auto-fills the main class field, so it clearly knows the main class.

The only thing I can think of is that it the .jar is automatically built as a JavaFX project in NetBeans and the .jar manifest consists of entries like:

JavaFX-Application-Class: com.Main
Main-Class: com/javafx/main/Main
...

The main class is correct in JavaFX-Application-Class but incorrect in Main-Class.

Graham

Daniel
Posts: 8237
Joined: Mon Apr 02, 2012 1:11 pm
Contact:  Website

Re: can't find main class

Fri Mar 15, 2013 3:34 pm

Hello Graham and welcome to Advanced Installer forums,

Thank you for your interest in Advanced Installer.

I'm not sure why this happens. Can you please send us the .AIP (project file) and the related .jar file (and its dependencies - if exist) to support at advancedinstaller dot com so we can investigate them? Also, can you please specify what command line you are using when run the .jar file using java.exe?

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

mikejwatts
Posts: 5
Joined: Fri Apr 03, 2009 2:17 pm

Re: can't find main class - JavaFX Application

Wed Mar 27, 2013 11:04 am

For anyone else coming this way I thought I'd post my experiences.

I have a JavaFX application with a similar MANIFEST.MF contents i.e. it has
JavaFX-Application-Class: <points to the correct class>
Main-Class: com/javafx/main/Main

Double-clicking on the jar file runs it fine, but the .exe created by Advanced Installer causes problems.

1. Java application runs fine in IDE and on the development machine but crashes out of memory on another machine.

I thought this was a real Java VM bug but it wasn't - JavaFX needs 4 files to be linked ( at least in the IDE I use, NetBeans ): deploy.jar, jfxrt.jar, plugin.jar and javaws.jar. These are included in Java 7 now ( previously they needed to be installed separately as JavaFX 2.x ). These need to be removed from the installer distribution... the crash I experienced was due to the version of these files running with a later version of Java.

2. Once you've removed these files, the installed application starts up stating it cannot find the main class and gives the correct class name.

The clue is in the manifest: in the Java products tab you need to provide the com/javafx/main/Main in the Main Class entry.

Hope that helps someone.

Regards, Mike Watts

Daniel
Posts: 8237
Joined: Mon Apr 02, 2012 1:11 pm
Contact:  Website

Re: can't find main class

Wed Mar 27, 2013 4:37 pm

Hello Mike,

Thank you for your contribution to Advanced Installer forums. I'm sure this will help someone in the future.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”