-5

To begin with I carefully copied and pasted the pathway for javac into the System Variable Editing box in Advanced System Settings, making sure to carefully put it at the beginning and placing a ; after bin, before the other parts.

Then I followed the Oracle tutorial for the HelloWorldApp to the letter, setting up a my application folder and creating a notepad file inside.

Subsequent to all this, I opened the command shell in windows and punched in my script; hit dir; got the spiel about files and such; entered javac HelloWorldApp.java to only end invariably with:

"Javac not a recognised command"

Arrgh what am I doing wrong? Is it, as I suspect--that the Java SE12 isn't loaded properly (there is no .exe after my javac file).

  • Am I not saving the notepad file correctly? (ie HelloWorld?)
  • Am I not editing the path for the javac compiler properly?

1

norbjd
  • 10,166
  • 4
  • 45
  • 80
D.Perez
  • 1
  • 2
  • 2
    You forgot to add your screenshots. With that little detail, we can only guess, which is outside of the frame defined by [answer]. Your question might get down-voted or closed, please see [ask], thanks. – Zabuzard Apr 12 '19 at 17:15
  • 1
    Can we see your path entry? Looks like you're on Windows 10 and you wouldn't need to add the ; as Windows 10 does that for you. – dimwittedanimal Apr 12 '19 at 17:54
  • After editing the Path environment variable, you might want to restart the computer for it to reread the added entry – Trash Can Apr 12 '19 at 17:54
  • Yes we need more information on question and I understand your frustration. Try giving screenshots and meanwhile as a workaround, instead of javac HelloWorldApp.java try giving HelloWorldApp.java. For example if javac is in C:\jdk\bin\ then give C:\jdk\bin\javac HelloWorldApp.java – Praveen E Apr 12 '19 at 17:56
  • 2
    @AlmostHandsome: There's no need to reboot. Just restarting the command prompt is fine. – Jon Skeet Apr 12 '19 at 17:57
  • 2
    `javac` is an executable file placed under the `bin` folder for your **JDK** installation. The first thing to check, is that you installed a JDK. If you have a "simple" JRE, `javac` is not included. Go to the folder where Java is installed, then under `bin`, and check if `javac.exe` is present. – Daniele Apr 12 '19 at 18:08
  • 1
    Then, check if `javac` is available from the command line by using `javac -version`.. It should print something like `javac 1.8.0_60`; if `javac` is not found, you have to double check your `%PATH%` variable. – Daniele Apr 12 '19 at 18:10
  • @JonSkeet Last time what you said did not do it for me, had to kill the current session by logging out and in again – Trash Can Apr 12 '19 at 18:14
  • @AlmostHandsome: If you've set environment variables via the control panel applet, a new command prompt definitely picks them up. I do that regularly. – Jon Skeet Apr 12 '19 at 18:30

1 Answers1

0

The first step will be to verify Java is set up correctly.

  1. Open the command prompt.
  2. Type "java -version".
  3. Press enter. This should return the version of java you are running. Something like: java version "1.8.0_151" Java(TM) SE Runtime Environment (build 1.8.0_151-b12) Java HotSpot(TM) 64-Bit Server VM (build 25.151-b12, mixed mode)

  4. Add the path to java to your system path.

enter image description here

See these two links if you have trouble adding java to the system path.

https://warwick.ac.uk/fac/sci/dcs/people/research/csrcbc/teaching/howto/javapath/

Environment variables for java installation

  1. Once this is set try "java -version" again. (make sure to open a new command window) Only after this works try the "javac" command.
Jortega
  • 3,616
  • 1
  • 18
  • 21