-3

i'm installing the JDK in my computer Monterey 12.6.5, the installer runs ok and says its finished but when i go to my terminal and write java ~version and it says zsh: no such user or named directory: version and then i try to install the ambient and doesn't work either. Any thoughts on what may be happening? I downloading the installer from the oracle page, and i'm sure its the correct one. Also the installer let me run it again and again without saying that's already installed or something like that.

I had the JDK installed a while ago and i uninstalled now i cant bring it back.

Thanks for your help.

KompjoeFriek
  • 3,572
  • 1
  • 22
  • 35
  • Have read and tried https://stackoverflow.com/questions/24342886/how-to-install-java-8-on-mac?rq=2 ? – Reporter Jun 07 '23 at 13:00
  • There are many possibilities here. Verify the installation path: Check the installation path of the JDK to ensure it matches the path specified in your environment variables. Make sure that the path is correct. I don't know if that was only a typo, but try `java -version` instead. Check the PATH variable: Ensure that the JDK's bin directory is added to your PATH environment variable. – Eldinur the Kolibri Jun 07 '23 at 13:04
  • You are not mentioning what distribution, version and architecture of the JDK are you trying to install, and the architecture of your computer. – aled Jun 07 '23 at 13:13
  • `~username` is shorthand for the home directory of the user named `username`. You meant to use `-version`. – tgdavies Jun 07 '23 at 13:17

1 Answers1

1

The command actually is java -version. You are using an incorrect tilde ~ character instead of a dash -.

aled
  • 21,330
  • 3
  • 27
  • 34