3

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.

Comments
  • 2
    Www.stackoverflow.com

    Jk, i don't give a shit about java
  • 2
    @mundo03 +1 being helpful
  • 1
    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
  • 0
    If 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.
  • 1
    What 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.
Your Job Suck?
Get a Better Job
Add Comment