Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » run jar file(run jar file with manifest)
run jar file [message #1060036] Wed, 22 May 2013 15:21
Steve Howerton is currently offline Steve HowertonFriend
Messages: 5
Registered: April 2013
Junior Member
I am learning to build.xml a project with eclipse ide.
below is the MANIFEST.MF that I am creating.
The build shows that the manifest is being written in the dir structure below.
The dir META-INF (sibling to the src) contains this MANIFEST.MF





Manifest-Version: 1.0
Ant-Version: Apache Ant 1.8.1
Created-By: Apache Ant version 1.8.1 compiled on April 30 2010
Built-By: Steves
Main-Class: build.classes.model.Main 
Implementation-Version: 1.0-b0
Built-Date: <tstamp />
Class-Path: build\lib\jcalendar.jar


05/06/2013  06:38 AM    <DIR>          .
05/06/2013  06:38 AM    <DIR>          ..
04/07/2013  07:18 AM               864 .classpath
04/02/2013  06:35 AM               688 .project
05/06/2013  06:38 AM    <DIR>          bin
05/06/2013  06:38 AM    <DIR>          build
05/05/2013  11:03 AM            15,307 build.properties
05/06/2013  06:32 AM             5,405 build.xml
04/10/2013  10:23 AM             2,612 build_output.xml
05/05/2013  11:08 AM             9,052 build_test.xml
05/06/2013  06:32 AM           328,533 dist.zip.jar
05/06/2013  06:38 AM    <DIR>          img
05/14/2011  12:20 AM            68,310 jcalendar.jar
03/31/2013  07:00 PM           220,183 junit.jar
04/08/2013  05:53 PM               242 MANIFEST.MF
05/06/2013  06:38 AM    <DIR>          META-INF
04/11/2013  03:26 AM             1,421 README.txt
05/06/2013  06:38 AM    <DIR>          src
04/05/2013  06:21 PM            44,599 sys.txt
04/05/2013  06:24 PM               366 temp.txt
              13 File(s)        697,582 bytes
               7 Dir(s)  710,885,691,392 bytes free



the following MANIFEST.MF is in the jar file too.
it is in the bin dir of the jar file.



Manifest-Version: 1.0
Main-Class: com.toedter.calendar.JCalendarDemo
Created-By: Ant 1.4.1

Name: com/toedter/components/JSpinField.class
Java-Bean: True

Name: com/toedter/calendar/JDayChooser.class
Java-Bean: True

Name: com/toedter/calendar/JCalendar.class
Java-Bean: True

Name: com/toedter/calendar/JMonthChooser.class
Java-Bean: True

Name: com/toedter/calendar/JYearChooser.class
Java-Bean: True

Name: com/toedter/components/JLocaleChooser.class
Java-Bean: True



I am attempting to run the dist.jar.
below is the error. Why does my project never find the Main of my app?
Thanks.


C:\Program Files\Java\jdk1.7.0_15\bin>java -jar %TARGET%\dist\dist.jar
Exception in thread "main" java.lang.NoClassDefFoundError: build/classes/mo
del/Main (wrong name: model/Main)
        at java.lang.ClassLoader.defineClass1(Native Method)
        at java.lang.ClassLoader.defineClass(ClassLoader.java:791)
        at java.security.SecureClassLoader.defineClass(SecureClassLoader.ja
va:142)
        at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
        at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
        at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
        at java.security.AccessController.doPrivileged(Native Method)
        at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:423)
        at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
        at java.lang.ClassLoader.loadClass(ClassLoader.java:356)
        at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java
:482)

C:\Program Files\Java\jdk1.7.0_15\bin>



a look inside my dist.jar note that the dir "build.classes.model.Main" is the Main I would like to have found.


