Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
Bug 143781 - propagate env var to list of elipse vars
Summary: propagate env var to list of elipse vars
Status: RESOLVED WONTFIX
Alias: None
Product: JDT
Classification: Eclipse Project
Component: Debug (show other bugs)
Version: 3.1   Edit
Hardware: PC Windows XP
: P3 enhancement (vote)
Target Milestone: ---   Edit
Assignee: JDT-Debug-Inbox CLA
QA Contact:
URL:
Whiteboard:
Keywords:
: 156745 (view as bug list)
Depends on:
Blocks:
 
Reported: 2006-05-25 13:47 EDT by Marcio CLA
Modified: 2009-08-30 02:19 EDT (History)
3 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marcio CLA 2006-05-25 13:47:43 EDT
Hi,

    I have an environment variable, FIT_HOME, and I need to add an eclipse variable (Window->Preferences, Java, Build Path, Classpath Variables) that maps to this environment variable. Is there a way to do this? I have tried but Eclipse 3.1 won't take it (FIT_HOME=%FIT_HOME%). I don't want to have to duplicate the value for obvious reasons.

    Basically I want an environment variable to propagate into the Eclipse settings "automagically" if possible. If not possible, then I want to manually define it, binding to the environment variable itself instead of duplicating the value.

    I want to zip up a pre-configured Worspace and distribute to a group and know that they can checkout a project that has a .classpath file which refers to FIT_HOME (and others) and not have problems with the build. I want it to build properly. I want the FIT_HOME var in Eclipse to work for them regardless of what the actual value of the env var FIT_HOME is.

    Another possibility is to make use of the env var FIT_HOME in the .classpath file instead of the eclipse var FIT_HOME. Does that work? %FIT_HOME% ? Is that cross-platform?

   I have tried the following Eclipse shortcut but that also fails to populate the Eclipse variables with FIT_HOME:


C:\eclipse3.1\eclipse.exe  -data C:\marcio\workspace -vm "C:\Program Files\Java\jdk1.5.0_05\bin\javaw.exe" -vmargs -DFIT_HOME=%FIT_HOME% -Xmx268000000
Comment 1 Martin Aeschlimann CLA 2006-05-26 04:30:08 EDT
Classpath variables don't support this. Moving to jdt.core.

I think for 3.3 we should discuss about how to continue with classpath variables. Maye we find a way to merge with org.eclipse.core.variables.
Comment 2 Jerome Lanneluc CLA 2006-07-11 11:48:16 EDT
This can be achieved by a ClasspathVariableInitializer that would set the classpath variable to the corresponding environment variable value.

Moving to JDT Debug for consideration since debug.core as the code to read environment variables.
Comment 3 Marcio CLA 2006-07-11 11:57:25 EDT
A related suggestion: *_HOME vars should automatically make it into Eclipse. Java has many components that follow this approach:

JAVA_HOME
ANT_HOME
CATALINA_HOME
...

If there isn't an override present in Eclipse, it should take the values from the env vars and make them available inside Eclipse.
Comment 4 Darin Wright CLA 2006-08-01 16:58:58 EDT
Martin, this could be done with a special "environment" classpath variable that gets extended in a custom way - i.e. with an environment variable name and optional path extension. However, the "Extend..." UI for classpath variables is not currently extensible.
Comment 5 Martin Aeschlimann CLA 2006-08-02 06:39:24 EDT
But wouldn't we still need classpath variable initializers? These have to be contributed for a specific variable name. How would that work? I assume you want the user can choose a env variable that is now also a classpath variable.
Did I miss something?
Comment 6 Darin Wright CLA 2006-08-02 09:32:30 EDT
Ah right... we don't get a chance to resolve the "extension" to a classpath variable - it's just a path. I'd say this is not really possible with current classpath variables. It might be possibe with a classpath container - it gets to resolve dynamically and can have secondary "paths" that are interpretted by the contributor.
Comment 7 Frederic Fusier CLA 2006-09-09 11:42:27 EDT
*** Bug 156745 has been marked as a duplicate of this bug. ***
Comment 8 Darin Wright CLA 2007-02-21 17:02:54 EST
We don't have the resources to do this in 3.3, but I believe it could be contributed by any component using existing API. A ne classpath container would need to be defined. Each instance of the container would be associated with an evnrionment variable. The container would resolve to the libaries associated with the variable. A wizard page could be contributed to JUI's org.eclipse.jdt.ui.classpathContainerPage extension point, to configure the container.

For now, I'm marking as LATER.
Comment 9 Denis Roy CLA 2009-08-30 02:19:43 EDT
As of now 'LATER' and 'REMIND' resolutions are no longer supported.
Please reopen this bug if it is still valid for you.