Saturday, April 27, 2024
 Popular · Latest · Hot · Upcoming
8
rated 0 times [  8] [ 0]  / answers: 1 / hits: 30774  / 3 Years ago, sun, august 15, 2021, 11:16:42

I have installed both OpenJDK 6 and 7. When I run "java somefile" from the command line, OpenJDK 6 is invoked. I do not want to change this default behavior. What command can I use to run my non-default OpenJDK 7 installation instead?



(I am used to running "python somefile" to invoke the default Python, "python2.7 somefile" to use Python 2.7 specifically and "python3 somefile" to use Python 3 specifically.)


More From » java

 Answers
7

You could bind an alias to the specific java versions. Just add the following lines to your $HOME/.bashrc:



alias java6='/path/to/java6/bin/java'
alias java7='/path/to/java7/bin/java'


Same for javac and you should be fine ;-)


[#35739] Tuesday, August 17, 2021, 3 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
izecaptur

Total Points: 113
Total Questions: 102
Total Answers: 114

Location: Northern Mariana Islands
Member since Fri, Jan 15, 2021
3 Years ago
;