![brew cask java versions brew cask java versions](https://lynxsoft.weebly.com/uploads/1/2/5/4/125411562/290064225.png)
The likelihood is the project is now configured to use right Java version, but other tools, such as Maven, may disagree. This seems like a happy ever after love story, but think again, is it though? $ jenv versions # this should list all the available Java versions $ jenv global java8 # this should set Java 8 for the whole dev environment $ jenv locally java7 # this should configure Java 7 for the directory Using jenv is in fact really easy and pleasant with command line. $ jenv add /Library/Java/JavaVirtualMachines/jdk1.8.0_51.jdk/Contents/Home The Java versions are normally installed under /Library/Java/JavaVirtualMachines/. The next important thing is to make sure jenv is aware of the JDKs installed by adding them to jenv.
BREW CASK JAVA VERSIONS INSTALL
$ brew cask install java # this is default to Java 8 Of course, you need to have different Java versions installed, and this is something brew cask will happily handle. $ echo 'eval "$(jenv init -)"' > ~/.bash_profile $ echo 'export PATH="$HOME/.jenv/bin:$PATH"' > ~/.bash_profile bash_profile, it then takes over and finds the right Java version to use globally or in a specific directory. How jenv works is by setting up a shim in your home directory, and by adding the following lines to your. Obviously, jenv is a Java version managing tool. After few digging, it is not hard to find out brew is surely not the tool for this kind of job.
![brew cask java versions brew cask java versions](https://i.etsystatic.com/5819591/r/il/67266d/2406993647/il_fullxfull.2406993647_f7ge.jpg)
Initially, I was hoping brew would be able to magically sort out this problem for me.
![brew cask java versions brew cask java versions](https://pbs.twimg.com/media/FCOS3LkX0AUDrqw.png)
Lucky you if you have to use both Java 7 and 8 for different projects on the same dev box. This time, I wish to offer some insights into solving the problem on Unix/Linux from my perspective, as well as some practical solutions to lift this concern. Especially if you have legacy projects written in Java 7, while you want to take advantages of what Java 8 has to offer, switching between versions is an absolute hell. As many would have experienced, Java version is one of the most common problem when developing software, and probably the most painful type.