Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 335926

Summary: Eclipse does not save VM arguments in Run Configuration
Product: [Eclipse Project] JDT Reporter: stu <stu24mail>
Component: DebugAssignee: JDT-Debug-Inbox <jdt-debug-inbox>
Status: RESOLVED NOT_ECLIPSE QA Contact:
Severity: normal    
Priority: P3 CC: curtis.windatt.public
Version: 3.7   
Target Milestone: ---   
Hardware: PC   
OS: Linux   
Whiteboard:
Attachments:
Description Flags
Run Configuration Screenshot none

Description stu CLA 2011-02-01 02:31:46 EST
Build Identifier: M20100211-1343

When I add new the VM arguments under Run Configuration -> Arguments -> VM arguments, they are not saved. Not only that, but eclipse seems really aggressive about refusing them. I tried:

- adding new arguments via the gui. I can hit "Run", and it runs with those arguments, but reverts the values for any future run.

- adding new arguments directly into key="org.eclipse.jdt.launching.VM_ARGUMENTS" item in the .launch file. Eclipse loads it on the next launch, but then overwrites it, and you lose the arguments.

I finally just removed the write permissions on the .launch files, but this doesn't seem like the best solution.

I have a google around and searched bugzilla. I find it hard to believe I'm the first to encounter this issue, so maybe I'm just searching wrong? 

I realize that it's probably just some random setting I have going on, but after screaming at eclipse for a couple days, I give up. Whatever it is, it shouldn't be this difficult.. It's a bug...

Reproducible: Always

Steps to Reproduce:
1. Add an additional VM argument in the Run Configuration, for example:
change:
-Xmx512m
to:
-Xmx512m -javaagent:/home/stu/.eclipse/org.eclipse.platform_3.5.0_155965261/plugins/com.google.appengine.eclipse.sdkbundle.1.4.0_1.4.0.v201012021500/appengine-java-sdk-1.4.0/lib/agent/appengine-agent.jar
2.Run the application (as a web application)
3.Shut it down, and try to run it again: the additional -javaagent argument is now gone, and it doesn't run :(
Comment 1 Curtis Windatt CLA 2011-02-01 11:05:25 EST
Are you creating a java launch configuration?

I just tried the following and the arguments were saved:
1) Create a java launch configuration
2) Run it
3) Shut down the program and open the launch config
4) Set an argument or two (-XmX512M)
5) Launch it again
6) Shut it down
7) Open the launch config
Result:
Added arguments are still there
Comment 2 stu CLA 2011-02-01 14:25:14 EST
Created attachment 188072 [details]
Run Configuration Screenshot
Comment 3 stu CLA 2011-02-01 14:29:57 EST
I think this would be a web application configuration. I've attached a screenshot. 

Note the the VM arguments start with a default of -Xmx512m, but any other arguments I add (as in the -javaagent: example), are cleared out.

I was confused on whether to report this here or under GWT, but since the VM arguments tabs seem to be a generic eclipse option, and launch files are stored under .metadata/.plugins/org.eclipse.debug.core - it seemed to be more in eclipse then GWT?
Comment 4 Curtis Windatt CLA 2011-02-01 14:39:31 EST
(In reply to comment #3)
> I was confused on whether to report this here or under GWT, but since the VM
> arguments tabs seem to be a generic eclipse option, and launch files are stored
> under .metadata/.plugins/org.eclipse.debug.core - it seemed to be more in
> eclipse then GWT?

The tab is available for other launch configs to use.  However, in your case something is overwriting the stored argument.  I suspect that somewhere in the GWT launcher there is code that sets the arguments to the default.

Since you say that the launch config always gets a default setting of -XmX512M, I would start looking at how that default is set.

This works fine in the Java application launch configs and Eclipse Application launch configs.
Comment 5 stu CLA 2011-02-01 14:52:43 EST
(In reply to comment #4)
> (In reply to comment #3)
> > I was confused on whether to report this here or under GWT, but since the VM
> > arguments tabs seem to be a generic eclipse option, and launch files are stored
> > under .metadata/.plugins/org.eclipse.debug.core - it seemed to be more in
> > eclipse then GWT?
> 
> The tab is available for other launch configs to use.  However, in your case
> something is overwriting the stored argument.  I suspect that somewhere in the
> GWT launcher there is code that sets the arguments to the default.
> 
> Since you say that the launch config always gets a default setting of -XmX512M,
> I would start looking at how that default is set.
> 
> This works fine in the Java application launch configs and Eclipse Application
> launch configs.

Ok. Cool. This is homebrew project - so I'll be looking at it tonight.. I'll update when I get more information. 

For now, I'll mark this resolved, and re-open if I get more information - is it bad form to update bugzilla with the solution even if it's not eclipse related? As long as I re-open & then close it out right away?
Comment 6 Curtis Windatt CLA 2011-02-01 14:56:29 EST
(In reply to comment #5)
> For now, I'll mark this resolved, and re-open if I get more information - is it
> bad form to update bugzilla with the solution even if it's not eclipse related?
> As long as I re-open & then close it out right away?

I wouldn't reopen the bug and then re-close it.  Just add your fix to the comments.  You can also add the keyword "readme".