Switching Between Java Versions
- Kimone Premlall
- Mar 31, 2020
- 1 min read
Updated: Apr 8, 2020
Switching between java versions should be easy. On Macs you just install something like jenv and switch between versions. On Windows you write some script that makes it really simple. But, when you work for a company with lots of rules and restrictions, it may not be that easy for you to write, install and/or configure all these fancy tools and scripts.
This should work on both Mac and Windows. Download the Java JDK that you need and switch between both on your IDE. I use IntelliJ, which lets me choose which SDK I want to use.
I first downloaded Java 11 and Java 8. Then went to File > Project Structure > Platform Settings > SDKs. From there I could switch between Java 1.8 and Java 11.
In the Project Settings > Project tab, change the Project SDK to Java 11.
In Project Settings > Modules, in the Sources tab, change the Language Level to 10 (change the Language Level to 8, when using Java 8).
Under the Dependencies tab, change the Module SDK to Java 11.
And that's how I switch between Java 8 and Java 11 without having to deal with company restrictions.
Comments