• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Jar/classpath/Entry point problem.

 
Roy Pozarelli
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Roberto Perillo
Bartender
Posts: 2271
3
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Howdy, Roy!

Hum... if you are already using Eclipse, how about using it to generate the runme.jar file?
 
Roy Pozarelli
Ranch Hand
Posts: 51
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Good point, did it, works. Aside, can you tell if I was doing something wrong with the approach I listed?
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
or maybe use the ant build file I created (see ScjdFaq) with the "create-executable-jar" target. It will only build the runme.jar
 
Roel De Nijs
Sheriff
Posts: 10662
144
AngularJS Chrome Eclipse IDE Hibernate Java jQuery MySQL Database Spring Tomcat Server
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 2271
3
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic