There is a J2EE application that i have made on Netbeans 6.1 using glassfish application server. It runs perfectly fine from netbeans.But When i double click the jar file, it says " Cannot find main class" . I made the application again and tested the jar file at each step, so as to understand what part is giving the problem.Initially, it does execute, but when i insert some code related to jms (such as Session, MessageProducer,etc) it gives the error. I have posted the code, which when inserted, gives the error.
if (destType.equals("queue")) { dest = (Destination) queue; } else { dest = (Destination) topic; } Session session = connection.createSession(false,Session.AUTO_ACKNOWLEDGE); MessageProducer producer = session.createProducer(dest);
Ans :
If you've added any external libraries to the project it'll be them. For this files to be able to run in netbeans they'll need to be placed in the Java JDK folder.
ex. C:\Program Files (x86)\Java\jdk1.6.0_07\jre\lib\ext
It should be the latest version of the jdk that you have installed.
In this folder all the libraries netbeans use is placed.
The files that uses to be here is following:
dsns.jar
localedate.jar
sunjce_provider.jar
sunmscapi.jar
sunpkc11.jar
So if it's any other file that file/s you should add. Or if you know you added some files just include them in your project.
1 comment:
I am having exact the same error, but whatever I do in order to fix it is not working :'( I am a little bit annoyed already. Do you think it needs to be with the written of my main class? Maybe you guys know some other places to check?
Post a Comment