Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Java > Newbie - Java version and Eclipse

Reply
Thread Tools

Newbie - Java version and Eclipse

 
 
Dom
Guest
Posts: n/a
 
      12-25-2006
I'm very confused about the version of Java that I'm running. I need
to know because Eclipse tells me that I can't use the ForEach type of
For-Statement.

When I enter (in DOS) "java -version", I get: java version "1.4.2_03"
When I look at the Java Control Panel, I get: Version 1.5.0 (build
1.5.0_09-b03)
And my directories show c:\Program Files\Java\jre1.5.9_09

What is the proper way of finding the java version, how do I upgrade to
version 5, and how do I let Eclipse know I am there?

TIA,
Dom

 
Reply With Quote
 
 
 
 
Manish Pandit
Guest
Posts: n/a
 
      12-25-2006
Click on Window/Prererences/Java/Installed JREs. Then you can see the
JDK versions listed on the right side tab. Check the 1.5 version if not
checked already. Alternatively, you can add the 1.5 JDK using the 'add'
button.

Hope this helps!

-cheers,
Manish

 
Reply With Quote
 
 
 
 
Dom
Guest
Posts: n/a
 
      12-25-2006
I did everything as you suggested, but I get the same message from
Eclipse. Should it worry me that the "java -version" command is still
saying version 1.4.2_03?

Dom

Manish Pandit wrote:
> Click on Window/Prererences/Java/Installed JREs. Then you can see the
> JDK versions listed on the right side tab. Check the 1.5 version if not
> checked already. Alternatively, you can add the 1.5 JDK using the 'add'
> button.
>
> Hope this helps!
>
> -cheers,
> Manish


 
Reply With Quote
 
IchBin
Guest
Posts: n/a
 
      12-25-2006
Dom wrote:
> I did everything as you suggested, but I get the same message from
> Eclipse. Should it worry me that the "java -version" command is still
> saying version 1.4.2_03?
>
> Dom
>
> Manish Pandit wrote:
>> Click on Window/Prererences/Java/Installed JREs. Then you can see the
>> JDK versions listed on the right side tab. Check the 1.5 version if not
>> checked already. Alternatively, you can add the 1.5 JDK using the 'add'
>> button.
>>
>> Hope this helps!
>>
>> -cheers,
>> Manish

>

I would clean up you Java on your machine. I would do The Following:

- Uninstall older versions of java (JDK\JRE):
Go to Menu Start \ Control Panel \ Add Remove Programs..

Look and see what Java version that are installed. It looks like you
have more than one version installed.

- Uninstall the older Java installs(JDK\JRE). Personally I would get rid
of all the installed Java versions you have and install the latest Java
JDK 1.6.0 version.

- Now Set your Dos environment vars for Java. This why you are getting
the 1.4.2_03 when you run the Java command. The JAVA_HOME is set to
1.4.2_03. So:

Go to Menu Start \ Control Panel \ System \ Advanced \ Environment vars
button. Now set you Java_Home to the Java you want to use...

Now the DOS will point to the JDK you want. You can now do what Manish
suggested from Eclipse.

--
Thanks in Advance... http://ichbin.9999mb.com
IchBin, Pocono Lake, Pa, USA http://weconsultants.phpnet.us
__________________________________________________ ____________________
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
 
Reply With Quote
 
Alex Hunsley
Guest
Posts: n/a
 
      12-25-2006
Dom wrote:
> I'm very confused about the version of Java that I'm running. I need
> to know because Eclipse tells me that I can't use the ForEach type of
> For-Statement.
>
> When I enter (in DOS) "java -version", I get: java version "1.4.2_03"
> When I look at the Java Control Panel, I get: Version 1.5.0 (build
> 1.5.0_09-b03)
> And my directories show c:\Program Files\Java\jre1.5.9_09
>
> What is the proper way of finding the java version, how do I upgrade to
> version 5, and how do I let Eclipse know I am there?


The others wrote back with some good information.
Just like to add: as well as ensuring that you have the 5.0/1.5.0 JRE
added to Eclipse (Eclipse>Preferences>Java>Installed JREs), you need to
ensure your Eclipse preferences are set to have the compiler level at
5.0. (Do this in Eclipse>Preferences>Java>Compiler level to 5.0. This
setting can also be overridden on a per-project level, so check your
project preferences too.)

The compiler level is important because it can tell a 5.0 JRE/JDK to act
like it's JDK1.4 and so on, in which case you can't use 5.0 features!
lex
 
Reply With Quote
 
Dom
Guest
Posts: n/a
 
      12-25-2006
Thanks, Alex. Setting the compiler level did the trick.

For some reason, my "c:\Program FIles\Java" folder contains multiple
subfolders, with different version numbers. Also, my Oracle folder,
which existed before I downloaded java, also has a java subfolder. And
my environment variables do not include a JAVA_HOME.

Does any of this make sense?

Dom



Alex Hunsley wrote:
> Dom wrote:
> > I'm very confused about the version of Java that I'm running. I need
> > to know because Eclipse tells me that I can't use the ForEach type of
> > For-Statement.
> >
> > When I enter (in DOS) "java -version", I get: java version "1.4.2_03"
> > When I look at the Java Control Panel, I get: Version 1.5.0 (build
> > 1.5.0_09-b03)
> > And my directories show c:\Program Files\Java\jre1.5.9_09
> >
> > What is the proper way of finding the java version, how do I upgrade to
> > version 5, and how do I let Eclipse know I am there?

