running a jar

hi

I am using JDK1.2.2 with RedHat Linux 6.2. I tried to run a jar after the jar file creation like this:

jar cmf helloclass hello.jar HelloWorld.class

helloclass is the manifest file which contains the following:

Main-Class: HelloWorld

And i tried to make run the jar file as:

java -jar hello.jar

It says:

Failed to load Main-Class manifest attribute from hello.jar.

I don't know where i am wrong. Please help.

[483 byte] By [bhuvana_76] at [2007-9-26 2:04:53]
# 1
Hi,rename the file 'manifest' to 'manifest.mf' and jar with this file. It should run.Hope it helps.cu,Olaf
koerting at 2007-6-29 8:49:17 > top of Java-index,Desktop,Deploying...
# 2
actually, I think all you are missing is the three letter extension to your manifest file. Try:jar cmf helloclass.txt hello.jar HelloWorld.class Jason R. Kretzer
JMagnus at 2007-6-29 8:49:17 > top of Java-index,Desktop,Deploying...
# 3
Also try adding a blank line to the end of your manifest file.
nerd2004 at 2007-6-29 8:49:17 > top of Java-index,Desktop,Deploying...
# 4

The manifest file can be names to whatever you choose. ("Almost....")

Just make sure that there is a "new-line" charachter at the end of each line.

To be more specific, hit return after each line in the manifest file, else your instructions will be included but not executed.

To make sure that your manifest file is correct. Either extract the files from the jar file, or rename it to .zip and use a zip program to read the file, like WinZip

MagDy at 2007-6-29 8:49:17 > top of Java-index,Desktop,Deploying...
# 5

Manifest-Version: 1.0

Main-Class: net/turingcomplete/phosphor/client/ClientUI

Created-By: 1.2 (turingcomplete.net)

Class-Path: jaxp.jar oro.jar phosphor_help.jar jh.jar media_resources.

jar crimson_mod.jar phosphor_shared.jar ping_icmp.jar desktop_indicat

or.jar m_date_entry.jar phosphor_loadserver.jar phosphor_server.jar

That's a manifest that works.. you can use it as an example. The lines cannot be longer then 72 characters or somthing..

turingcomplete at 2007-6-29 8:49:17 > top of Java-index,Desktop,Deploying...