Eclipse selects wrong JRE [message #200893] |
Wed, 21 March 2007 11:58  |
Eclipse User |
|
|
|
Originally posted by: fake.phony_email_address.com
I have three JREs installed into Eclipse. When I run a class, Eclipse
always selects 1.4.2, even though I have set the default JRE to 1.5 or
1.6 in Window/Preferences/Installed JREs.
All options under Execution Environments are unchecked. Checking them
does not change this behavior.
Under the Run... configuration for my executable class, the JRE table
has "Project JRE 1.4.2" selected. If I change to an alternative JRE,
then things work correctly. The trouble is that I never selected a
"Project JRE" anywhere. I want to use Eclipse defaults for all projects.
Why does Eclipse think that I selected a JRE for the project? I use
Workspace Defaults for everything. And where would I select one anyway?
I'm using Eclipse 3.2.2 Build id: M20070212-1330, updated today.
|
|
|
|
|
|
|
|
|
|
Re: Eclipse selects wrong JRE [message #201003 is a reply to message #200893] |
Wed, 21 March 2007 18:28   |
Eclipse User |
|
|
|
Originally posted by: wharley.bea.com
"Chris" <fake@phony_email_address.com> wrote in message
news:etrkmi$ik3$1@utils.eclipse.org...
>I have three JREs installed into Eclipse. When I run a class, Eclipse
>always selects 1.4.2, even though I have set the default JRE to 1.5 or 1.6
>in Window/Preferences/Installed JREs.
>
> All options under Execution Environments are unchecked. Checking them does
> not change this behavior.
>
> Under the Run... configuration for my executable class, the JRE table has
> "Project JRE 1.4.2" selected. If I change to an alternative JRE, then
> things work correctly. The trouble is that I never selected a "Project
> JRE" anywhere. I want to use Eclipse defaults for all projects.
>
> Why does Eclipse think that I selected a JRE for the project? I use
> Workspace Defaults for everything. And where would I select one anyway?
>
> I'm using Eclipse 3.2.2 Build id: M20070212-1330, updated today.
As a sanity check, I just took Eclipse 3.2.2, running under a 1.5.0_07 VM,
and created a new workspace and a new project in it. I added JREs for
1.4.2_08 and 1.6.0, leaving 1.5 as the default JRE. I set the compiler
compliance for the project to 1.4. I made no other modifications to
preferences or project properties. I then wrote a simple Main class:
package p;
public class Main {
public static void main(String[] args) {
String version = System.getProperty("java.version");
System.out.println(version);
}
}
and executed that class. It outputs "1.5.0_07" when the default JRE is 1.5.
Switching the default JRE to 1.4 or 1.6, and running again, without changing
anything else, the output tracks accordingly.
I wonder what is different for you?
|
|
|
|
Re: Eclipse selects wrong JRE [message #201019 is a reply to message #200987] |
Wed, 21 March 2007 20:22  |
Eclipse User |
|
|
|
Originally posted by: fake.phony_email_address.com
Paul Rubin wrote:
> Chris wrote:
>
>>
>> Windows/Preferences/Java/Installed JREs has 1.5 checked. It still runs
>> 1.4. Same result if 1.6 is checked.
>
> Does this happen with new projects, or just existing ones? (I'm
> wondering if the compiler was set to 1.4.2 when the project was started,
> and that setting has just lingered.) Also, does the behavior change if
> you start eclipse with the -clean switch?
>
> /Paul
>
Thank you. Testing with a new project led me to the solution.
There was something strange in my old project under
Project/Properties/Java Build Path/Libraries. It listed the 1.4.2
library. This is normal. What wasn't normal is that it didn't change
when I changed the default JRE.
It *did* change for a new project, though. So I deleted the entry,
re-added it using Add Library... and everything was cool.
So yes, it was junk in the old project file.
|
|
|
Powered by
FUDForum. Page generated in 0.08634 seconds