Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Weird problems

Status
Not open for further replies.

akibu

Programmer
Oct 1, 2001
4
GB
I haven't been programming java for that long, but I am facing some very strange problems.
I am following suns Java tut and several of the sources that they give to you as examples ( or even as solutions to problems) don't compile. Now I doubt that Sun would be so careless as to make a mistake in their source, so I assume it must be a fault somewhere on my part. I am running suns jdk 1.3.1 on redhat 7.1. Up untill today I have had no problems; but with two examples the compiler fails to recognise a final instatance variable as accessable by an inner class.
If anybody has any suggestions I would really appreciate it.
Thanks.
 
I "second" pipk's comment Spinik
Senior consultant
 
The actual code is unimportant as there is nothing wrong with it - it compiles fine on my windows box. The issue is really about jdk1.3.1 on a redhat7.1 setup. But you can have it anyway:
//1.3

import java.util.*;

public class ProblemSolved {
public static void main(String[] args) {
final Timer timer = new Timer();
timer.schedule(new TimerTask() {
public void run() {
System.out.println("Exiting.");
timer.cancel();
}
},
5000);

System.out.println("In 5 seconds this application will exit. ");
}
}


I have also noted that some swing classes can not be found by javac namely JFrame.
Thanks for your time.
 
Sounds like a CLASSPATH issue. Check to make sure the rt.jar is on your CLASSPATH.
 
Thanks for the input, but rt.jar is allready in my CLASSPATH
 
Hi

1) Are you sure you have 1.3.1 (as opposed to 1.1.3?)

2) could you show us exactly what you CLASPATH is set to?

and

3) Could you show us a copy of the exact message(s) that you get when it fails to compile?

Chris
 
Thank you all so much for your help - What it turned out to be was the Kaffe virtual machine that was in my path before the JDK. It was when I did java -version to check it was 1.3.1 that I realised.
Oh well, silly me.
Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top