File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Java in General and the fly likes java run time error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "java run time error" Watch "java run time error" New topic
Author

java run time error

indiver kumar
Greenhorn

Joined: Apr 09, 2012
Posts: 5
please somebody help me....i am a java learner.....i am facing a problem.....


when i run my java program java test

it shows a error error:could not find or load main class :test

or when i use this command java -cp . test
it give the result....


what's the problem with this....

Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38016
    
  22
Welcome to the Ranch

Have you set a classpath in your computer? That is usually a mistake.
If you set the classpath yourself, record it somewhere and delete it completely.
If the classpath was set before you installed Java (which often means you have installed Quicktime), add the following to the start of the classpath:-
On windows:-On other OSs, eg Linux, Mac, Unix:-What is happening is that the Java runtime is looking in all sorts of folders for the file you want, and not in the . folder. If you get rid of the classpath, it sill use . as a default classpath.
Junilu Lacar
Bartender

Joined: Feb 26, 2001
Posts: 4445
    
    5

Check the file name and the capitalization in your code. Following standard conventions, you should have these files:
Test.java
Test.class

and your Test.java should have this line:

Then run with the command 'java Test' (with a capital T)


Junilu - [How to Ask Questions] [How to Answer Questions]
indiver kumar
Greenhorn

Joined: Apr 09, 2012
Posts: 5
thanks for all......my problem has been solved...
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38016
    
  22
And what was the problem?
indiver kumar
Greenhorn

Joined: Apr 09, 2012
Posts: 5
problem is just of setting enviornmental varriable in a correct manner.....thanks to you for this.....
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38016
    
  22
Thought so! You’re welcome
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: java run time error
 
Similar Threads
RAD and Portal Test Envoirmnemnt -Unable to Run a simple Portlet
Runtime.exec() problem issue Linux
Exception in thread "main" NoClassDefFoundError
java lang NoClassDefFoundError
Java Web Start