File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Compile Errror-cannot access RuntimeException

 
Asanka Vithanage
Ranch Hand
Posts: 59
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
Henry Wong
author
Marshal
Pie
Posts: 20835
75
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic