iq tech
iq tech

Reputation: 99

Can we run multiple java versions in parallel for different purposes?

I am using Elasticsearch which uses Java 8. I also want to install kafka on the same machine but kafka uses java 11. Both services are to be run in parallel. Can anyone tell how can I run both java versions at same time?

Upvotes: 2

Views: 7155

Answers (2)

Ashish Patil
Ashish Patil

Reputation: 4604

Once you download different versions of JRE(java runtime environment) to your local, if you use Eclipse IDE, you can checkout different projects in single workspace & specify Java Build Path with JRE version you want.

This way, you can run multiple applications having different versions of Java. I think other java IDEs also have this kind of support.

Upvotes: 1

JayC667
JayC667

Reputation: 2576

  1. Manually download and unpack Java
  1. Instead of simply starting java with the
  • java -args commandline,
  • you can start it via /install/path/to/java/bin/java -args
  • or, for windows, use C:\install\location\bin\java.exe -args

You might want to make some start scripts / batch files for that, depending on the exact requirements of your system and Elasticsearch and kafka and possibly other software.

That's it.

one little addition:

If you can NOT directly call java, or the software starts more java apps via the 'default' java, you can also use scripts to manipulate the PATH variables of your system before starting the app. Then you (and your apps) can simply call java -args again.

Upvotes: 3

Related Questions