The Artima Developer Community
Sponsored Link

Java Answers Forum
Problem Creating Executable JAR

3 replies on 1 page. Most recent reply: Apr 6, 2005 6:56 AM by Matthias Neumair

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 3 replies on 1 page
andy

Posts: 6
Nickname: chant9
Registered: Mar, 2005

Problem Creating Executable JAR Posted: Apr 1, 2005 5:15 PM
Reply to this message Reply
Advertisement
Hi,
Im trying to create an executable jar but i always get a 'Java Virtual Machine Error' error saying "Could not find the main class. Program will exit."

Im creating a GUI in netbeans, which creates a jar automatically but it doesnt work, i also tried it with a JarWizard but i always get the same error.

Does anyone have any idea what this could mean.

Please help, thanks.


Matthias Neumair

Posts: 660
Nickname: neumi
Registered: Sep, 2003

Re: Problem Creating Executable JAR Posted: Apr 4, 2005 1:42 AM
Reply to this message Reply
A JAR File is nothing else than a ZIP archive.

Rename it and look into it.

Inside you should see all the packages and jar files as in the original project folder.

There is one more directory called META-INF
In this directory you can find the file MANIFEST.MF
Beneath other possible entries it must contain the following line:
Main-Class: MainClass
or
Main-Class: mainclasspackage.MainClass


If this information is in the file and the class file is in the correct subdirectory (package), then it will work.

Jeroen Wenting

Posts: 88
Nickname: jwenting
Registered: Mar, 2004

Re: Problem Creating Executable JAR Posted: Apr 6, 2005 5:32 AM
Reply to this message Reply
and remember to end that main-class line with a linebreak or it may still not work :)

Matthias Neumair

Posts: 660
Nickname: neumi
Registered: Sep, 2003

Re: Problem Creating Executable JAR Posted: Apr 6, 2005 6:56 AM
Reply to this message Reply
Correction to my previous post:

Inside you should see all the packages and class files as in the original project folder.

Flat View: This topic has 3 replies on 1 page
Topic: Sending mails with attachements. Previous Topic   Next Topic Topic: GUI problem

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use