This week's book giveaway is in the JavaScript forum.
We're giving away four copies of Svelte and Sapper in Action and have Mark Volkmann on-line!
See this thread for details.
Win a copy of Svelte and Sapper in Action this week in the JavaScript forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

Compile Errror-cannot access RuntimeException

 
Ranch Hand
Posts: 59
  • 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
 
author
Posts: 23883
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • 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
 
That which doesn't kill us makes us stronger. I think a piece of pie wouldn't kill me. Tiny ad:
Thread Boost feature
https://coderanch.com/t/674455/Thread-Boost-feature
    Bookmark Topic Watch Topic
  • New Topic