Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Unable to make jar file with File, Export
Unable to make jar file with File, Export [message #188311] Fri, 03 December 2004 01:49 Go to next message
Bill Ewing is currently offline Bill EwingFriend
Messages: 49
Registered: July 2009
Member
Apologies if this is wrong forum, old topic or dumb question.

We used File, Export, Jar to create a jar file in Eclipse 3.0.1 on a
Windows 2000 PC. When we double-click on the jar file, we get the message
"Could not find main class."

From looking long and hard for an answer, we know posts like this abound
on the web.

Here's what we know and have tried:
1. The manifest.mf file must call out the class that has the static main
method in it.

2. The above must have the Main-Class header in it. Package name must be
included. ".class" must not follow the class name.

3. We've examined the jar file using Winzip a zillion times. It all looks
OK, including the manifest.

4. We've examined and tested jar files we've made with other IDE's. They
look and run fine.

5. We saw one post where someone had the idea that the "String arg[]"
argument in the main method was the problem-- he thought that the launcher
is looking for only main() with no args. This guy begged the web for help
and didn't get one coherent response after days of exposure to hundreds of
experts. We're frustrated too.

6. We've tried this on different PC's, different people doing it, and
after reboots. Of course, we remembered to check "Export generated
classes and resources" and those classes appear in the jar when we
examined it. We tried changing names and package names.

7. We tried removing the String arg[] from main. Eclipse won't compile
with this, nor will it allow you to include a no argument version of main.
Seemed like a good idea.

8. We tried running the jar from the command line with
java -jar OurClass.jar
We get the same problem, though the message wording is slightly different.

9. We've made jar files using Sun One Studio and IntelliJ (and maybe
JBuilder) and they didn't have this problem.

Our question is:
Can anyone get File, Export, Jar to work at all? We simply want to make a
jar file and let our customers double click on it in windows and it runs.