C:\Program Files\Java\jdk1.7.0_15\bin>jar -tvf %TARGET%\dist\dist.jar
     0 Sun May 05 11:08:58 CDT 2013 META-INF/
   270 Sun May 05 11:08:56 CDT 2013 META-INF/MANIFEST.MF
   864 Sun Apr 07 07:18:10 CDT 2013 .classpath
   688 Tue Apr 02 06:35:20 CDT 2013 .project
   242 Mon Apr 08 17:53:58 CDT 2013 MANIFEST.MF
  1421 Thu Apr 11 03:26:52 CDT 2013 README.txt
     0 Sun May 05 10:02:50 CDT 2013 bin/
     0 Sun May 05 10:02:50 CDT 2013 bin/META-INF/
   493 Wed Jul 17 15:44:52 CDT 2002 bin/META-INF/MANIFEST.MF
     0 Sun May 05 10:02:50 CDT 2013 bin/model/
   940 Sun May 05 10:02:50 CDT 2013 bin/model/Main.class
     0 Sun May 05 10:02:50 CDT 2013 bin/model/math/
   385 Sun May 05 10:02:50 CDT 2013 bin/model/math/MyMath.class
     0 Sun May 05 10:02:50 CDT 2013 bin/view/
   498 Sun May 05 10:02:50 CDT 2013 bin/view/AboutControl.class
  2154 Sun May 05 10:02:50 CDT 2013 bin/view/AboutPopup.class
   513 Sun May 05 10:02:50 CDT 2013 bin/view/ExitControl.class
  1265 Sun May 05 10:02:50 CDT 2013 bin/view/UKLights.class
 15307 Sun May 05 11:03:16 CDT 2013 build.properties
  5398 Wed Apr 24 07:00:00 CDT 2013 build.xml
     0 Sun May 05 11:08:58 CDT 2013 build/
     0 Sun May 05 11:08:58 CDT 2013 build/META-INF/
   270 Sun May 05 11:08:58 CDT 2013 build/META-INF/MANIFEST.MF
     0 Sun May 05 11:08:58 CDT 2013 build/classes/
     0 Sun May 05 11:08:58 CDT 2013 build/classes/model/
   988 Sun May 05 11:08:58 CDT 2013 build/classes/model/Main.class
     0 Sun May 05 11:08:58 CDT 2013 build/classes/model/math/
   385 Sun May 05 11:08:58 CDT 2013 build/classes/model/math/MyMath.class
     0 Sun May 05 11:08:58 CDT 2013 build/classes/view/
   500 Sun May 05 11:08:58 CDT 2013 build/classes/view/AboutControl.class
  2071 Sun May 05 11:08:58 CDT 2013 build/classes/view/AboutPopup.class
   513 Sun May 05 11:08:58 CDT 2013 build/classes/view/ExitControl.class
  1265 Sun May 05 11:08:58 CDT 2013 build/classes/view/UKLights.class
     0 Sun May 05 11:08:58 CDT 2013 build/lib/
 68310 Sun May 05 11:08:58 CDT 2013 build/lib/jcalendar.jar
     0 Sun May 05 11:08:58 CDT 2013 build/main/
     0 Sun May 05 11:08:58 CDT 2013 build/main/model/
   988 Sun May 05 11:08:58 CDT 2013 build/main/model/Main.class
     0 Sun May 05 11:08:58 CDT 2013 build/main/model/math/
   385 Sun May 05 11:08:58 CDT 2013 build/main/model/math/MyMath.class
     0 Sun May 05 11:08:58 CDT 2013 build/main/view/
   500 Sun May 05 11:08:58 CDT 2013 build/main/view/AboutControl.class
  2071 Sun May 05 11:08:58 CDT 2013 build/main/view/AboutPopup.class
   513 Sun May 05 11:08:58 CDT 2013 build/main/view/ExitControl.class
  1265 Sun May 05 11:08:58 CDT 2013 build/main/view/UKLights.class
     0 Sun May 05 11:08:58 CDT 2013 build/test/
     0 Sun May 05 11:08:58 CDT 2013 build/test/model/
   988 Sun May 05 11:08:58 CDT 2013 build/test/model/Main.class
     0 Sun May 05 11:08:58 CDT 2013 build/test/model/math/
   385 Sun May 05 11:08:58 CDT 2013 build/test/model/math/MyMath.class
     0 Sun May 05 11:08:58 CDT 2013 build/test/view/
   500 Sun May 05 11:08:58 CDT 2013 build/test/view/AboutControl.class
  2071 Sun May 05 11:08:58 CDT 2013 build/test/view/AboutPopup.class
   513 Sun May 05 11:08:58 CDT 2013 build/test/view/ExitControl.class
  1265 Sun May 05 11:08:58 CDT 2013 build/test/view/UKLights.class
  2612 Wed Apr 10 10:23:20 CDT 2013 build_output.xml
  9052 Sun May 05 11:08:48 CDT 2013 build_test.xml
     0 Tue Apr 23 10:28:58 CDT 2013 img/
 62417 Thu Mar 25 22:35:10 CDT 2010 img/Paradise.jpg
 68310 Sat May 14 00:20:08 CDT 2011 jcalendar.jar
220183 Sun Mar 31 19:00:00 CDT 2013 junit.jar
     0 Tue Apr 23 10:29:16 CDT 2013 src/
     0 Mon Apr 08 05:43:36 CDT 2013 src/META-INF/
   493 Wed Jul 17 15:44:52 CDT 2002 src/META-INF/MANIFEST.MF
     0 Tue Apr 09 05:41:18 CDT 2013 src/model/
   518 Tue Apr 23 09:45:42 CDT 2013 src/model/Main.java
     0 Tue Apr 02 06:03:54 CDT 2013 src/model/math/
   138 Mon Apr 01 12:44:20 CDT 2013 src/model/math/MyMath.java
     0 Wed Apr 24 06:46:56 CDT 2013 src/view/
   179 Wed Apr 24 06:47:12 CDT 2013 src/view/AboutControl.java
  1322 Wed Apr 24 06:50:54 CDT 2013 src/view/AboutPopup.java
   178 Wed Apr 24 06:45:18 CDT 2013 src/view/ExitControl.java
   841 Wed Apr 24 06:44:00 CDT 2013 src/view/UKLights.java
 44599 Fri Apr 05 18:21:22 CDT 2013 sys.txt
   366 Fri Apr 05 18:24:22 CDT 2013 temp.txt

C:\Program Files\Java\jdk1.7.0_15\bin>

Previous Topic:no class found
Next Topic:Why does ant not compile
Goto Forum:
  


Current Time: Sun Dec 21 20:51:57 GMT 2014

Powered by FUDForum. Page generated in 0.06279 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software