aspose file tools*
The moose likes Beginning Java and the fly likes could not find the main class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "could not find the main class " Watch "could not find the main class " New topic
Author

could not find the main class

kumar kushagra
Greenhorn

Joined: Dec 01, 2011
Posts: 2
when i am running a .jar file it is showing that "could not find the main class : program will exit" . but the same .jar file is running in other system .can you tell what is the problem with my system.
Hebert Coelho
Ranch Hand

Joined: Jul 14, 2010
Posts: 754

Could you post the class and how are you calling it?


[uaiHebert.com] [Full WebApplication JSF EJB JPA JAAS with source code to download] One Table Per SubClass [Web/JSF]
kumar kushagra
Greenhorn

Joined: Dec 01, 2011
Posts: 2
Hebert Coelho wrote:Could you post the class and how are you calling it?

i have a java application which my friend has send me so i am just trying to run that program on my system so i don't know which class he has used.
Rob Spoor
Sheriff

Joined: Oct 27, 2005
Posts: 19557
    
  16

Ignore that message; the program that runs JAR files when you double click it, javaw, has terrible error handling and shows the same error message for any throwable that's being thrown by the main method. Open a command prompt, go to the folder where the JAR file is located, and use java instead: This will show the stack trace of the actual throwable. My guess is that it will be a NoClassDefFoundError, which would indicate you're missing a few JAR files on the class path.


SCJP 1.4 - SCJP 6 - SCWCD 5 - OCEEJBD 6
How To Ask Questions How To Answer Questions
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: could not find the main class
 
Similar Threads
Packaging self-running jar
Jar files
Java Virtual Machine troubleshooting
Trouble running Java program from command line
getting an error while executing jar file