Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Plugin Development Environment (PDE) » What is the proper way to change Java Compiler?
What is the proper way to change Java Compiler? [message #480926] Wed, 19 August 2009 00:06 Go to next message
Michael Sullivan is currently offline Michael SullivanFriend
Messages: 37
Registered: July 2009
Member
OK, I have projects that I set up in a default environment with Java 1.6
as the default. When I look at the properties of the project, it has a
JRE System Library of JavaSE-1.6 on the build-path, and "Enable Project
Specific Settings" checkedx in the Java Compiler properties.

My default Compiler is called jdk1.6.0_12.

If I uncheck "Enable Project Specific Settings", my project does not
rebuild and JavaSE-1.6 stays in the build path. If I remove JavaSE-1.6
from the build path, still no rebuild. If I got to add a JRE back on, the
only option is the jdk1.6.0_12.

Should unchecking "Enable Project Specific Settings" have automatically
changed the JRE on my build path?
Re: What is the proper way to change Java Compiler? [message #481069 is a reply to message #480926] Wed, 19 August 2009 13:55 Go to previous messageGo to next message
Eric Rizzo is currently offline Eric RizzoFriend
Messages: 3071
Registered: July 2009
Senior Member
Michael Sullivan wrote:
> OK, I have projects that I set up in a default environment with Java 1.6
> as the default. When I look at the properties of the project, it has a
> JRE System Library of JavaSE-1.6 on the build-path, and "Enable Project
> Specific Settings" checkedx in the Java Compiler properties.
>
> My default Compiler is called jdk1.6.0_12.
>
> If I uncheck "Enable Project Specific Settings", my project does not
> rebuild and JavaSE-1.6 stays in the build path. If I remove JavaSE-1.6
> from the build path, still no rebuild. If I got to add a JRE back on,
> the only option is the jdk1.6.0_12.
>
> Should unchecking "Enable Project Specific Settings" have automatically
> changed the JRE on my build path?
>

I'm not 100% sure what exactly you're asking or what your situation
really is. But here's some general information that might help you, or
at least trigger some more details about the situation:
Eclipse has the notion of an Execution Environment, which is an
abstraction over the particular JREs/JVMs that are installed. The
Execution Environments are common names that project's declare their
dependency on, and each user or workspace satisfies those Execution
Environments with a specific JREs that are located somewhere proprietary
to that user/workspace. Execution Environments were created to allow
sharing of projects without requiring that we have our Installed JREs
use exactly the same name or be in the same locations on our file systems.
So in your situation, JavaSE-1.6 is the Execution Environment, and it's
satisfied by jdk1.6.0_12. In general it is good practice to use
project-specific settings for that (and the other things) so that it can
be checked in to source control; then every workspace that checks out
that project will only be required to have a Java 1.6-compatible JRE
available, regardless of what it is named or where it is located.
If you're wondering why your project didn't rebuild, my guess is that
Eclipse is smart enough to realize that, in your workspace, JavaSE-1.6
== jdk1.6.0_12 and so it realizes there is no need to rebuild. As for
why Eclipse would have set your project-specific JRE to JavaSE-1.6, I
think that is because the default behavior is to use an Execution
Environment when possible, since they are a better abstraction.

In short, Execution Environments are the best option when a project is
going to be shared (and, IMO, even when the project will not be shared)
and Eclipse should really deprecate/hide the ability to use JREs directly.

Hope this helps,
Eric
Re: What is the proper way to change Java Compiler? [message #481086 is a reply to message #481069] Wed, 19 August 2009 15:00 Go to previous messageGo to next message
Michael Sullivan is currently offline Michael SullivanFriend
Messages: 37
Registered: July 2009
Member
Thanks Eric - I didn't understand about Execution Environments. I take it
Eclipse comes equipped with a bunch of defaults? I'm looking at the
Execution Environments preference page and see a few CDC ones, J2SE ones,
JavaSE-1.6, JRE-1.1 and some OSGi ones.

So is this the proper way to change Execution Environments (and therefore,
potentially, JREs) for projects?

1. Go to configure Java build path.
2. Go to libraries tab.
3. Remote old JRE system library.
4. Use Add Library.
5. Select JRE System Library and click Next
6. Select the Execution Environment radio button
7. From the drop down, select the new EE that is tied to the JRE I want
to use.

Is that it?

Thanks,
Mike
Re: What is the proper way to change Java Compiler? [message #481346 is a reply to message #481086] Thu, 20 August 2009 14:51 Go to previous message
Eric Rizzo is currently offline Eric RizzoFriend
Messages: 3071
Registered: July 2009
Senior Member
Michael Sullivan wrote:
> Thanks Eric - I didn't understand about Execution Environments. I take
> it Eclipse comes equipped with a bunch of defaults? I'm looking at the
> Execution Environments preference page and see a few CDC ones, J2SE
> ones, JavaSE-1.6, JRE-1.1 and some OSGi ones.
> So is this the proper way to change Execution Environments (and
> therefore, potentially, JREs) for projects?
>
> 1. Go to configure Java build path.
> 2. Go to libraries tab.
> 3. Remote old JRE system library.
> 4. Use Add Library.
> 5. Select JRE System Library and click Next
> 6. Select the Execution Environment radio button
> 7. From the drop down, select the new EE that is tied to the JRE I want
> to use.
>
> Is that it?

Yes, that sounds right. Note, however, that those steps will only
configure the build path; if you have any Launch Configurations that are
used to run your application you should follow the similar procedure for
editing the Launch Configuration (runtime) JRE.

I think I may blog about this, with a screencast; it's not the first
time I've helped someone by explaining Execution Environments and why
they're A Good Thing.

Eric
Re: What is the proper way to change Java Compiler? [message #600814 is a reply to message #480926] Wed, 19 August 2009 13:55 Go to previous message
Eric Rizzo is currently offline Eric RizzoFriend
Messages: 3071
Registered: July 2009
Senior Member
Michael Sullivan wrote:
> OK, I have projects that I set up in a default environment with Java 1.6
> as the default. When I look at the properties of the project, it has a
> JRE System Library of JavaSE-1.6 on the build-path, and "Enable Project
> Specific Settings" checkedx in the Java Compiler properties.
>
> My default Compiler is called jdk1.6.0_12.
>
> If I uncheck "Enable Project Specific Settings", my project does not
> rebuild and JavaSE-1.6 stays in the build path. If I remove JavaSE-1.6
> from the build path, still no rebuild. If I got to add a JRE back on,
> the only option is the jdk1.6.0_12.
>
> Should unchecking "Enable Project Specific Settings" have automatically
> changed the JRE on my build path?
>

I'm not 100% sure what exactly you're asking or what your situation
really is. But here's some general information that might help you, or
at least trigger some more details about the situation:
Eclipse has the notion of an Execution Environment, which is an
abstraction over the particular JREs/JVMs that are installed. The
Execution Environments are common names that project's declare their
dependency on, and each user or workspace satisfies those Execution
Environments with a specific JREs that are located somewhere proprietary
to that user/workspace. Execution Environments were created to allow
sharing of projects without requiring that we have our Installed JREs
use exactly the same name or be in the same locations on our file systems.
So in your situation, JavaSE-1.6 is the Execution Environment, and it's
satisfied by jdk1.6.0_12. In general it is good practice to use
project-specific settings for that (and the other things) so that it can
be checked in to source control; then every workspace that checks out
that project will only be required to have a Java 1.6-compatible JRE
available, regardless of what it is named or where it is located.
If you're wondering why your project didn't rebuild, my guess is that
Eclipse is smart enough to realize that, in your workspace, JavaSE-1.6
== jdk1.6.0_12 and so it realizes there is no need to rebuild. As for
why Eclipse would have set your project-specific JRE to JavaSE-1.6, I
think that is because the default behavior is to use an Execution
Environment when possible, since they are a better abstraction.

In short, Execution Environments are the best option when a project is
going to be shared (and, IMO, even when the project will not be shared)
and Eclipse should really deprecate/hide the ability to use JREs directly.

Hope this helps,
Eric
Re: What is the proper way to change Java Compiler? [message #600827 is a reply to message #481069] Wed, 19 August 2009 15:00 Go to previous message
Michael Sullivan is currently offline Michael SullivanFriend
Messages: 37
Registered: July 2009
Member
Thanks Eric - I didn't understand about Execution Environments. I take it
Eclipse comes equipped with a bunch of defaults? I'm looking at the
Execution Environments preference page and see a few CDC ones, J2SE ones,
JavaSE-1.6, JRE-1.1 and some OSGi ones.

So is this the proper way to change Execution Environments (and therefore,
potentially, JREs) for projects?

1. Go to configure Java build path.
2. Go to libraries tab.
3. Remote old JRE system library.
4. Use Add Library.
5. Select JRE System Library and click Next
6. Select the Execution Environment radio button
7. From the drop down, select the new EE that is tied to the JRE I want
to use.

Is that it?

Thanks,
Mike
Re: What is the proper way to change Java Compiler? [message #600880 is a reply to message #481086] Thu, 20 August 2009 14:51 Go to previous message
Eric Rizzo is currently offline Eric RizzoFriend
Messages: 3071
Registered: July 2009
Senior Member
Michael Sullivan wrote:
> Thanks Eric - I didn't understand about Execution Environments. I take
> it Eclipse comes equipped with a bunch of defaults? I'm looking at the
> Execution Environments preference page and see a few CDC ones, J2SE
> ones, JavaSE-1.6, JRE-1.1 and some OSGi ones.
> So is this the proper way to change Execution Environments (and
> therefore, potentially, JREs) for projects?
>
> 1. Go to configure Java build path.
> 2. Go to libraries tab.
> 3. Remote old JRE system library.
> 4. Use Add Library.
> 5. Select JRE System Library and click Next
> 6. Select the Execution Environment radio button
> 7. From the drop down, select the new EE that is tied to the JRE I want
> to use.
>
> Is that it?

Yes, that sounds right. Note, however, that those steps will only
configure the build path; if you have any Launch Configurations that are
used to run your application you should follow the similar procedure for
editing the Launch Configuration (runtime) JRE.

I think I may blog about this, with a screencast; it's not the first
time I've helped someone by explaining Execution Environments and why
they're A Good Thing.

Eric
Previous Topic:get the URI of a file selected
Next Topic:PDE Extension Points and Import Package
Goto Forum:
  


Current Time: Mon Aug 15 19:07:55 GMT 2022

Powered by FUDForum. Page generated in 0.02780 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top