We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpIntegration › "Could not find the main class"
Page Index Toggle Pages: 1
"Could not find the main class" (Read 2428 times)
"Could not find the main class"
Nov 10th, 2008, 7:22pm
 
Hello,
I have been exporting applets using the standard "export" command.  Recently I just tried the "Export Application" command.  It worked fine.  However, now when i just try to do a simple "export" processing is splitting it up into "core.jar", "itext.far", "mysketch.jar", etc.  and will not allow me to just click on "mysketch.jar" as I have done in the past.

The error message "Could not find the main class: mysketch. Program will exit." pops up.

I've tried reinstalling Processing and Java.  No luck.

Also, all .jar files that are old (before I tried the "Export Application") work just fine.

Please help.  I want my old export back.
Thank you.
Andrew
Re: "Could not find the main class"
Reply #1 - Nov 12th, 2008, 12:05am
 
there's an option in Preferences which says
"Use multiple .jar files when exporting applets".
could that be it?
Re: "Could not find the main class"
Reply #2 - Nov 12th, 2008, 1:13am
 
I saw that and tried both ways.  No luck.
Thanks.
Andrew
Re: "Could not find the main class"
Reply #3 - Nov 12th, 2008, 1:19am
 
I had the JDK installed when I performed this operation.  I have since uninstalled it and gone back to the JRE.  Could that have anything to do with it?  I didn't mess around with anything other than that.

Otherwise, if there is a way I could recompile them, maybe that's an option.  I'm sure there is...I'm just not that savvy.

Thanks.
Andrew
Re: "Could not find the main class"
Reply #4 - Nov 12th, 2008, 7:44am
 
What version of Processing do you use? On which platform (Windows? Mac? Linux?)
Is that the expert version or the standard one?
In the latter case, the version of Java you have should not matter, Processing includes everything that is needed.
In the former case, you need a JDK to access some operations like jar exporting (I think), but Processing should complain if it finds a simple JRE.
Re: "Could not find the main class"
Reply #5 - Nov 12th, 2008, 3:35pm
 
Hello PhiLho,
I am using Pr155 now.  Although at the time when this started it was Pr154.  Window Vista Business.  

I had the JDK installed when all this started going badly.  But have since reverted back to the JRE.  Like I said I didn't monkey around with anything fancy....just tried the 2 kinds of exporting that are standard within Processing.

Thanks.
Andrew
Re: "Could not find the main class"
Reply #6 - Nov 13th, 2008, 6:12am
 
You can't just double-click on individual JAR files when you're using libraries, and expect them to work. JAR files have no means of finding other related files. When libraries are in use, JAR files must be kept intact when exporting, because some rely on their structure to work properly.

This sort of worked in past releases of Processing (depending on what library you were using), but created larger problems with other, more complicated libraries.

When exporting, use the index.html file to run the code if it's an applet, or use the .exe, .app, or shell script to run an exported application. Double-clicking the individual JAR won't work in most cases.
Re: "Could not find the main class"
Reply #7 - Nov 13th, 2008, 4:01pm
 
Fry,
Thank you very much.  I'm surprised I didn't run into this earlier.  I've used Processing extensively and this is the first time I have run into this problem.  Good to know.  .exe's or html from now on.
Thank you kindly.
Andrew
Page Index Toggle Pages: 1