GeeCON Prague 2014*
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Problems creating a jar Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Bookmark "Problems creating a jar" Watch "Problems creating a jar" New topic
Author

Problems creating a jar

Kevin Florish
Ranch Hand

Joined: Jan 06, 2009
Posts: 175
Hi

Am running Windows XP SP3

Have tried to create an executable jar file to run my database file against. The code works fine in Eclipse 3.4.1.

Manifest.mf contents
=============
Manifest-Version: 1.0
Main-Class: suncertify.client.ContractorApplicationStartup

Jar Creation
========
jar -cfvm code.jar Manifest.mf -C bin .

This seems to work fine and creates the jar file and shows all the classes and manifest in the output.

Jar Execution
=========

javaw -jar code.jar alone

This just gives me a beep and does nothing.

Is there anyway I can debug the jar to see the problem or can anyone spot a glaring error that I cannot see.

Thanks Kevin.



Java5 Tutorials | Java6 Tutorials | HTML/CSS Tutorials | JavaScript and jQuery Tutorials
Alecsandru Cocarla
Ranch Hand

Joined: Feb 29, 2008
Posts: 158
instead of

javaw -jar code.jar alone

you should use

java -jar...

SCJP 1.4 100%
SCJD 99.5%
Kevin Florish
Ranch Hand

Joined: Jan 06, 2009
Posts: 175
Thanks Alec

I was using the example from Monkhouse book, should have checked the errata

Now I get a "Failed to Main-Class manifest attribute from code.jar" error when running

java -jar code.jar alone

Manifest File is called Manifest.mf and contains:



This along with my bin directory were in my SCJD base directory and I created the jar from the SCJD directory as follows:



All the files were displayed ok including the following 2 entries:




Ah I needed to add a blank line to the end of the manifest file :O

Thanks Kevin.



 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Problems creating a jar