Groups | Search | Server Info | Keyboard shortcuts | Login | Register


Groups > comp.lang.java.programmer > #4768

Re: Beginner Problem - Manifest file

Path csiph.com!x330-a1.tempe.blueboxinc.net!newsfeed.hal-mli.net!feeder1.hal-mli.net!border3.nntp.dca.giganews.com!border1.nntp.dca.giganews.com!nntp.giganews.com!npeer03.iad.highwinds-media.com!news.highwinds-media.com!feed-me.highwinds-media.com!post01.iad.highwinds-media.com!newsfe17.iad.POSTED!6b61fb94!not-for-mail
From Knute Johnson <nospam@knutejohnson.com>
User-Agent Mozilla/5.0 (X11; U; Linux i686; en-US; rv:1.9.2.17) Gecko/20110424 Thunderbird/3.1.10
MIME-Version 1.0
Newsgroups comp.lang.java.programmer
Subject Re: Beginner Problem - Manifest file
References <is103c$dnd$1@theodyn.ncf.ca>
In-Reply-To <is103c$dnd$1@theodyn.ncf.ca>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
Lines 57
Message-ID <uSTEp.24628$oq.5904@newsfe17.iad> (permalink)
X-Complaints-To abuse@newsdemon.com
NNTP-Posting-Date Mon, 30 May 2011 21:20:26 UTC
Organization NewsDemon
Date Mon, 30 May 2011 14:20:50 -0700
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:4768

Show key headers only | View raw


On 05/30/2011 01:53 PM, William Colls wrote:
>
> Environment:
> Ubuntu 10.04.2 64 bit
> Java 1.6.0_24
> NetbeansIDE 6.8
>
> I have built a small application containing two classes. When I build
> the application in the IDE, it builds without error, and creates a .jar
> file.
>
> When I try to run the .jar using the command
>
> java -jar myapp.jar
>
> I get the error
>
> Failed to load Main-Class manifest attribute from myapp.jar
>
> One of the class files does contain the main declaration
>
> public static void main(String args)
>
>  From my reading, I understand that there should be a file with the name
> manifest.txt in the build directory that gets incorporated into the .jar
> file, but I don't know what the contents of the file should be. My
> original understanding of how the IDE worked led me to believe that it
> would create the manifest file automatically, but this doesn't seem to
> be happening.
>
> Any guidance would be greatly appreciated.
>
> Thanks for your time.
>

It can be any name, doesn't matter.  The line you want is;

Main-Class: mypackage.MyClass

 From the docs on jar;

# attribute defined for stand-alone applications
# This attribute is used by stand-alone applications that are bundled 
into executable jar files which can be invoked by the java runtime 
directly by running "java -jar x.jar".

     * Main-Class :
     *

       The value of this attribute defines the relative path of the main 
application class which the launcher will load at startup time. The 
value must not have the .class extension appended to the class name.

-- 

Knute Johnson
s/knute/nospam/

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Beginner Problem - Manifest file William Colls <william.colls@rogers.com> - 2011-05-30 16:53 -0400
  Re: Beginner Problem - Manifest file Knute Johnson <nospam@knutejohnson.com> - 2011-05-30 14:20 -0700
  Re: Beginner Problem - Manifest file markspace <-@.> - 2011-05-30 15:30 -0700
    Re: Beginner Problem - Manifest file William Colls <william.colls@rogers.com> - 2011-05-30 21:03 -0400
  Re: Beginner Problem - Manifest file "John B. Matthews" <nospam@nospam.invalid> - 2011-05-30 19:32 -0400
  Re: Beginner Problem - Manifest file Nigel Wade <nmw-news@ion.le.ac.uk> - 2011-05-31 09:24 +0100

csiph-web