Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 369524 - 'Installed JREs > Search...' should also find JDKs from Developer Package
Summary: 'Installed JREs > Search...' should also find JDKs from Developer Package
Status: RESOLVED FIXED
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 3.8   Edit
Hardware: PC Mac OS X
: P1 normal (vote)
Target Milestone: 3.8 M7   Edit
Assignee: Michael Rennie CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 377849 (view as bug list)
Depends on: 368483
Blocks:
  Show dependency tree
 
Reported: 2012-01-24 09:43 EST by Markus Keller CLA
Modified: 2012-05-01 12:07 EDT (History)
4 users (show)

See Also:
markus.kell.r: review+


Attachments
/usr/libexec/java_home -X (4.35 KB, text/plain)
2012-03-05 18:29 EST, Markus Keller CLA
no flags Details
partial fix (10.89 KB, patch)
2012-04-26 16:06 EDT, Michael Rennie CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Markus Keller CLA 2012-01-24 09:43:22 EST
I20120123-1800, Mac OS X 10.7.2, follow-up to bug 325777

'Preferences > Installed JREs > Search...' should also find JDKs from Developer Packages. Looks like the implementation currently only finds VMs in
/System/Library/Java/JavaVirtualMachines/

It should also search in
/Library/Java/JavaVirtualMachines/

That's the place where Java Developer Packages from 
https://developer.apple.com/downloads/index.action are installed (search for 'Java').

These VMs are also listed by /usr/libexec/java_home -X

The Developer Packages are interesting because they also include source. To add them in Eclipse today, you have to know the full path into the bundled folder. The Directory... chooser won't bring you there. In my case, it was:
/Library/Java/JavaVirtualMachines/1.6.0_29-b11-402.jdk/Contents/Home
Comment 1 Michael Rennie CLA 2012-03-05 17:09:16 EST
(In reply to comment #0)
 
> That's the place where Java Developer Packages from 
> https://developer.apple.com/downloads/index.action are installed (search for
'> Java').

I cannot get access to one of these packages as I am not a registered Apple developer and have no intention of creating an Apple account.

> These VMs are also listed by /usr/libexec/java_home -X

Markus, would it possible for you to run this for me so I can see the shape of the XML for the developer packages in the output (I assume it is the same as the rest, but maybe not)? Put a breakpoint in MacInstalledJREs line 154 and copy the text out of the details pane.
Comment 2 Markus Keller CLA 2012-03-05 18:29:44 EST
Created attachment 212105 [details]
/usr/libexec/java_home -X
Comment 3 Michael Rennie CLA 2012-04-26 16:06:11 EDT
Created attachment 214636 [details]
partial fix

This patch contains a fix that allows the Mac VM searching to ignore any invalid VM definitions (ones that fail to parse, etc) and return any VMs it does find - before it would abort completely and return none.

The logic to compute the VM id is also updated.

Testing this patch I was able to search for and find all VMs - developer ones included - on Silenio's Snow Leopard machine.
Comment 4 Michael Rennie CLA 2012-04-26 16:08:48 EDT
(In reply to comment #3)
 
> Testing this patch I was able to search for and find all VMs - developer ones
> included - on Silenio's Snow Leopard machine.

I pushed the patch to:

http://git.eclipse.org/c/jdt/eclipse.jdt.debug.git/commit/?id=118a08613f14fbf910ee63d882ae035942f93cc1

Markus, if you have a Lion machine, I would be interested to know if the patch works there as well.
Comment 5 Michael Rennie CLA 2012-04-26 17:05:38 EDT
I pushed more tests for our plist parser + JREDescriptor here:

http://git.eclipse.org/c/jdt/eclipse.jdt.debug.git/commit/?id=cdee84d00f6fac0350e76b4780eda4000eae5da1
Comment 6 Michael Rennie CLA 2012-04-27 10:22:52 EDT
*** Bug 377849 has been marked as a duplicate of this bug. ***
Comment 7 Markus Keller CLA 2012-04-27 16:50:42 EDT
I didn't thoroughly check the code, but I verified that everything works fine with the I20120427-1000 on my Mac OS X Lion (10.7.3) install.
Comment 8 Michael Rennie CLA 2012-04-30 21:47:06 EDT
(In reply to comment #7)
> I didn't thoroughly check the code, but I verified that everything works fine
> with the I20120427-1000 on my Mac OS X Lion (10.7.3) install.

I pushed an additional change the prevents JREs with the same path from being added as separate JREs. This case was found by adding a JRE by hand (using the Add.. button) and then doing a search. Duplicates would show up because of the way we used compute the ID for a VMStandin.
Comment 9 Michael Rennie CLA 2012-04-30 21:47:26 EDT
(In reply to comment #8)
> I pushed an additional change the prevents JREs with the same path from being
> added as separate JREs. This case was found by adding a JRE by hand (using the
> Add.. button) and then doing a search. Duplicates would show up because of the
> way we used compute the ID for a VMStandin.

The commit: http://git.eclipse.org/c/jdt/eclipse.jdt.debug.git/commit/?id=159480c84f7f681d88f2e7f6d7e065a97895d613
Comment 10 Michael Rennie CLA 2012-05-01 12:07:10 EDT
marking fixed