How do I change the Java version in a terminal session? I don't want to change my system preferences, or my default JRE/JDK. Only for the current terminal session. My OS is Mac OSX, but for completion you might as well specify Windows and Linux.
Asked
Active
Viewed 209 times
1
-
Are you using linux? – lealceldeiro May 01 '19 at 13:39
-
1which OS you have? this is a solution for Windows: https://blogs.oracle.com/pranav/switch-between-different-jdk-versions-in-windows this is for Mac: https://gist.github.com/ntamvl/5f4dbaa8f68e6897b99682a395a44c2e – Adi Ohana May 01 '19 at 13:39
-
1And this is for linux: https://stackoverflow.com/questions/49507160/how-to-install-jdk-10-under-ubuntu/53083341#53083341 – lealceldeiro May 01 '19 at 13:40
-
My OS is Mac OSX – bohemian May 02 '19 at 14:10
-
@Mark Rotteveel Not a duplicate! The linked question asks for a way to change the DEFAULT compiler. I want to change it for just the current session. – bohemian May 07 '19 at 14:09
-
It is the same, just don't put it in your .bash_profile. – Mark Rotteveel May 07 '19 at 14:20
-
Fine, but no answer on the linked question mentions that. It's a different question, and should be answered independently – bohemian May 07 '19 at 15:36