How to set system property in

Hello community,

I am using ssl for jdbc-application. It works fine in my small application. Now, I try to use it for my cuba-project. In my small application (not cuba), I just set the…) and did a connection using jdbc etc.

But as I know, I need to use gradle in

In fact, I just have to configure this two properties:

System.setProperty("", "pathToMyTrustStore");
System.setProperty("", "Password"); 

The trustStore for ssl is in the meta-inf folder.

So, when I try to make a connection on the browser with cuba-studio to my database, I will always get an problem to connect to my database. So, I think I have to modify the code first, with the Properties and then, the connection will be working?!

Because, if I dont use the certificate, I will get an “Access denied”.

Thanks a lot

Hello, @spamhater.alex

You want to set these properties for your instance of CUBA Studio, am I right?


Hello @tsarev,

yes, thats right.
I try to make a connection to my database in cloud, and its failed, because I had to use ssl. When I start to use ssl in a test application, it works now, but there I use simple Java-code with…) and jdbc connection, where the System.Properties have a path to my truststore, which I put in meta-inf folder.

I started on browser, and I can not make a connection to my cloud-database. So, I assume, that I have to “code” it, like I told above and configure the system properties, that it will also work on cuba.

Thats why I am asking for help, that I hope, that I can make the connection to my database in, after I configure the system properties for ssl.

Thank you

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: