I have a Java application, using a jvm variable. Normally, I set it using a command like
APP_HOME="-DAPP_HOME=$CATALINA_HOME/myapp"
in order to point to the correct folder within my application structure on Tomcat.
Now I am trying to deploy my application to the MicroCloud virtual machine. Once deployed, I use the command
vmc env-add myapp APP_HOME="-DAPP_HOME=$HOME/myapp
to set my variable. But the problem is that the variable is set as a shell variable and not JVM variable. When I use System.getenv(); I can see that my variable is set, but when I use System.getProperty("APP_HOME") the variable is null.
Anyone had experience with this and could recommend what to do set it as a JVM variable on CF?
p.s.
I read all the existing topics on the CloudFoundry Q&A and here on stackoverflow, but I do not see an answer to this problem…
Thank you in advance!
What about
vmc env-add myapp JAVA_OPTS="-DAPP_HOME=$HOME/myapp"(i.e. pass -DAPP_HOME as a property to the JVM)
However, why are you trying to do this – and why is it such a bad idea just to grab the value using getenv instead of looking for a system Property?