Win a copy of Testing JavaScript Applications this week in the HTML Pages with CSS and JavaScript forum!
    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
  • Bear Bibeault
  • Ron McLeod
  • Jeanne Boyarsky
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Liutauras Vilda
  • Junilu Lacar
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • fred rosenberger
  • salvin francis
Bartenders:
  • Piet Souris
  • Frits Walraven
  • Carey Brown

can any body help me

 
Ranch Hand
Posts: 59
  • Mark post as helpful
  • send pies
  • 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
Following also gives same kind of error
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
 
Ranch Hand
Posts: 109
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi Asanka,

What I feel is that for compiling, the version is taken as 1.5 but for referring the RuntimeException class, it is going for the class that is in 1.6 version. Better keep only one version and try out instead of installing two versions.

A similar instance can be found here http://forum.java.sun.com/thread.jspa?threadID=5144147&messageID=9987512 (even though the issue is related to web application).

Regards,
Kiran.
 
Bartender
Posts: 2856
10
Firefox Browser Fedora Java
  • Mark post as helpful
  • send pies
  • Report post to moderator
Hi asanka vithanage welcome to Javaranch.
the common reason for both the problems aboe is the classpath. Read this for the solution.
Also take a look at UseAMeaningfulSubjectLine, CarefullyChooseOneForum and UseCodeTags . So that you get more useful responses.

Hope this helps
[ October 24, 2008: Message edited by: Amit Ghorpade ]
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
  • Report post to moderator
Please do not post the same question in multiple JavaRanch forums.

I'm closing this one, since the question does not have anything to do with servlets.
[ October 24, 2008: Message edited by: Jesper Young ]
 
    Bookmark Topic Watch Topic
  • New Topic