Bug 95555 - Variables (e.g. ${project_loc} not supported in "default VM arguments" of JRE config
Summary: Variables (e.g. ${project_loc} not supported in "default VM arguments" of JRE...
Status: RESOLVED DUPLICATE of bug 118946
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:
Depends on:
Blocks:
 
Reported: 2005-05-17 10:03 EDT by Neale Upstone CLA
Modified: 2006-05-15 16:02 EDT (History)
0 users

See Also:


Attachments
.project source and .launch files that demonstrate the problem (1.37 KB, application/octet-stream)
2005-05-17 10:13 EDT, Neale Upstone CLA
no flags Details

Note You need to log in before you can comment on or make changes to this bug.
Description Neale Upstone CLA 2005-05-17 10:03:26 EDT
Something very odd going on here.  At first seems like just a variable not
getting expanded, but then finding that the running app doesn't even get changed
VM args when I change them in the Run Configuration.

Classic situation: want to specify a -D option to tell logging where to get
properties file.

The following demonstrates the situation.  ${project_loc} gets expanded in
program arguments, but not in VM arguments.

public class TestLogger {

	public static void main(String[] args) {
	
		System.out.println( args[0] );
		
		String prop = System.getProperty( "java.util.logging.config.file");
		System.out.println( prop );
	}
}

The corresponding .launch is:

<?xml version="1.0" encoding="UTF-8"?>
<launchConfiguration type="org.eclipse.jdt.launching.localJavaApplication">
<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="TestLogger"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS"
value="${project_loc}"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="TestLogging"/>
<stringAttribute key="org.eclipse.jdt.launching.VM_ARGUMENTS"
value="-Djava.util.logging.config.file=${project_loc}/src/logging.properties"/>
<booleanAttribute key="org.eclipse.debug.core.appendEnvironmentVariables"
value="true"/>
</launchConfiguration>

Output is:
C:\dev\workspace\TestLogging
${project_loc}/src/logging.properties

Clearly, the second line should not read as it does.

WORSE STILL.  Further testing, trying to use ${workspace_loc:TestLogging} gave
teh exact same results as above (i.e. containing ${project_loc}
Comment 1 Neale Upstone CLA 2005-05-17 10:13:56 EDT
Created attachment 21259 [details]
.project source and .launch files that demonstrate the problem
Comment 2 Neale Upstone CLA 2005-05-17 13:36:58 EDT
Originally reported bug is misleading.

What is actually happening is that the VM args are set with the following VM entry
in launching.prefs for the workspace: 

<vm id\="0" javadocURL\="http\://java.sun.com/j2se/1.5.0/docs/api/"
name\="jdk1.5" path\="C\:\\apps\\jdk1.5" vmargs\="-ea
-Djava.util.logging.config.file\=${project_loc}/src/logging.properties"/>

TWO things seem to be happening that are unexpected:
1) ${project_loc} (and other variables) is not getting expanded, as if it had
been put in the VM arguments section of a launch configuration.
2) It isn't clear what happens when VM arguments appear in both the launch
configuration and the default for the VM.  Expected behaviour would be that
launch configuration takes precident.
is when put in as the normal path
Comment 3 Darin Wright CLA 2005-05-18 09:11:29 EDT
The default VM args do not support variables currently. This is an enhancement 
request. VM args are simply appended (not merged).

Deferred for post 3.1 consideration.
Comment 4 Darin Wright CLA 2006-05-15 16:01:59 EDT
dup
Comment 5 Darin Wright CLA 2006-05-15 16:02:20 EDT
marking as dup of newer bug to avoid losing vote.

*** This bug has been marked as a duplicate of 118946 ***