cancel
Showing results for 
Search instead for 
Did you mean: 

Environment variables for Java Applications through Cloud Cockpit

dhorions
Contributor
0 Kudos
906

Hello,

when setting environment Variables as JVM parameters in the Cloud Cockpit, it seems impossible to use these in java application deployed on the tomcat runtime.

Java Code :

logger.info("Environment Variable ENVVAR1 = " + System.getenv("ENVVAR1"));

Log Ouput :

Is there another way to set environment variables, or is there a better way to pass parameters to a java application on hcp?

Thank You,

Dries

Accepted Solutions (1)

Accepted Solutions (1)

anton_levin
Product and Topic Expert
Product and Topic Expert
0 Kudos

Hi Dries,

those you set in Deployment Popup are java system variables and should be accessed with System.getProperty(name)

If you want to use env variables you have to set them with neo console tool (mean -> deploy WAR not from UI but with command line). See --ev argument [1]

Regards,

Anton

[1] SAP HANA Cloud Platform

dhorions
Contributor
0 Kudos

Thanks! That worked perfectly.

Answers (1)

Answers (1)

ChrisPaine
SAP Mentor
SAP Mentor
0 Kudos

Hi,

I have used custom properties on a destination and used the destination api to read them. Works well and easy to view what has been set.

Cheers,

Chris

dhorions
Contributor
0 Kudos

Thanks, that's a very good solution if the parameter is relevant for one specific connection.