Community
Participate
Working Groups
Build ID: v3.2.1 M20060921-0945 Steps To Reproduce: 1. Set a JRE level VM args via Preferences (e.g. -Dvm.test.arg=jre or -Xmx1024) 2. Create a simple java app that prints out the VM args you specified (e.g. System.getProperty("vm.test.arg")) 3. Create a launch configuration for this class and set VM args here (e.g. -Dvm.test.arg=launch or -Xmx128) 4. Execute the launcher. You will see that the JRE-level args are used, instead of the launch configuration args. More information: Filing this as a bug b/c the behavior is counterintuitive. The launchers should act as overrides, so their args should be specified first when invoking a VM. Tested and reproducible in both 3.2 and 3.3 builds.
This is a duplicate of <a href="show_bug.cgi?id=138623">138623</a>. The behaviour is still reproducible on 3.4.2 (M20090211-1700). IMO a fix for this bug would be quite important. I just spent an hour searching why my launch config parameter is ignored until I stumbled upon the JRE level VM argument which I set months ago and totally forgot about. Giving the launch config arguments preference over the VM level ones would be far more intuitive and less error-prone.
All arguments are passed to the command line. The JRE args are appened to the launch config args, and passed as is without any duplicate handling. The end result is likely VM dependent. For example, here "-Dmy.arg" is specifed in the config as "config" and in the JRE page as "VM". C:\jdk1.5.0_13\bin\javaw.exe -Dmy.arg=config -Dmy.arg=VM -Dfile.encoding=Cp1252 -classpath C:\eclipse-dev\keep-trying\Junk\bin Args The relevant code is in org.eclipse.jdt.launching.AbstractVMRunner, in the method combineVmArgs(...). Patches/contributions welcome :-)
Created attachment 217158 [details] Patch for org.eclipse.jdt.launching.AbstractVMRunner The plugin version I used is org.eclipse.jdt.launching_3.6.1.v20111006_r372.jar, but the patch works for me for other versions, too. I created a test class that tries to allocate an int buffer using int buf[] = new int[64 * 1024 * 1024]; When having -Xmx32m as default VM arguments, I get an OutOfMemory exception. Setting -Xmx128m as launcher arguments, the allocation works fine, launcher arguments take precedence now.
*** Bug 138623 has been marked as a duplicate of this bug. ***
Created attachment 217166 [details] updated patch The original patch would not apply to git, so I created this one that does. Also corrected the license header to properly attribute the fix to Pascal.
Pushed patch to master: http://git.eclipse.org/c/jdt/eclipse.jdt.debug.git/commit/?id=204323c43b663ffa955236e09de25fae120111c7 Thanks for the fix Pascal!