Java Forums

Main Menu
Home
Today's Posts
FAQ
Search
Contact Us

Java Network
Linux Archive
Java Tips
Java Tips Blog

Sponsored Links





Welcome to the Java Forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community, you will:

  • have access to post topics
  • communicate privately with other members (PM)
  • not see advertisements between posts
  • have the possibility to earn one of our surprises if you are an active member
  • access many other special features that will be introduced later.

Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Reply
 
LinkBack Thread Tools Display Modes
  #1 (permalink)  
Old 07-25-2008, 05:43 PM
Member
 
Join Date: Jul 2008
Posts: 1
Syranno is on a distinguished road
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 05:47 PM.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
  #2 (permalink)  
Old 07-25-2008, 06:07 PM
Norm's Avatar
Senior Member
 
Join Date: Jun 2008
Location: Heredia, Costa Rica
Posts: 2,223
Norm is on a distinguished road
Is the version of the javaw command 1.6? version 1.5 will not be able to execute code generated by a 1.6 javac.

You say that the program works if you use the javaw command, put the jar files on the classpath and reference the starting class.
That would mean that the jar file contains all the class files it needs and the classpath points to what else it needs

The problem must be in the manifest.
What error message do you get if you open a console window and enter: java -jar <jarname>.jar?

I don't know about JWindow or eclipse, so if the problem is with either of them I can't help.
Bookmark Post in Technorati
Reply With Quote
Sponsored Links
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


Similar Threads
Thread Thread Starter Forum Replies Last Post
Could not find the main class, program will exit. aryubi New To Java 13 09-30-2008 01:11 AM
JVM Could not find main class banduskank Advanced Java 2 06-24-2008 10:05 AM
Able to find class file in WEB-INF/classes but not after add sub folders in class dir vitalstrike82 Web Frameworks 0 05-13-2008 08:16 AM
problems to find the main method christina Eclipse 2 08-06-2007 09:51 PM
Error: Could Not Find Main Class. Program Will Exit silvia New To Java 1 07-19-2007 06:58 PM


All times are GMT +3. The time now is 12:24 AM.


VBulletin, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Content Relevant URLs by vBSEO ©2007, Crawlability, Inc.
Copyright ©2006 - 2007, www.java-forums.org