Bug 308953 - JDT should support java.endorsed.dirs
Summary: JDT should support java.endorsed.dirs
Status: NEW
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 3.6   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-Debug-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2010-04-13 01:12 EDT by Yen Lu CLA
Modified: 2010-09-28 15:20 EDT (History)
6 users (show)

See Also:


Attachments
patch (16.78 KB, patch)
2010-08-20 16:03 EDT, Darin Wright CLA
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Yen Lu CLA 2010-04-13 01:12:36 EDT
Build Identifier: 3.6

If an Eclipse-based product bundles a JDK, it should be possible to point to an endorsed directory other than the default JDK's jre/lib/endorsed. Supporting this via the system property java.endorsed.dirs in eclipse.ini would be one way for a product to specify such a directory.

Reproducible: Always

Steps to Reproduce:
1. Configure Eclipse with a JDK.
2. Try to add an endorsed directory other than the JDK's jre/lib/endorsed (which is the default)
Comment 1 Yen Lu CLA 2010-04-13 01:16:01 EDT
The behavior we observe today is that any jars in directories outside the JDK's jre/lib/endorsed are not picked up. We have tried specifying the JVM property: java.endorsed.dirs to point to a different directory and, although the VM property is set according to the Help => About => Installation Details => Configuration, the actual jars are not picked up by the configured JRE. If we create a Java project with this JRE, the jars do not show up in the package explorer.
Comment 2 Olivier Thomann CLA 2010-04-13 09:02:57 EDT
Move to JDT/Debug
Comment 3 Darin Wright CLA 2010-04-13 09:29:27 EDT
Marking as an enhancement request. The system property is a runtime property, and as such has not been picked up by the tooling at compile time. The jars/libs need to appear on the build path as well as the runtime class path. Support needs to be added to look for this property in the VM specific arguments and update when it changes.
Comment 4 Yen Lu CLA 2010-04-14 09:51:45 EDT
We would also like a programmatic API to do this when creating an installed JRE.
Comment 5 Yen Lu CLA 2010-08-11 01:01:29 EDT
We'd like to associate this with a specific JRE.
Comment 6 Darin Wright CLA 2010-08-17 15:43:33 EDT
There is an alternate approach that could be used to define a JRE with endorsed directories that will appear properly on the build and runtime classpath:

JDT supports defining installed JREs via "executable environment description"
files (http://wiki.eclipse.org/Execution_Environment_Descriptions). There is
also an API to create/define VMs from description files:

org.eclipse.jdt.launching.JavaRuntime.createVMFromDefinitionFile(File, String,
String)

These description files support the notion of endorsed directories via the
"ee.endorsed.dirs" property in a description file.

A client could define/ship an "ee" file that describes the desired
JRE (with custom endorsed directories). The client could programmatically
create an installed JRE from the file with existing API.
Comment 7 Darin Wright CLA 2010-08-20 16:03:57 EDT
Created attachment 177141 [details]
patch

work in progress
Comment 8 Elson Yuen CLA 2010-08-25 17:55:57 EDT
We are evaluating and trying things out based on Darin's on comment #6.  We'll post the result once we have got the results.
Comment 9 Angel Vera CLA 2010-08-31 13:09:56 EDT
Darin suggestion possibly works but I found a different solution which I think is simpler to implement. 

Instead of creating a .ee file and maintain it (creating the file and its properties, updating the properties if needed, deleting the file) one could get the libraries from the VM, and append or re-arrange libraries as it is needed and set them on the VM back. This implies that one needs create LibraryLocation objects from the libraries provided in the proprietary endoresed dir and append them to the top of all libraries

- This is probably be less work, than maintain a file. 
- It should be faster, as there is no IO during creation and reading of a ee. file, everything is done in memory, and 
- For most of the work there are APIs already provided.
Comment 10 Darin Wright CLA 2010-09-28 15:20:00 EDT
No longer in plan for 3.7 as the workaround described in comment#9 is sufficient.