| Author |
Jar/classpath/Entry point problem.
|
Roy Pozarelli
Ranch Hand
Joined: Oct 17, 2009
Posts: 39
|
|
I'm getting something that I don't really understand. I'm using the command line of:
jar cmfv MANIFEST.MF runme.jar -C classes *
to build the jar file, where MANIFEST.MF is
Manifest-Version: 1.0
Created-By: 1.4.0_01 (Sun Microsystems Inc.)
Class-Path: ./classes
Main-Class: suncertify.gui.launcher.ApplicationLauncher
Now I have a .classpath in the directory where I'm building the jar file from where (I've used eclipse to do the project in) the contents are:
<?xml version="1.0" encoding="UTF-8"?>
<classpath>
<classpathentry kind="src" path="code"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.6"/>
<classpathentry kind="src" path=".apt_generated">
<attributes>
<attribute name="optional" value="true"/>
</attributes>
</classpathentry>
<classpathentry kind="output" path="classes"/>
</classpath>
Since I wanted to build a "clean" runme.jar file I removed the .classpath, .apt_generated and other files from the directory structure so that they would not be in the runme.jar file. However I discovered that when the .classpath file is not in the directory where I make the jar file, when I invoke ">runme.jar alone" (or any other command-line option) it can't find the entry point. Now I thought that the mainfest file took care of that is why I'm confused. Also am I being redundant with the -C classes and the manifest entry? Any help would be appreciated.
BTW I'm not using ant.
|
OCP Java SE 6 Programmer,
OCM Java SE 6 Developer
OCE Web Components
OCE JPA 6
OCE EJB 6
MySQL Certified Administrator & Developer,
OMG Certified UML Prof. Fund., Int., Adv.
|
 |
Roberto Perillo
Bartender
Joined: Dec 28, 2007
Posts: 2212
|
|
Howdy, Roy!
Hum... if you are already using Eclipse, how about using it to generate the runme.jar file?
|
Cheers, Bob "John Lennon" Perillo
SCJP, SCWCD, SCJD, SCBCD - Daileon: A Tool for Enabling Domain Annotations
|
 |
Roy Pozarelli
Ranch Hand
Joined: Oct 17, 2009
Posts: 39
|
|
|
Good point, did it, works. Aside, can you tell if I was doing something wrong with the approach I listed?
|
 |
Roel De Nijs
Bartender
Joined: Jul 19, 2004
Posts: 4349
|
|
|
or maybe use the ant build file I created (see ScjdFaq) with the "create-executable-jar" target. It will only build the runme.jar
|
SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
|
 |
Roel De Nijs
Bartender
Joined: Jul 19, 2004
Posts: 4349
|
|
Roy Pozarelli wrote:Aside, can you tell if I was doing something wrong with the approach I listed?
Maybe you can try following this tutorial to create an executable jar file
|
 |
Roberto Perillo
Bartender
Joined: Dec 28, 2007
Posts: 2212
|
|
Howdy, Roy!
Champ, please verify the structure of the file generated by the command you provided above. If everything is correct, then I think that things will work too if you remove the Class-Path: ./classes statement.
|
 |
 |
|
|
subject: Jar/classpath/Entry point problem.
|
|
|