>
> The others wrote back with some good information.
> Just like to add: as well as ensuring that you have the 5.0/1.5.0 JRE
> added to Eclipse (Eclipse>Preferences>Java>Installed JREs), you need to
> ensure your Eclipse preferences are set to have the compiler level at
> 5.0. (Do this in Eclipse>Preferences>Java>Compiler level to 5.0. This
> setting can also be overridden on a per-project level, so check your
> project preferences too.)
>
> The compiler level is important because it can tell a 5.0 JRE/JDK to act
> like it's JDK1.4 and so on, in which case you can't use 5.0 features!
> lex


 
Reply With Quote
 
IchBin
Guest
Posts: n/a
 
      12-25-2006
Dom wrote:
> Thanks, Alex. Setting the compiler level did the trick.
>
> For some reason, my "c:\Program FIles\Java" folder contains multiple
> subfolders, with different version numbers. Also, my Oracle folder,
> which existed before I downloaded java, also has a java subfolder. And
> my environment variables do not include a JAVA_HOME.
>
> Does any of this make sense?
>
> Dom
>
>
>
> Alex Hunsley wrote:
>> Dom wrote:
>>> I'm very confused about the version of Java that I'm running. I need
>>> to know because Eclipse tells me that I can't use the ForEach type of
>>> For-Statement.
>>>
>>> When I enter (in DOS) "java -version", I get: java version "1.4.2_03"
>>> When I look at the Java Control Panel, I get: Version 1.5.0 (build
>>> 1.5.0_09-b03)
>>> And my directories show c:\Program Files\Java\jre1.5.9_09
>>>
>>> What is the proper way of finding the java version, how do I upgrade to
>>> version 5, and how do I let Eclipse know I am there?

>> The others wrote back with some good information.
>> Just like to add: as well as ensuring that you have the 5.0/1.5.0 JRE
>> added to Eclipse (Eclipse>Preferences>Java>Installed JREs), you need to
>> ensure your Eclipse preferences are set to have the compiler level at
>> 5.0. (Do this in Eclipse>Preferences>Java>Compiler level to 5.0. This
>> setting can also be overridden on a per-project level, so check your
>> project preferences too.)
>>
>> The compiler level is important because it can tell a 5.0 JRE/JDK to act
>> like it's JDK1.4 and so on, in which case you can't use 5.0 features!
>> lex

>

Open a dos window and do a 'set' cmd. Look at the output and find out
where the older java is set. Maybe in your path.

Uninstall the other versions you do not need as I have mentioned before.
--
Thanks in Advance... http://ichbin.9999mb.com
IchBin, Pocono Lake, Pa, USA http://weconsultants.phpnet.us
__________________________________________________ ____________________
'If there is one, Knowledge is the "Fountain of Youth"'
-William E. Taylor, Regular Guy (1952-)
 
Reply With Quote
 
Alex Hunsley
Guest
Posts: n/a
 
      12-26-2006
Dom wrote:
> Thanks, Alex. Setting the compiler level did the trick.
>
> For some reason, my "c:\Program FIles\Java" folder contains multiple
> subfolders, with different version numbers. Also, my Oracle folder,
> which existed before I downloaded java, also has a java subfolder. And
> my environment variables do not include a JAVA_HOME.
>
> Does any of this make sense?


Hi Dom
Yup, as IchBin said, you just have multiple versions of Java installed
(or leftovers from previous installs, in the least), and should make
sure any older versions are uninstalled (e.g. in Control
panel->add/remove programs, for starters). You can probably quite safely
ignore the Oracle Java folder.

Btw, can you not top post please? Bottoms posting makes threads much
easier to follow....
thanks,
Alex
 
Reply With Quote
 
ck
Guest
Posts: n/a
 
      12-26-2006
> The others wrote back with some good information.
> Just like to add: as well as ensuring that you have the 5.0/1.5.0 JRE
> added to Eclipse (Eclipse>Preferences>Java>Installed JREs), you need to
> ensure your Eclipse preferences are set to have the compiler level at
> 5.0. (Do this in Eclipse>Preferences>Java>Compiler level to 5.0. This
> setting can also be overridden on a per-project level, so check your
> project preferences too.)
>
> The compiler level is important because it can tell a 5.0 JRE/JDK to act
> like it's JDK1.4 and so on, in which case you can't use 5.0 features!


I guess what Alex has mentioned should solve the issue. It does not
matter to Eclipse how many versions of JRE is installed on your system.
In fact you have different JRE configured for your Eclipse. That gives
you the advantage of testing your application (module/project/whatever)
for different versions of JRE.
So if you are sticking to Eclipse it should not matter what version of
JRE is installed or what command prompt shows by java -version command.
All you need to set is Compliance for your code in preferences, or you
can set individually/specifically for any particular project

Cheers,
Ck
http://www.gfour.net

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: Where to get stand alone Dot Net Framework version 1.1, version2.0, version 3.0, version 3.5, version 2.0 SP1, version 3.0 SP1 ? MowGreen [MVP] ASP .Net 5 02-09-2008 01:55 AM
Re: Where to get stand alone Dot Net Framework version 1.1, version 2.0, version 3.0, version 3.5, version 2.0 SP1, version 3.0 SP1 ? PA Bear [MS MVP] ASP .Net 0 02-05-2008 03:28 AM
Re: Where to get stand alone Dot Net Framework version 1.1, version 2.0, version 3.0, version 3.5, version 2.0 SP1, version 3.0 SP1 ? V Green ASP .Net 0 02-05-2008 02:45 AM
Eclipse Plugin: how to modify perl build path from an eclipse Plugin java class eser@libero.it Java 1 09-07-2007 09:45 PM
newbie needs help with eclipse and eBay Java SDK David Shere Java 1 10-10-2006 08:40 PM



Advertisments