• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Paul Clapham
  • Rob Spoor
  • Junilu Lacar
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Piet Souris
  • Carey Brown
Bartenders:

Java Virtual Machine troubleshooting

 
Greenhorn
Posts: 10
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 ]
 
author
Posts: 14112
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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!
 
author and iconoclast
Posts: 24204
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic