Problem with out variable

I have been working for months with java and all of a sudden today when i was compiling a program i got an error stating that the variable out can't be.

To confirm my suspicion that somrhtings wrong i wrote this program and tested it

class Example

{

publicstaticvoid main(String args[])

{

System.out.println("This is my first program");

}

}

And i get this error when i compile

Cannot find symbol

variable out

All this time the JRE was ok and now this unexpected problem.Whats happening?It works if I import java.lang.System and run the program.I have been working for months and this is the first time.Is it because of some virus or something.Should i reinstall the JDK.I thought of asking at the forum before i could try reinstalling and checking it out again.

[1105 byte] By [psychica] at [2007-11-26 17:46:23]
# 1
Hi,Looks like a problem with your installation of the JDK / JRE, or that something has changed the registry or environment variables. The easiest thing is probably to re-install the JDK / JRE.Kaj
kajbja at 2007-7-9 5:15:27 > top of Java-index,Java Essentials,New To Java...
# 2
.. Where do you get this error? Eclipse has a bug which is related to this. Sometimes I have to remove the JRE from installed JREs in Eclipse, and then just add it again, and then everything works.Kaj
kajbja at 2007-7-9 5:15:27 > top of Java-index,Java Essentials,New To Java...
# 3

> .. Where do you get this error? Eclipse has a bug

> which is related to this. Sometimes I have to remove

> the JRE from installed JREs in Eclipse, and then just

> add it again, and then everything works.

>

> Kaj

I don't use an IDE.I use the command prompt.I get the error at the command prompt.

My computer has two OS both XP.I jdk 1.5 installed on both these OS.I run the jdk on the first jdk which is on the active partition and when it stopped working on this one i immediately restarted the pc and started the other xp where i have installed jdk 1.5 too.But even there it's the same case.

But if any environment variables or registry contents have changed thats local to the first xp but how will it effect the second xp.Is it because of any virus

Please note i will be going out and will get back to the thread in around 2 hours.Thanks a lot of the response.

psychica at 2007-7-9 5:15:27 > top of Java-index,Java Essentials,New To Java...
# 4

> But if any environment variables or registry contents

> have changed thats local to the first xp but how will

> it effect the second xp.Is it because of any virus

It's probably not related to a virus. My guess is that you have installed some application and that caused a conflict.

kajbja at 2007-7-9 5:15:27 > top of Java-index,Java Essentials,New To Java...
# 5

> Hi,

>

> Looks like a problem with your installation of the

> JDK / JRE, or that something has changed the registry

> or environment variables.

It's almost 6 months since i installed the jdk and working with it.So it can't be the problem witha ny installation.

psychica at 2007-7-9 5:15:27 > top of Java-index,Java Essentials,New To Java...
# 6

> > But if any environment variables or registry

> contents

> > have changed thats local to the first xp but how

> will

> > it effect the second xp.Is it because of any virus

>

> It's probably not related to a virus. My guess is

> that you have installed some application and that

> caused a conflict.

Absolutely none.I haven't installed any on the first OS.I installed a ipod veideo converter on the second OS but thats in no way related to the first OS.The only thing i did was download a few ebooks around 3 hours ago and the problem started then.

psychica at 2007-7-9 5:15:27 > top of Java-index,Java Essentials,New To Java...
# 7

> Absolutely none.I haven't installed any on the first

> OS.I installed a ipod veideo converter on the second

> OS but thats in no way related to the first OS.The

> only thing i did was download a few ebooks around 3

> hours ago and the problem started then.

My guess is you have a class named System that perhaps you created or the ebooks created.The compiler is finding this class instead of java.lang.System.

atmguya at 2007-7-9 5:15:27 > top of Java-index,Java Essentials,New To Java...
# 8
Could you please post :all of your test class code (including imports), the exact command you use when compiling andthe version of the VM you use (java.exe -version)
FatCata at 2007-7-9 5:15:27 > top of Java-index,Java Essentials,New To Java...
# 9

> Could you please post :

> all of your test class code (including imports),

> the exact command you use when compiling and

> the version of the VM you use (java.exe -version)

It's the same code i posted at the top.Just a simple System.out.println( ) inside the main method.

Here it is again

class example

{

public static void main(String args[])

{

System.out.println("This is my first program");

}

}

I haven.t imported as java.lang package is imported by default.It was working all this time and now all of a sudden it's started behaving like this today.What beats me is that even the jdk 1.5 installed on the second xp in the other drive is also behaving the same way too.

psychica at 2007-7-9 5:15:27 > top of Java-index,Java Essentials,New To Java...
# 10

Did you read reply #7?

To test this theory out, do this instead (temporarily):

java.lang.System.out.println("This is my first program");

If that works, then the conclusion would be that you do have a homemade class named "System" in your classpath at compile-time.

warnerjaa at 2007-7-9 5:15:27 > top of Java-index,Java Essentials,New To Java...
# 11

> Did you read reply #7?

> To test this theory out, do this instead

> (temporarily):

> java.lang.System.out.println("This is my first

> program");

> If that works, then the conclusion would be that you

> do have a homemade class named "System" in

> your classpath at compile-time.

I did read reply 7.There wasn't a class named System which i created in my classpath.Now however i have reinstalled the jdk and it's working fine.

psychica at 2007-7-9 5:15:27 > top of Java-index,Java Essentials,New To Java...