Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » Oomph » JRE Task Default VM Arguments
JRE Task Default VM Arguments [message #1840304] Mon, 12 April 2021 08:22 Go to next message
Sascha Zur is currently offline Sascha ZurFriend
Messages: 8
Registered: February 2021
Junior Member
Hi all,

in my Oomph project I have added a JRE task to set a default JRE with default VM arguments. The arguments contain a variable for a path that must be set:

<setupTask
xsi:type="jdt:JRETask"
id="default.project.jvm"
version="JavaSE-1.8"
location="${jre.location-1.8x86}"
name="JavaSE-1.8 JRE x86"
vmArguments="-Dpath=\&quot;${variable.path}\&quot;">
<description>Set default JVM in Eclipse</description>

After installing everything, this works as intended, the JRE is set and the default arguments are also correct.
Now there might be the case that this path should be changed. For this, the User should only go to Window->Prefrences->Java-> Installed JREs and change this default VM argument.
Unfortunately, after restarting Eclipse, the VM arguments are rewritten with the old path followed by the new one.
So for example:
After installation: -Dpath "C:\Test"
After manual change: -Dpath "C:\Other"
After restart: -Dpath "C:\Test" -Dpath "C:\Other"

Is there a way to disable the JRE task once it has been completed? I think that way, the user changed path should not be rewritten.

Otherwise, is there an option to prevent the task from appending the old string to the arguments, so that after a restart only one "-Dpath ..." is in the default arguments?

Regards,
Sascha
Re: JRE Task Default VM Arguments [message #1840310 is a reply to message #1840304] Mon, 12 April 2021 09:51 Go to previous messageGo to next message
Ed Merks is currently offline Ed MerksFriend
Messages: 32110
Registered: July 2009
Senior Member
Yes, I see there is merging of the arguments. We probably should do a better job with the merging so that it's more like what we do for an Eclipse Ini task. After all there should be not be more than one -Dxxx=... But in this case, doesn't the last one "win"? It's impossible to say in general if the value in the JRE is one the user edited or one that we there because of a previous perform of the JRE task.

One suggestion to work around this issue is to use a String Substitution task and to define the path's value so that it appears in Window -> Preferences -> String Substitutions as a named variable. Then in your JRE task you would use $${string.substitution.variable.name), i.e., not directly use an Oomph variable but rather a String Substitution variable. And the value for the variable could be prompted so that the user could change it to be different from the default. But I suppose this could have the similar problem of the user changing the preference value and then the String Substitution task overwriting it...


Ed Merks
Professional Support: https://www.macromodeling.com/
Re: JRE Task Default VM Arguments [message #1840317 is a reply to message #1840310] Mon, 12 April 2021 11:12 Go to previous message
Sascha Zur is currently offline Sascha ZurFriend
Messages: 8
Registered: February 2021
Junior Member
Hi Ed,

thanks for your response. So I just tried your suggestions and it works good. I think it will be a good solution, that the users can change the path in the preferences. I didn't think of the string substitution part before :)

Thank you very much!
Previous Topic:setup content assist
Next Topic:index:/org.eclipse.setup fails to resolve with 2021-03
Goto Forum:
  


Current Time: Wed Dec 01 22:35:06 GMT 2021

Powered by FUDForum. Page generated in 0.02350 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top