This Bugzilla instance is a read-only archive of historic NetBeans bug reports. To report a bug in NetBeans please follow the project's instructions for reporting issues.

Bug 228451 - confusing (and broken) JDK selection in Glassfish server dialog
Summary: confusing (and broken) JDK selection in Glassfish server dialog
Status: VERIFIED FIXED
Alias: None
Product: serverplugins
Classification: Unclassified
Component: GlassFish (show other bugs)
Version: 7.3.1
Hardware: PC All
: P3 normal (vote)
Assignee: TomasKraus
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2013-04-10 16:20 UTC by athompson
Modified: 2013-04-18 00:45 UTC (History)
3 users (show)

See Also:
Issue Type: DEFECT
Exception Reporter:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description athompson 2013-04-10 16:20:56 UTC
0. Run Netbeans with the default JDK 1.7
1. Explicitly add JDKs 1.6 and 1.7 (under Tools>Java Platforms). The results look like this:

Java SE
- JDK 1.6
- JDK 1.7
- JDK 1.7 (default)

2. Add a Glassfish 3.1 or 4 server (under Tools>Servers).
3! Try to change the Glassfish server's JDK (under Tools>Servers>Glassfish Server>JDK).

The first problem (the confusing part) is the entries in the JDK drop down:

- NetBeans default JDK
- JDK 1.7 (default)
- JDK 1.6
- JDK 1.7

