Ranter
Join devRant
Do all the things like
++ or -- rants, post your own rants, comment on others' rants and build your customized dev avatar
Sign Up
Pipeless API
From the creators of devRant, Pipeless lets you power real-time personalized recommendations and activity feeds using a simple API
Learn More
Comments
-
This depends entirely on your operating system. In the Ubuntu/Debain world, etc-alternatives is the system used to select which Java version is used throughout your system. In Gentoo, it's eselect.
The easiest way to peg your application to a Java version is to use Docker. Find a plugin for your particular build system (gradle, sbt, maven, etc.) that will build containers for you and let your specify the base image.
..and yes, as other replies state, you should really be asking this on StackOverflow. :-P -
Wack61916yIf the app doesn't use a gui, then probably the easies solution would be to run it in a docker container. Otherwise you could have different versions installed and run that program with a particular version. Another option would be to have a VM with that version installed, possible with source folder sharing.
-
deodexed5736yWhat a complicated solution you're all giving for such a trivial task.
Just install both and modify the symlink to be: javadev and javaprod instead of just java. Careful when installing via packet managers it will override your changes.
Is there a way to run a Java app with a specific version even if I have several installed?
For example: I have 8_151 for development, but on the client side they use _181. (I don't use it because it causes problem with JavaFX components). So I want to make my app to run specifically over _151 even if the client have another newer version installed.
question