All suggestions and comments will be appreciated, thanks.
Re: Unable to make jar file with File, Export [message #188319 is a reply to message #188311] Fri, 03 December 2004 01:54 Go to previous messageGo to next message
Bill Ewing is currently offline Bill EwingFriend
Messages: 49
Registered: July 2009
Member
I forgot to mention that we are aware of Bugzilla Bug 47471.

We found the communication in that series of messages fairly confusing.

If that is indeed the answer to our problem, we humbly request someone who
is semi-articulate in English please explain it to us.
Re: Unable to make jar file with File, Export [message #188344 is a reply to message #188311] Fri, 03 December 2004 09:54 Go to previous messageGo to next message
Eclipse UserFriend
Originally posted by: daniel.megert.gmx.net

Bill Ewing wrote:

> Apologies if this is wrong forum, old topic or dumb question.
>
> We used File, Export, Jar to create a jar file in Eclipse 3.0.1 on a
> Windows 2000 PC. When we double-click on the jar file, we get the
> message "Could not find main class."
>
> From looking long and hard for an answer, we know posts like this
> abound on the web.
> Here's what we know and have tried:
> 1. The manifest.mf file must call out the class that has the static
> main method in it.
> 2. The above must have the Main-Class header in it. Package name must
> be included. ".class" must not follow the class name.
>
> 3. We've examined the jar file using Winzip a zillion times. It all
> looks OK, including the manifest.
>
> 4. We've examined and tested jar files we've made with other IDE's.
> They look and run fine.
>
> 5. We saw one post where someone had the idea that the "String arg[]"
> argument in the main method was the problem-- he thought that the
> launcher is looking for only main() with no args. This guy begged the
> web for help and didn't get one coherent response after days of
> exposure to hundreds of experts. We're frustrated too.
>
> 6. We've tried this on different PC's, different people doing it, and
> after reboots. Of course, we remembered to check "Export generated
> classes and resources" and those classes appear in the jar when we
> examined it. We tried changing names and package names.
>
> 7. We tried removing the String arg[] from main. Eclipse won't
> compile with this, nor will it allow you to include a no argument
> version of main. Seemed like a good idea.
>
> 8. We tried running the jar from the command line with java -jar
> OurClass.jar
> We get the same problem, though the message wording is slightly
> different.
>
> 9. We've made jar files using Sun One Studio and IntelliJ (and maybe
> JBuilder) and they didn't have this problem.
>
> Our question is:
> Can anyone get File, Export, Jar to work at all? We simply want to
> make a jar file and let our customers double click on it in windows
> and it runs.
>
> All suggestions and comments will be appreciated, thanks.

Do you let the JAR exporter generate the manifest or do you have your own?

Instead of writing here what you've tried I suggest you file a bug
report against JDT UI with steps to reproduce the problem.

Dani
Re: Unable to make jar file with File, Export [message #188368 is a reply to message #188311] Fri, 03 December 2004 11:04 Go to previous messageGo to next message
Christoph Kutzinski is currently offline Christoph KutzinskiFriend
Messages: 24
Registered: July 2009
Junior Member
Just a quick idea, from a problem I once had with Manifest files:
Did you consider maximum line length? No line in Manifest.mf must be
longer than 72 characters.
For more info see:

http://java.sun.com/j2se/1.4.2/docs/guide/jar/jar.html

Bill Ewing wrote:
> Apologies if this is wrong forum, old topic or dumb question.
>
> We used File, Export, Jar to create a jar file in Eclipse 3.0.1 on a
> Windows 2000 PC. When we double-click on the jar file, we get the
> message "Could not find main class."
>
> From looking long and hard for an answer, we know posts like this
> abound on the web.
> Here's what we know and have tried:
> 1. The manifest.mf file must call out the class that has the static main
> method in it.
> 2. The above must have the Main-Class header in it. Package name must
> be included. ".class" must not follow the class name.
>
> 3. We've examined the jar file using Winzip a zillion times. It all
> looks OK, including the manifest.
>
> 4. We've examined and tested jar files we've made with other IDE's.
> They look and run fine.
>
> 5. We saw one post where someone had the idea that the "String arg[]"
> argument in the main method was the problem-- he thought that the
> launcher is looking for only main() with no args. This guy begged the
> web for help and didn't get one coherent response after days of exposure
> to hundreds of experts. We're frustrated too.
>
> 6. We've tried this on different PC's, different people doing it, and
> after reboots. Of course, we remembered to check "Export generated
> classes and resources" and those classes appear in the jar when we
> examined it. We tried changing names and package names.
>
> 7. We tried removing the String arg[] from main. Eclipse won't compile
> with this, nor will it allow you to include a no argument version of
> main. Seemed like a good idea.
>
> 8. We tried running the jar from the command line with java -jar
> OurClass.jar
> We get the same problem, though the message wording is slightly different.
>
> 9. We've made jar files using Sun One Studio and IntelliJ (and maybe
> JBuilder) and they didn't have this problem.
>
> Our question is:
> Can anyone get File, Export, Jar to work at all? We simply want to make
> a jar file and let our customers double click on it in windows and it runs.
>
> All suggestions and comments will be appreciated, thanks.
Re: Unable to make jar file with File, Export [message #188534 is a reply to message #188311] Sat, 04 December 2004 03:42 Go to previous message
Eclipse UserFriend
Originally posted by: myersj.nospam.gmail.com

This may be a dumb response, but did you specify the class with the
public static void main(String args[]) method in the Main class: field
on the third page of the JAR Export wizard? (the JAR Manifest
Specification page of the wizard)

- Jeff

Bill Ewing wrote:
> Apologies if this is wrong forum, old topic or dumb question.
>
> We used File, Export, Jar to create a jar file in Eclipse 3.0.1 on a
> Windows 2000 PC. When we double-click on the jar file, we get the
> message "Could not find main class."
>
> From looking long and hard for an answer, we know posts like this
> abound on the web.
> Here's what we know and have tried:
> 1. The manifest.mf file must call out the class that has the static main
> method in it.
> 2. The above must have the Main-Class header in it. Package name must
> be included. ".class" must not follow the class name.
>
> 3. We've examined the jar file using Winzip a zillion times. It all
> looks OK, including the manifest.
>
> 4. We've examined and tested jar files we've made with other IDE's.
> They look and run fine.
>
> 5. We saw one post where someone had the idea that the "String arg[]"
> argument in the main method was the problem-- he thought that the
> launcher is looking for only main() with no args. This guy begged the
> web for help and didn't get one coherent response after days of exposure
> to hundreds of experts. We're frustrated too.
>
> 6. We've tried this on different PC's, different people doing it, and
> after reboots. Of course, we remembered to check "Export generated
> classes and resources" and those classes appear in the jar when we
> examined it. We tried changing names and package names.
>
> 7. We tried removing the String arg[] from main. Eclipse won't compile
> with this, nor will it allow you to include a no argument version of
> main. Seemed like a good idea.
>
> 8. We tried running the jar from the command line with java -jar
> OurClass.jar
> We get the same problem, though the message wording is slightly different.
>
> 9. We've made jar files using Sun One Studio and IntelliJ (and maybe
> JBuilder) and they didn't have this problem.
>
> Our question is:
> Can anyone get File, Export, Jar to work at all? We simply want to make
> a jar file and let our customers double click on it in windows and it runs.
>
> All suggestions and comments will be appreciated, thanks.
Previous Topic:Proper way to create PackageFragment
Next Topic:Code generation
Goto Forum:
  


Current Time: Fri Apr 26 11:56:54 GMT 2024

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

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

Back to the top