Jason3526
Posts: 2
Joined: Sat May 01, 2004 1:09 am

Could not find the main class error

I am new to this whole concept so I am going to be asking a silly question.
I keep getting "Could not find main class" error when trying to start the program. I have included a Manifest file in my jar that has the main class specified and I have listed the main class when setting up my java product. What am I doing wrong?
Thanks
Jason
Cata
Posts: 638
Joined: Thu Apr 10, 2003 7:37 am
Contact: Website

Hi Jason,

You need to make sure that the main class you specify for your Java product (in the "Main Class" edit field) is the EXACT actual main class of your Java program.

Then you need to include the JAR file containing that class into the class path.

Cata
Catalin Rotaru - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Kerry

Can't find Main Class

Cata, I have the same problem but it seems that I put my.jar file in the Classpath and set the Main Class setting to it's name but it still says it can't find it? We've used your product before and the only difference here is that the Main class is in a default package called (Default Package). So I'm not sure if this is causing the problem.

Thanks
Kerry
Philip
Posts: 27
Joined: Fri Apr 04, 2003 2:06 pm
Contact: Website

Hi there,

Check to make sure you have written the Main Class correctly both in Advanced Installer and in the MANIFEST.MF file. (the class name is case sensitive)

Also, make sure that the name of the MANIFEST.MF file has all uppercase letters. This is a requirement of Java 1.4.2_05.

To check if your main class is written correctly in the manifest file, just double click on the Jar file from the Windows Explorer. It should start your application.

Here's an example of how a MANIFEST.MF file should look like in the JAR:

Manifest-Version: 1.0
Created-By: 1.4.2_05-b04 (Sun Microsystems Inc.)
Main-Class: com.caphyon.awebrank.AdvancedWebRanking

The "Main Class" edit field from the Java Products panel inside Advanced Installer should be like this:

com.caphyon.awebrank.AdvancedWebRanking

Hope this helps,

Philip
Philip Petrescu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Yoster
Posts: 10
Joined: Mon Oct 04, 2010 5:39 pm

Re: Could not find the main class error

Hi everybody,

When starting the (Java) built product I encounter the message: "Could not find main class [name of mainclass]".
This only happens when I built a multilingual package. What I could find out up to now is that in multilingual packages the jar file, determined within the "Java Product" page under "Embedded Jar" is not embedded. This does not happen without using the translation feature and also not with seperate packages. What can I do to solve that?

By the way, after looking for a solution, I discovered the note under "Java Product Localization":

For any language, the name of the launcher and that of the configuration
file must differ without modifying the extension.


If this should be a base to solve this problem, it would be nice to have more information or an example.

Thanks for helping
Best regards
Yoster
Bogdan
Posts: 2794
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: Could not find the main class error

Hi Yoster,

Here is a tutorial on adding translations for custom parts of your package. In our tutorial it is translated a part of the UI, for your case you need to select "File System"
in Translations page.
http://www.advancedinstaller.com/user-g ... guage.html

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
Yoster
Posts: 10
Joined: Mon Oct 04, 2010 5:39 pm

Re: Could not find the main class error

Hi Bogdan,

thank for your answer but that actually does not fix the problem. The way of adding translations is clear and easy but when I select "File System" in the Translation Page under "Select..." I get hundreds of entries within the *.ail file. After changing the translations as for the the *.exe and *.ini file. the jar-file is still not included.

Could you please give more detailed instructions to get this problem fixed?

Best Regards
Yoster
mihai.petcu
Posts: 3860
Joined: Thu Aug 05, 2010 8:01 am

Re: Could not find the main class error

Hi Yoster,

Unfortunately we cannot replicate this behavior on our test machines.

Can you please create a sample project with dummy files( including a dummy .JAR ), generate the dictionary and send us all the content in a .ZIP file to support at advancedinstaller dot com? This way we can perhaps replicate the behavior and further investigate.

All the best,
Mihai
Mihai Petcu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
vibhakar
Posts: 3
Joined: Thu Oct 27, 2016 7:07 pm

Re: Could not find the main class error

I am trying to make a java product installer using advanced installer 12.4.2.

when I run the exe file native installer exe file for java product created by advanced installer it gives an error which states - couldn't find the main class[main class name].

Please help. Its really urgent. Thanks.

I have attached my Advanced Installer Project file in here.
Attachments
Cement Steel Store Manager.aip
(55.14 KiB) Downloaded 514 times
Daniel
Posts: 8276
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Could not find the main class error

Hello,

If you have a JavaFX application please have a look over the "can't find main class - JavaFX Application" thread and let us know if this helped.

Otherwise, please send us a download link of the built setup to support at advancedinstaller dot com so we can further test and investigate this on our side.

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

Return to “Common Problems”