What is the difference between "NetBeans default JDK" and "JDK 1.7 (default)"? No other dialog in Netbeans which requires you to select a JDK has the "NetBeans default JDK" option--just the option marked as "(default)". Unless there is a difference, the "NetBeans default JDK" option should be removed in favor of the "official" default JDK option (as it's listed under "Java Platforms"). If there is a difference, that difference should be explained in both the dialog and the help page. Additionally, the help page needs to be updated now that you select the JDK and not the executable.

The second problem (the bug part) is that explicitly selecting "JDK 1.7" doesn't get remembered--it reverts instead to the "JDK 1.7 (default)" option. "JDK 1.6" works correctly, however.

Also, it would be nice if the drop down listed the JDKs in the same order as they are listed in "Java Platforms" and the other dialogs which allow you to select a JDK.
Comment 1 TomasKraus 2013-04-10 23:13:58 UTC
There is significant diference between
- NetBeans default JDK
- JDK 1.7 (default)
options.

First one will simply store empty value into java.platform property and server will be started with JavaPlatform.getdefault() JDK. (This is what happened when previous text field pointing to JDK binary was empty)

Rest of the options are JavaPlatforms already registered in netbeans and '(default)" string in "JDK 1.7 (default)" is just part of displayname.
But in all those cases java.platform will contain selected JDK which will be later used.

Explicitly selected value was not get remembered because there was nothing to persist new values. This will be resolved as part of Bug# 228433 fix (probalby tomorrow, part of the fix is available in http://bertram.netbeans.org:8080/job/web-main-javaee7/226/ build). 

The only thing I can change as part of this bug is the JDK drop down which should follow Java Platforms UI.
Comment 2 Petr Hejl 2013-04-11 07:04:37 UTC
(In reply to comment #1)
> There is significant diference between
> - NetBeans default JDK
> - JDK 1.7 (default)
> options.
> 
> First one will simply store empty value into java.platform property and server
> will be started with JavaPlatform.getdefault() JDK. (This is what happened when
> previous text field pointing to JDK binary was empty)
> 
> Rest of the options are JavaPlatforms already registered in netbeans and
> '(default)" string in "JDK 1.7 (default)" is just part of displayname.
> But in all those cases java.platform will contain selected JDK which will be
> later used.
> 
> Explicitly selected value was not get remembered because there was nothing to
> persist new values. This will be resolved as part of Bug# 228433 fix (probalby
> tomorrow, part of the fix is available in
> http://bertram.netbeans.org:8080/job/web-main-javaee7/226/ build). 
> 
> The only thing I can change as part of this bug is the JDK drop down which
> should follow Java Platforms UI.

Tomasi, I think those options are equivalent from the user point of view. The platform containing the (default) in display name is the one NetBeans is started with which in turn is the platform returned by JavaPlatform.getDefault() and vice versa.

I also think it is important for NetBeans UIs to be consistent. So please use the same approach as it is with other servers (Tomcat for example). So the field should be "Java Platform", the button should be labeled "Manage Platforms" and there should not be "NetBeans default JDK".
Comment 3 athompson 2013-04-11 15:20:42 UTC
(In reply to comment #1)
> There is significant diference between
> - NetBeans default JDK
> - JDK 1.7 (default)
> options.
> 
> First one will simply store empty value into java.platform property and server
> will be started with JavaPlatform.getdefault() JDK. (This is what happened when
> previous text field pointing to JDK binary was empty)
> 
> Rest of the options are JavaPlatforms already registered in netbeans and
> '(default)" string in "JDK 1.7 (default)" is just part of displayname.
> But in all those cases java.platform will contain selected JDK which will be
> later used.

I'm not sure I see the difference as far as the end user is concerned. The "JDK 1.7 (default)" option is automatically added depending on the currently running JDK. For example, if I exit Netbeans and restart with JDK 1.8, the "JDK 1.7 (default)" option disappears and a "JDK 1.8 (default)" option takes it's place.

Furthermore, if a project or (other) server's JDK was set to "JDK 1.7 (default)" while running Netbeans with 1.7, and then you restart Netbeans with 1.8, the project/server JDK then becomes "JDK 1.8 (default)" without any user intervention. So aren't the two options effectively the same thing? And why would the end user care about an implementation detail such as whether a property in the project's metadata is blank?
Comment 4 athompson 2013-04-11 15:21:22 UTC
Whoops, what he said.  :)
Comment 5 TomasKraus 2013-04-11 15:33:28 UTC
If you choose JDK 1.7 (default) then JAVA_HOME of this JDK 1.7 (default) is stored as java.platform property.
When NetBeans are started with JDK 1.8, it will still keep reference to JDK 1.7 (now not default) selected before because its real platform.

NetBeans default JDK on the other hand means 'use whatever is default platform".
Those options are not equivalent.

But ok, I can change it to use JavaPlatform.getDefault platform as what is currently 'NetBeans default JDK' and remove the one you do not like.

Is this enough to make you all happy? :)

UI labels were changed to follow rest of the UI.

NetBeans web-main:
------------------
changeset:   250272:8f387c450fbc
branch:      javaee7
summary:     #228451 - Combo box content is sorted by JavaPlatform display name

changeset:   250273:99f42c6857bd
branch:      javaee7
summary:     #228451 - UI Labels updated
Comment 6 athompson 2013-04-11 16:02:33 UTC
(In reply to comment #5)
> If you choose JDK 1.7 (default) then JAVA_HOME of this JDK 1.7 (default) is
> stored as java.platform property.
> When NetBeans are started with JDK 1.8, it will still keep reference to JDK 1.7
> (now not default) selected before because its real platform.

I just experimentally verified that this is not the case. It works exactly as described in comment #2 and comment #3.
Comment 7 athompson 2013-04-11 16:26:46 UTC
(In reply to comment #6)
> I just experimentally verified that this is not the case. It works exactly as
> described in comment #2 and comment #3.

That is, it works correctly for other dialogs which allow you to select a JDK. Can you check to see how others have accomplished this task? I imagine (since Netbeans is primarily a java IDE) this functionality must be a part of the platform/a plugin somewhere. If the functionality is in the platform, deviating from the standard way would only serve to make the code more brittle and harder to maintain, and any future improvements would not be reflected in this dialog. Even if it requires a change to the metadata, my vote is always to abstract and reuse existing code instead of "reinventing the wheel".
Comment 8 TomasKraus 2013-04-11 16:47:21 UTC
This UI is not public so I had to write my own UI for this. Finding some common piece of code was first thing I did.

Here is last update for web-main:
---------------------------------
changeset:   250311:6e01253898c7
branch:      javaee7
summary:     #228451 - NetBeans default JDK removed and replaced
             with default JavaPlatform
Comment 9 athompson 2013-04-11 17:40:17 UTC
(In reply to comment #8)
> This UI is not public so I had to write my own UI for this. Finding some common
> piece of code was first thing I did.

Ah, that sounds like an enhancement request! JDK selection is done all over the place. I'd file it myself but I'm not familiar enough with the Netbeans API (I'm more of a "Monday morning quarterback" kind of guy).
Comment 10 TomasKraus 2013-04-11 22:00:05 UTC
Looks like you are in some US time zone. Please chceck http://bertram.netbeans.org:8080/job/web-main-javaee7/229/ when done if it's ok for you now. I would like to close this issue tomorrow in the morning.
Comment 11 athompson 2013-04-12 15:06:00 UTC
The download doesn't seem to have any plugins enabled. Is  there something special I need to do to install it?
Comment 12 TomasKraus 2013-04-15 15:04:27 UTC
there should be plugins enabled. Latest build artefact on http://bertram2.netbeans.org:8080/job/web-main-javaee7/ should contain all modules including GF plugin.
Comment 13 Quality Engineering 2013-04-17 00:19:52 UTC
Integrated into 'releases', will be available in build *201304162201* or newer. Wait for official and publicly available build.
Changeset: http://hg.netbeans.org/releases/rev/8f387c450fbc
User: Tomas Kraus <TomasKraus@netbeans.org>
Log: #228451 - Combo box content is sorted by JavaPlatform display name
Comment 14 athompson 2013-04-18 00:45:35 UTC
yup