How to set system property in

Okay, so you can pass these values to the STUDIO_OPTS environment variable in the following way:


okay, thanks, but where I have to pass it? Which file?

Thanks a lot

Because I dont want to pass it to my environment variables, I want to set in gradle and put the truststore in the project folder in Web-Inf.

but where I can find the place, or where is the STUDIO_OPTS variable?

There is no way to pass these options via Gradle build file now. The only way is to setup environment variables.

@tsarev okay, thanks I understand now.
But is there an other way to set system properties? Is there something like a main-class in cuba?


Unfortunately no, there is no another way to pass some settings to CUBA Studio.

@tsarev thanks, I see.
The problem is, that if I set the environment variable _JAVA_OPTS with the

this arguments will be not set in my computer. Because, I run a small application and set the system properties with System.set(…), when I put this arguments as environment variable and call the method:


I will get the value null

Do you have a hint, why this option is not set by the environment variable?

Thank you

Please clarify, are you using _JAVA_OPTS as a name of env variable or it is a typo?

And if you want to pass your settings only to CUBA Studio I recommend you to use the STUDIO_OPTS variable.

Could you describe how you’ve set up the env variable and clarify what operation system you are using?

I use _JAVA_OPTIONS as system variable and I use windows 10 Enterprise, I would like to use this option for all application, not Cuba only.

Okay, so you should setup your variable in the following way:


Pay attention to the name of variable - it doesn’t have leading underscore


Unfortunately, I still get null when I call the getProperty(..) method.
Is there a way, to see, which Java_options will be used? For example in this eclipse.

Because I only try this:


but get null

but in fact, I set password and truststore-file path

When I call in cmd:

echo %JAVA_OPTS%

I get the path to truststore and the password for it.
But my eclipse app, throws null when I call the method above :confused:

@tsarev, I just restart eclipse and try it again :open_mouth:

And it works! Thank you! You are great!

I want to ask, if you have a tip for me, how I should set ssl, when I deploy this app and put on server? Because the path to my certificate is just local.

Yes, you have to restart Eclipse to apply changes. The reason is that all your variables are read once before starting any application.

You are welcome!

And please create a new topic for the second question.



if I only want to use this variable for Cuba instance, I should set STUDIO_OPTS variable?
And where will the cuba application “know” that he have to use studio_opts instead of java_opts variable?


Because, when I try to go in my cuba project, I get an error and can not come in my project:

Yes, to setup your variables only for CUBA Studio you should use the STUDIO_OPTS variable.

All values from both variables will be loaded, but values that are defined in STUDIO_OPTS will override values defined in JAVA_OPTS

But just for interesst, in which file, or where the instance variable will be set, or where it will be loaded, in which file, STUDIO_OPTS and JAVA_OPTS will be loaded?


They are loaded in studio/bin/studio.bat and in studio/bin/studio files for Windows and Linux operating systems respectively.