What to do if you can't find the JDK you put in SDKMAN after migrating from bash to zsh on macOS

from bash to zsh

From macOS Catalina the default shell has changed from bash to zsh.

I had bash installed separately with Homebrew, so even if I updated the OS, it didn't change from bash.

However, I thought that the thing was a trial, so I changed it to zsh manually.

Without Java! ??

However, when I use Maven, I am told that there is no Java.

Error message


$ mvn clean package
Unable to find any JVMs matching version "(null)".
No Java runtime present, try --request to install.
No Java runtime present, requesting install.

The dialog also says "You need to have the JDK installed to use the" java "command line tools." スクリーンショット 2019-10-27 17.26.19.png

I installed the JDK using SDKMAN when I was using bash. I was able to use it without problems when I was in bash.

Countermeasures

When SDKMAN was installed during bash, the following description was added at the end of ~ / .bash_profile.

~/.bash_profile



#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
export SDKMAN_DIR="/Users/username/.sdkman"
[[ -s "/Users/username/.sdkman/bin/sdkman-init.sh" ]] && source "/Users/username/.sdkman/bin/sdkman-init.sh"

Replace username with your username

Copying this description and adding it to the end of ~ / .zshrc fixed the problem!

Recommended Posts

What to do if you can't find the JDK you put in SDKMAN after migrating from bash to zsh on macOS
What to do if you can't install the plugin from the Eclipse marketplace
What to do if you can't get the text of an element in Selenium
What to do if you can't find your API key after deploying to Rails heroku
What to do if you can't use the rails command
What you need to do to open a file from the menu in the document-Based App macOS app
What to do if you forget the root password in CentOS7
What to do if you can't activate the select box created by bootstrap-select
What to do if you have installed Java for OS X on macOS
What to do if you get a javax.net.ssl.SSLHandshakeException: Remote host closed connection during handshake in the IBM JDK
What to do if the Rails server can't start
What to do if you get the error Couldn't find Item without an ID
What to do if you get a java.io.IOException in GlassFish
What to do if you enable UFW on Ubuntu VM on GCP and you can't connect to SSH
What to do if you don't see the test code error message in the terminal console
[Rails] What to do if you accidentally install bundle in the production environment in your local environment
[Rails] What to do if you can't get an error message with the errors method
What to do if you get a gcc error in Docker
What to do if the Rails page doesn't appear in Rails tutorial 1.3.2
What to do if Cloud9 is full in the Rails tutorial
What to do if you get a DISPLAY error in gym.render ()
What to do if you cannot roll back the migration (UnknownMigrationVersionError)
[Rails] What to do if you can't get parameters with form_with
What to do if the image posted by refile disappears after setting a 404 error page in Rails
What to do if Operation not permitted is displayed when you execute a command in the terminal
What to do if you get the error Too long with no output (exceeded 10m0s) on CircleCI
What to do if you get a groovy warning in Thymeleaf Layout
What to do if the background image is not applied after deployment
What to do if the prefix c is not bound in JSP
What to do if you don't like the code generated by swagger-codegen-cli
What to do if you get a MiniMagick vulnerability alert on GitHub
What to do if you install Ubuntu
[Rails] What to do if you get an error saying "Could not find a JavaScript runtime." When executing the rails s command on Catalina
What to do if you have enabled Use the WSL2 based engine in Docker Desktop with insufficient WSL2 installation
What to do if you get Could not save master table to file after importing a project in Eclipse
What to do when you think you can't do Groovy-> Java in IntelliJ IDEA CE
What to do if you get the error message unrecognized selector send to instance "***"
What to do if the changes are not reflected in the jar manifest file
What to do if you get an error on heroku rake db: migrate
What to do if you get To install the missing version, run `gem install bundler: 2.1.4`
What to do if build from command line fails in Android development environment
What to do if the rails server doesn't run out on AWS cloud9
What to do if the server tomcat dies
What to do if you push incorrect information
[Ruby] What if you put each statement in each statement? ??
What to do if you get the warning "Uniqueness validator will no longer enforce case sensitive comparison in Rails 6.1." in Rails 6.0
What to do if the update does not take effect after deploying Rails AWS
What to do if you get a NoClassDefFoundError when trying to run eclipse on Java9
What to do if you get a port error when docker-compose up on Mac
What to do if you cannot execute with the command "Java package name / class name"
[Maven] What to do if you are asked to incorporate a jar that is not in the remote repository into the war
What to do if you select a JRE in Eclipse and get "The selected JRE does not support the current compliance level 11"
What to do if the debug gem installation fails
What to do if rails server can't be stopped
What to do if TextToSpeech doesn't work on Android 11
What to do if you accidentally create a model
If you want to recreate the instance in cloud9
What to do if password authentication fails in Docker/Postgres
[Java] [Spring] What to do if you cannot Autowire with Type Mismatch after annotating Spring Security
What to do if you installed Ruby with rbenv but the version does not change
[Rails Tutorial Chapter 2] What to do when you make a mistake in the column name