Reputation: 362
I have an application running on jdk7 and jboss and i would like to extract all the batch code from it to make it cleaner. I want to create executable spring boot 2 jars and run them separately or at least upgrade to spring boot and the jdk version to 8.
Is it possible to run a spring boot 2 application that requires jdk 8 on a machine that also runs a jboss application on jdk 7 ? how can I specify the jdk version at runtime for an executable jar or war ?
I would like to use a container to solve this but our production team doesn't want that right now. I know there is "setenv" in a tomcat or weblogic servers but i would like to know if there is a spring boot solution for that (I didn't find any)
Thank you in advance.
Upvotes: 3
Views: 4776
Reputation: 3372
You can have as many JVMs as you like on your machine. you just need to have the settings for the java version you need to be loaded.
ie if your java 8 is in c:\programs\java\jdk8\bin
and your java 7 is in c:\programs\java\jdk7\bin
, then you need to specify the java.exe
absolutely as in c:\programs\java\jdk8\bin\java.exe
you also need to set the environment variables for that session, like set JAVA_HOME=c:\programs\java\jdk8\bin\
.
My example is using a windows machine as a base. You will need a startup script, or similar for the environment that you are using.
Note that if you just use java.exe
in your startup script, then the JVM will be started with the first JVM found in your %PATH%
, so you may want to remove Java from the path to be sure that you are getting the exact version you require.
Upvotes: 4