aspose file tools*
The moose likes Beginning Java and the fly likes Compile Errror-cannot access RuntimeException Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Compile Errror-cannot access RuntimeException" Watch "Compile Errror-cannot access RuntimeException" New topic
Author

Compile Errror-cannot access RuntimeException

Asanka Vithanage
Ranch Hand

Joined: Oct 24, 2008
Posts: 59
when i try to compile following code using command prompt.it gives following error.

class A {
public static void main(String s[]){

try{
throw new RuntimeException();

}

catch(Exception r){
System.out.println("asanka ");
}


}
}


C:\Documents and Settings\user\Desktop\java>javac A.java
A.java:7: cannot access RuntimeException
bad class file: .\RuntimeException.class
class file has wrong version 50.0, should be 49.0
Please remove or make sure it appears in the correct subdirectory of the classpa
th.
throw new RuntimeException();
^
1 error
what the hell this .???
i reinstalled java 3,4 times .and use the 1.5 and 1.6 also.but they also gives the sama problem.so i think this is os problems.so i unstalled the vista ultimate and installed windows xp.but the problem is same.so please help me

class A {
public static void main(String s[]){
Thread a=new Thread();
}


}
this code give the following error
C:\Documents and Settings\user\Desktop\java>javac A.java
A.java:5: cannot access Thread
bad class file: .\Thread.java
file does not contain class Thread
Please remove or make sure it appears in the correct subdirectory of the classpa
th.
Thread a=new Thread();
^
1 error


SCJP 1.5 (94%)
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18994
    
  40

A.java:7: cannot access RuntimeException
bad class file: .\RuntimeException.class
class file has wrong version 50.0, should be 49.0


Basically, you have jar files in your classpath from a version of java that is later than the java that you are running with. If you want to run with the older version of Java, you will need to use the older class files.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Compile Errror-cannot access RuntimeException