"java -version" doesn't work

Started by
1 comment, last by Alberth 4 months, 1 week ago

I installed this version of IntelliJ:

  • IntelliJ IDEA 2023.3.1 (Community Edition)
  • Build #IC-233.11799.300, built on December 12, 2023
  • Runtime version: 17.0.9+7-b1087.7 amd64
  • VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o.
  • Windows 11.0
  • GC: G1 Young Generation, G1 Old Generation
  • Memory: 2048M
  • Cores: 12
  • Registry:
  • ide.experimental.ui=true
  • Kotlin: 233.11799.300-IJ

It installed some version of OpenJDK when I installed it.

I have been building and running java programs for a few days now.

However, if I go the command line, the following happens:

java -version

'java' is not recognized as an internal or external command,

operable program or batch file.

javac -version

'javac' is not recognized as an internal or external command,

operable program or batch file.

Any ideas why these commands aren't working?

I did a Windows 11 search for "javac", and it doesn't seem to find anything.

Thanks.

Mike C.http://www.coolgroups.com/zoomer/http://www.coolgroups.com/ez/
Advertisement

I haven't touched a Windows machine in about 20 years but as far as I remember the command-line has a PATH environment variable that contains a list of directories that it searches when you type a command. If there is no “java” executable file in any of those directories, you get these kinds of errors eg https://stackoverflow.com/questions/9546324/adding-a-directory-to-the-path-environment-variable-in-windowsin a se​ No idea if this is relevant to your problem though. Likely you need to add a directory provided by JDK into your path.

I also pasted the error message you posted literally as input for a search engine, and one of the answers was : https://stackoverflow.com/questions/15796855/java-is-not-recognized-as-an-internal-or-external-command​ Hopefully it gives you a clue what to do. ←- That trick often works though 🙂

mike74 said:
I did a Windows 11 search for "javac", and it doesn't seem to find anything.

You need to provide more context to get better results since “javac” gets used in many contexts, and most often niet in install context. Search engines kind of get lost in the sea of javacs messages 🙂

Add more words to better specify what you are looking for or what you are trying to do.

Something like “how to install Java at Windows” or so. Quiye often mostly literally asking a question into a search engine gives useful t starting points. You may want to provide more information like a specific windows system or a specific java version. if that is needed, but in this case that may not even be needed as your system en java are common.

This topic is closed to new replies.

Advertisement