View Single Post
Eski 21/01/2007, 17:14   #6 (permalink)
myavuzselim
Eski Cevizci
 
myavuzselim Adlı Üyenin Profil Grafiği
 
Üyelik Tarihi: 05/2004
Mesaj: 817
Varsayılan

Bir baska yontem de senin jar'in manifest'ine Class-Path'i eklemekmis.

Aslinda mr1yh1'in dedigi mantikli, ama surada yazana gore sorun yine de kutuphane sorunu, yani verilen hata mesaji yanlis.
Alıntı:
http://forum.java.sun.com/thread.jspa?threadID=557868&messageID=3375944, mesajından alıntı:
I had the same problem (i.e. Message-Box with "Could not find the main class. Program will exit.")
After insuring that the manifest contained a Main-Class: argument and that the argument pointed to the right class, I started the jar via

java -jar myjar.jar

and read the stacktrace, which is much better than the popup-window.

In my case the error was, that the Main-Class could not be loaded due to another referenced class, which was not on the classpath. (i.e. it was not in the same jar-File and the manifest didn't include a Class-Path: argument.)
After adding the correct Class-Path: argument in the manifest, the problem went away.

I now have the following setup:
myjar.jar and somethirdparty.jar in the same directory.
myjar.jar contains a manifest which includes the lines

Class-Path: somethirdparty.jar
Main-Class: my.package.and.MainClass


after the normal Manifest-header.
myavuzselim şu an hatta   Alıntı Yaparak Yanıtla