Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Java Virtual Machine troubleshooting

 
Fernando Mendez
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Excuse my english
I have the following problem:

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 ]
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You could improve your chance of getting help by easing up, keeping it down and using a meaningful subject line. You can edit your post by using the edit icon at the upper right of your post.

Good speed!
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24211
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Layne
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic