View Single Post
  #1 (permalink)  
Old 07-25-2008, 04:43 PM
Syranno Syranno is offline
Member
 
Join Date: Jul 2008
Posts: 1
Rep Power: 0
Syranno is on a distinguished road
Default Could not find main class - JDK 1.6
Hello community,

First, sorry for my bad english

i wrote a programm for work. If i compile this programm with JDK 1.5 the jar file works. But in this case a JWindow which i use in my programm does'nt shown. If i compile my programm with JDK 1.6 and launch the programm via eclipse the JWindow works. But if i compile it to a jar file, the error occures:

Quote:
Could not find main class. Programm will exit.
It is impossible that the manifest file is wrong, because i trayed to create the jar with JDK 1.5 and it works, but the JWindow i used doesn'nt work.

Have anybody an idea what i can do, to come to a solution?

Here my Manifest.mf:

Code:
Manifest-Version: 1.0
Main-Class: main.Main
Class-Path: . Lib/dgl.jar Lib/swingl.jar Lib/ojdbc.jar Lib/swingx.jar Lib/log4j.jar Lib/poi.jar
and here is my ant script to bild the jar:

Code:
<project name="CAT-DB" default="dist">
  <property name="MyApp" value="CAT-DB" />
  <path id="compile.classpath">
    <fileset dir="lib" />
    <pathelement path="bin" />
  </path>
  <target name="compile">
    <javac srcdir="src" destdir="bin">
      <classpath refid="compile.classpath" />
    </javac>
  </target>
  <!-- Create binary distribution -->
  <target name="dist" depends="compile">
    <delete file="${MyApp}.jar"/>
    <delete file="dist/${MyApp}.zip"/>
    <mkdir dir="dist" />
    <jar jarfile="${MyApp}.jar"
         basedir="bin"
         manifest="manifest.mf" />
    <zip destfile="dist/${MyApp}.zip">
      <fileset dir="." includes="lib/*" />
      <fileset dir="." includes="${MyApp}.jar" />
    </zip>
  </target>
</project>
I have tryed to create the jar with eclipse, but the same error occurce.

If i try to start the programm via command it works and the JWindow works too.

Quote:
javaw.exe -Dfile.encoding=Cp1252 -classpath "W:\S_Ausbildung\02_Fachinformatiker\FI2006\Webers \Java Workspace\CAT-DB\bin;W:\S_Ausbildung\02_Fachinformatiker\FI2006\ Webers\Java Workspace\CAT-DB\Lib\swingx.jar;W:\S_Ausbildung\02_Fachinformati ker\FI2006\Webers\Java Workspace\CAT-DB\Lib\dgl.jar;W:\S_Ausbildung\02_Fachinformatiker \FI2006\Webers\Java Workspace\CAT-DB\Lib\log4j.jar;W:\S_Ausbildung\02_Fachinformatik er\FI2006\Webers\Java Workspace\CAT-DB\Lib\ojdbc.jar;W:\S_Ausbildung\02_Fachinformatik er\FI2006\Webers\Java Workspace\CAT-DB\Lib\poi.jar;W:\S_Ausbildung\02_Fachinformatiker \FI2006\Webers\Java Workspace\CAT-DB\Lib\swingl.jar" main.Main
Thanks for your time and your help.

Regards Syranno

Last edited by Syranno; 07-25-2008 at 04:47 PM.
Reply With Quote