Custom JDK options , how to make them default to be picked up by the app

Having trouble installing Oxygen? Got a bug to report? Post it all here.
tarinisunil
Posts: 9
Joined: Thu Mar 04, 2021 9:19 am

Custom JDK options , how to make them default to be picked up by the app

Post by tarinisunil »

Hi I have some custom JDK options which are required by my custom plugin. (need access to some private api in java)
I am using oxygen 24.1. I have written them in the env.sh/env.bat and oxygenAuthor.sh/oxygenAuthor.bat

As i see the script env.sh is picked up by the script oxygenAuthor.sh/oxygenAuthor.bat
But they are not working if I double click on the .app or .exe.
Is there a way i can make env.sh to be used even with the .app or .exe so that i dont have to open oxygen by the script but I can use the shortcut or the default exe ?
adrian
Posts: 2855
Joined: Tue May 17, 2005 4:01 pm

Re: Custom JDK options , how to make them default to be picked up by the app

Post by adrian »

Hello,

If you have added them to the env.sh/env.bat files, then they are picked up by all other .bat/.sh scripts.
I'm afraid env.sh/env.bat cannot be made to be used with the .app/.exe launchers. .app and .exe launchers work differently.

The .exe launchers have a corresponding .vmoptions file. If you want to add custom Java options to all .exe launchers, create a file named custom_commons.vmoptions and specify them one argument per line.

For .app files it's a bit more complicated. I'll come back with a solution for that one.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
adrian
Posts: 2855
Joined: Tue May 17, 2005 4:01 pm

Re: Custom JDK options , how to make them default to be picked up by the app

Post by adrian »

Regarding the .app files, this is undocumented but install4j provides this out-of-the-box. You can create a file named "vmoptions.txt" (similar to the .vmoptions files, one argument per line) and copy this file to the .app/Contents folder. This only works on a per app basis.

If you want to set all the options from a single file, there's a trick that can be used to point to the same custom_commons.vmoptions file.
Copy/create the custom_commons.vmoptions file in the Oxygen folder.
Change directory to each .app/Contents folder and create there a symbolic link named vmoptions.txt that indicates the custom_commons.vmoptions file located in the Oxygen folder (two levels up).

Code: Select all

ln -s ../../custom_commons.vmoptions vmoptions.txt
Thus all apps will load the options from the same custom_commons.vmoptions file, so you only have to modify that one file.

I guess you can further modify the the env.bat/env.sh scripts to load the options from the same custom_commons.vmoptions file, so that all options are kept in a single place.

Regards,
Adrian
Adrian Buza
<oXygen/> XML Editor, Schema Editor and XSLT Editor/Debugger
http://www.oxygenxml.com
Post Reply