Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Internal compiler produces an error.
Internal compiler produces an error. [message #812296] Sat, 03 March 2012 15:23 Go to next message
Adam Smith is currently offline Adam SmithFriend
Messages: 4
Registered: March 2012
Junior Member
Hi,

I've recently been using the eclipse IDE to develop in java. My program runs fine from within eclipse and even works fine after I compile and launch through cmd. However, after I compile into .jar and then try to launch through the actual .jar. I get the error: Could not find the main class: *filepath* Program will exit.

I've searched about this and it looks like a lot of people have had the same error, but I never found an actual fix. Equally, I've tried messing around with the manifest file etc. to no avail.

Adam
Re: Internal compiler produces an error. [message #812303 is a reply to message #812296] Sat, 03 March 2012 15:35 Go to previous messageGo to next message
Olivier Thomann is currently offline Olivier ThomannFriend
Messages: 518
Registered: July 2009
Senior Member
This has nothing to do with the compiler. You need to properly set up the MANIFEST.MF file to specify what is the main class.
There is a way to specify that using the export as jar.
--
Olivier
Re: Internal compiler produces an error. [message #812307 is a reply to message #812303] Sat, 03 March 2012 15:42 Go to previous messageGo to next message
Adam Smith is currently offline Adam SmithFriend
Messages: 4
Registered: March 2012
Junior Member
I went through that and told eclipse to generate the manifest file, but that didn't work either.
Re: Internal compiler produces an error. [message #812380 is a reply to message #812307] Sat, 03 March 2012 18:26 Go to previous messageGo to next message
David Wegener is currently offline David WegenerFriend
Messages: 1445
Registered: July 2009
Senior Member
On 03/03/2012 09:42 AM, Adam Smith wrote:
> I went through that and told eclipse to generate the manifest file, but
> that didn't work either.

Does the Main-Class entry in your manifest file match the fully
qualified name of your main class?

Does the jar file include your main class?

Make sure you launch your class at least once in Eclipse.

Select File->Export->Runnable Jar File.

Select the launch configuration used to launch our class at the top of
the wizard.

Enter the destination for the jar file including the filename.jar

Click Finish.
Re: Internal compiler produces an error. [message #812451 is a reply to message #812380] Sat, 03 March 2012 21:08 Go to previous messageGo to next message
Adam Smith is currently offline Adam SmithFriend
Messages: 4
Registered: March 2012
Junior Member
David Wegener wrote on Sat, 03 March 2012 13:26
On 03/03/2012 09:42 AM, Adam Smith wrote:
> I went through that and told eclipse to generate the manifest file, but
> that didn't work either.

Does the Main-Class entry in your manifest file match the fully
qualified name of your main class?

Does the jar file include your main class?

Make sure you launch your class at least once in Eclipse.

Select File->Export->Runnable Jar File.

Select the launch configuration used to launch our class at the top of
the wizard.

Enter the destination for the jar file including the filename.jar

Click Finish.


Tried your suggestions but it hasn't worked. The manifest file shows the classpath of the main class so I don't get why it's not working. It runs perfectly in eclipse too.

[Updated on: Sat, 03 March 2012 21:15]

Report message to a moderator

Re: Internal compiler produces an error. [message #813328 is a reply to message #812451] Mon, 05 March 2012 05:37 Go to previous messageGo to next message
Satyam Kandula is currently offline Satyam KandulaFriend
Messages: 444
Registered: July 2009
Senior Member
Did you verify if the *filepath* really exist in the jar?
Re: Internal compiler produces an error. [message #814483 is a reply to message #813328] Tue, 06 March 2012 14:02 Go to previous messageGo to next message
Adam Smith is currently offline Adam SmithFriend
Messages: 4
Registered: March 2012
Junior Member
Yeah, that's just the filepath of the .jar.
Re: Internal compiler produces an error. [message #814753 is a reply to message #814483] Tue, 06 March 2012 21:12 Go to previous messageGo to next message
David Wegener is currently offline David WegenerFriend
Messages: 1445
Registered: July 2009
Senior Member
Have you actually opened the jar file and looked at the contents?

Post the Manifiest file from the jar file along with the jar file content hierarchy.

What is the command you are using to run the jar file?
icon10.gif  Re: Internal compiler produces an error. [message #816205 is a reply to message #812296] Thu, 08 March 2012 14:52 Go to previous message
Harutyun Arzumanian is currently offline Harutyun ArzumanianFriend
Messages: 35
Registered: February 2012
Member
In the manifest file put the following:
Class-Path: Library.jar

This document gives more details:
Jar Deployment
To create a jar using the a manifest file named MANIFEST, you can use the following command:
jar -cmf MANIFEST MyJar.jar <class files>

If you specify relative class-paths (ie, other jars in the same directory), you can move the jar's around
Then run the jar like this:
java -jar MyJar.jar
Previous Topic:An Eclipse Plugin for GWT code generation
Next Topic:Error message when running antrunner
Goto Forum:
  


Current Time: Fri Apr 26 10:20:20 GMT 2024

Powered by FUDForum. Page generated in 0.03456 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top