I have a proyect created, when a try to open the .jar file (created for the accion of build of my IDE (Using NetBean)), I get this message from JAVA VIRTUAL MACHINE LUNCHER : "could not find the main class, program will exit", but the proyect it does have the main class of the proyect set, the thing that confuse me , is that Apparently the error is cause by a line of code that is in a Action performed event of a button, the line belong to the jasper report, and is the one that is use for loading the xml design file: "JasperDisign jasperdisigh = JRXmlLoader.load("C:/Reporte1.jrxml");", but how can this generate error if the events has not been fire, the only thing that come to my mind is, that there is some file o library that I have to put in some place,
When I take out the line that load the xml everything run just fine.
Note: this not happen in the IDE , in here I have no error , no exception , the form that is as main has not deprecated Api, and every run just fine.
I don�t know what to do, I going crazy , I have like 2 weeks with this error.
[ March 03, 2005: Message edited by: fernando mendez ]
The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
When you launch an executable JAR, the classpath is "closed", and only classes inside the JAR will be loaded (along with any standard extensions and platform libraries from the JRE, of course.) In the IDE, the classes JasperDisign and JRXmlLoader are available, but when you create a JAR file, perhaps they're not. This will cause the class containing this line to fail to load, hence the "could not find main class" error.
So I think what you need to do is make sure that all the classes needed for your application are available in the JAR file. Remember that CLASSPATH isn't used when running an executable JAR.
You state that this error doesn't happen when you run your program in the IDE. So how DO you run it? Is it from the command line or some other method? If you are using the command line, please post the exact command you use along with the exact output you get. This will help use more clearly understand what your problem is, and hopefully we can come up with more specific solutions for you to try.