Bug 477439 - Java System Library doesn't match any installed JRE
Summary: Java System Library doesn't match any installed JRE
Status: ASSIGNED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: UI (show other bugs)
Version: 4.5.1   Edit
Hardware: PC Linux
: P3 minor (vote)
Target Milestone: ---   Edit
Assignee: JDT-UI-Inbox CLA
QA Contact:
URL:
Whiteboard: stalebug
Keywords:
Depends on:
Blocks:
 
Reported: 2015-09-15 06:04 EDT by Emmanuel Hugonnet CLA
Modified: 2022-10-14 08:31 EDT (History)
5 users (show)

See Also:


Attachments
JRE System Library (187.51 KB, image/png)
2015-09-15 06:04 EDT, Emmanuel Hugonnet CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Emmanuel Hugonnet CLA 2015-09-15 06:04:08 EDT
Created attachment 256571 [details]
JRE System Library

I imported an Apache Maven project with compiler source and target set to 1.7.
I only have a Java 8 JRE installed and configured.
The JRE System Library is labelled : JRE System Library [JavaSE-1.7] which is quite confusing (all the more so as some Java 8 API may leak into the project).

Maybe the label shouldn't show any version reference if it is not the version of the underlying JRE.
Comment 1 Max Rydahl Andersen CLA 2015-09-15 06:56:15 EDT
Emmanuel - the version info is correct; the notion of it being JRE is wrong.

It is using JavaSE-1.7 *execution environment* which then is mapped over to the closest matching available Java Runtime.

I can think of two ways to improve this situation.

A) don't call this JRE System Library since anywhere else JRE and Execution environment are clearly separated. Maybe "Java System Library" ?

B) add a label more showing which jdk is *actually* being used behind this logical java version.

Something like [JavaSE-1.6->Java SE 8 [1.8.0_20]]
Comment 2 Mickael Istria CLA 2015-09-15 07:27:57 EDT
Or maybe using directly the target Java version as label?
That would give "JavaSE 1.7 (on Java SE 1.8.0_20)"
Comment 3 Jay Arthanareeswaran CLA 2015-09-16 01:44:12 EDT
I can't comment for Maven projects, but in a simple Java project, the compiler will compile against the 1.8 libraries, API etc. As expected when the program is run with a 1.7 JRE it could fail. In a simple Java project set-up, the compiler issues a warning about this.
Comment 4 Mickael Istria CLA 2015-09-16 02:06:50 EDT
(In reply to Jay Arthanareeswaran from comment #3)
> I can't comment for Maven projects, but in a simple Java project, the
> compiler will compile against the 1.8 libraries, API etc. As expected when
> the program is run with a 1.7 JRE it could fail. In a simple Java project
> set-up, the compiler issues a warning about this.

If I understand correctly, it's exactly the problem Emmanuel report. People who are used to Eclipse see "JRE System Library [JavaSE-1.7]" (computed from project setting), whereas the library that is actually used by the project is JavaSE-1.8.
So the label is misleading and wrong, and should be fixed.
Comment 5 Max Rydahl Andersen CLA 2015-09-16 04:01:09 EDT
The *name* of the JDK can be anything; the execution environment actually have an impact on how things are loaded/run.

Hence why I suggest the <exec env> -> <jre/jdk name> label.
Comment 6 Mickael Istria CLA 2015-09-16 04:10:28 EDT
(In reply to Max Rydahl Andersen from comment #5)
> The *name* of the JDK can be anything; the execution environment actually
> have an impact on how things are loaded/run.
> 
> Hence why I suggest the <exec env> -> <jre/jdk name> label.

Although I fully agree that it's best to show those 2 pieces of data, I'm not sure users will get the meaning of that arrow.
There are 2 parts: target and resolution, so the meaning is "Target Java SE 7, resolved against Java SE 8 (1.8.0_20)" which is obviously too long got the viewers. Some suggestions:
* Java SE 7 (on Java SE 8 [1.8.0_20])
* Java SE 7 (is Java SE 8 [1.8.0_20])
* Java SE 8 [1.8.0_20] (for Java SE 7)
* Java SE 8 [1.8.0_20] (req. Java SE 7)
Comment 7 Max Rydahl Andersen CLA 2015-09-16 04:40:05 EDT
"Java SE 8 [1.8.0_20] for Java SE 7"
Comment 8 Mickael Istria CLA 2015-09-16 04:44:37 EDT
(In reply to Max Rydahl Andersen from comment #7)
> "Java SE 8 [1.8.0_20] for Java SE 7"

and in case target version is same library version as actual JVM, only show
"Java SE 8 [1.8.20]"
Comment 9 Max Rydahl Andersen CLA 2015-09-16 04:54:03 EDT
I don't see how you can detect that nor does having same jre version always imply it is the same execution environment version.
Comment 10 Max Rydahl Andersen CLA 2015-09-16 04:55:04 EDT
to be clear - the minimal change is to show the actual used JRE name/version.

and if execution environment is shown, it would have to always be shown.
Comment 11 Jay Arthanareeswaran CLA 2015-09-16 05:04:26 EDT
So, the warning issued about the mismatch is not sufficient? In any case, moving to UI for comments/closure.
Comment 12 Mickael Istria CLA 2015-09-16 05:12:53 EDT
(In reply to Jay Arthanareeswaran from comment #11)
> So, the warning issued about the mismatch is not sufficient?

It doesn't seem sufficient (although it's useful and should be kept): as Emmanuel reported, a user importing a Java 7 project but using only Java 8 will see "Java SE 1.7" although the project actually compiles against Java SE 1.8.
As Max advises, showing the actual version instead of the target is probably more meaningful. Finding a nice way to show both would be good.

Also, about the warning, is it possible to show it with a "warning" icon on the "JRE System Library" tree node?
Comment 13 Max Rydahl Andersen CLA 2015-09-16 06:26:56 EDT
There is no warning near this UI and even if it was the notion of JRE and Execution environment is being mixed up here leading to the confusion/ambiguity.
Comment 14 Eclipse Genie CLA 2020-06-09 07:01:11 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.
Comment 15 Eclipse Genie CLA 2022-10-14 08:31:41 EDT
This bug hasn't had any activity in quite some time. Maybe the problem got resolved, was a duplicate of something else, or became less pressing for some reason - or maybe it's still relevant but just hasn't been looked at yet.

If you have further information on the current state of the bug, please add it. The information can be, for example, that the problem still occurs, that you still want the feature, that more information is needed, or that the bug is (for whatever reason) no longer relevant.

--
The automated Eclipse Genie.