• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Head First Java - Initial Set Up

 
Greenhorn
Posts: 5
Android Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I am just starting on my path and I have followed the original instructions to create the path etc.....  I have then gone to the CMD and typed javac -version and java -version and i get "is not recognized as an internal or external command,
operable program or batch file." command line.

I am unsure of what i am doing incorrect at this stage....

any help would be appreciated
 
Bartender
Posts: 5897
57
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I assume you're on Windodws. What version of Java did you install? Are you familiar with how to modify environment variables?
 
terry snelling
Greenhorn
Posts: 5
Android Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

Yes using windows 10.  I have installed 12.0.1 version of Java.  I have amended the Environment Variables as per another post on here.  that is when i get this message

The link for the post is below so you can see what i have been following

https://coderanch.com/t/696444/java/Head-Java-set#3316530

The path has been set to %JAVA_HOME%\bin;%USERPROFILE%\AppData\Local\Microsoft\WindowsApps
 
Carey Brown
Bartender
Posts: 5897
57
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
 
Carey Brown
Bartender
Posts: 5897
57
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Carey Brown wrote:Did you add a new environment variable named "JAVA_HOME" ?  If so, what is it set to?


Should be set to:   C:\Program Files\Java\jdk-12

If you're not sure, open up a command line window and type
set JAVA_HOME
 
terry snelling
Greenhorn
Posts: 5
Android Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Carey,

JAVA_Home is set to C:\Program Files\Java\jdk-12.0.1
 
Marshal
Posts: 64622
225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
So you have a C:\Program Files\java\jdk12.0.1 folder? In which case, that JAVA_HOME sounds right. Did you use quote marks when you set the JAVA_HOME directory?
 
Campbell Ritchie
Marshal
Posts: 64622
225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Try these two instructions:-Tell us what you get, and what sort of error message you are getting.
 
terry snelling
Greenhorn
Posts: 5
Android Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

no to quotemarks and this is what i get:

C:\Users\Home>echo %path%
C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\AMD\ATI.ACE\Core-Static;C:\WINDOWS\System32\OpenSSH\;"C:\Program Files\Java\jdk-12.0.1\bin;C:\Users\Home\AppData\Local\Microsoft\WindowsApps";

C:\Users\Home>echo %JAVA_HOME%
C:\Program Files\Java\jdk-12.0.1

 
terry snelling
Greenhorn
Posts: 5
Android Chrome
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

this is the error I am getting

'javac' is not recognized as an internal or external command,
operable program or batch file.

I have tried setting ity from command prompt also
 
Campbell Ritchie
Marshal
Posts: 64622
225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thank you for that information. Unfortunately that error message is all too familiar to us all. See this Java™ Tutorials section, particularly the last part about common problems.
What are you setting at the command line? TryYou may need quotes because of the space in the PATH/JAVA_HOME. You do have some quotes in that PATH printout. Please confirm that you do have the java.exe and javac.exe files in that \bin folder.
Also try (as suggested in the tutorials), with and without the quotes:-
Please put your new PATH to Java® at the beginning of the whole PATH, just in case there is an older version of Java® elsewhere; 12.0.1 is the newest version and you can get problems if your javac program is newer than your java program.
 
Carey Brown
Bartender
Posts: 5897
57
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

terry snelling wrote:no to quotemarks and this is what i get:

C:\Users\Home>echo %path%
C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\AMD\ATI.ACE\Core-Static;C:\WINDOWS\System32\OpenSSH\;"C:\Program Files\Java\jdk-12.0.1\bin;C:\Users\Home\AppData\Local\Microsoft\WindowsApps";

C:\Users\Home>echo %JAVA_HOME%
C:\Program Files\Java\jdk-12.0.1


Two possible problems with this:
1) The double quotes shown in the PATH surround two entries, not just the JDK entry.
2) Have you tried to go to the directory .../jdk-12.0.1? That's not where the JDK installed on my machine.
 
Campbell Ritchie
Marshal
Posts: 64622
225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

A few minutes ago, I wrote:. . . c\:Program Files\jdk12.0.1\bin . . .

and

Carey Brown wrote:C:\Program Files\Java\jdk-12.0.1

Beware. That hyphen can make a big difference. I don't think the difference between c and C is a problem on Windows®.
 
Carey Brown
Bartender
Posts: 5897
57
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:

A few minutes ago, I wrote:. . . c\:Program Files\jdk12.0.1\bin . . .

and

Carey Brown wrote:C:\Program Files\Java\jdk-12.0.1

Beware. That hyphen can make a big difference. I don't think the difference between c and C is a problem on Windows®.


Campbell, is that really the directory where your JDK-12 installed? For me, the JDK installed in a directory named "jdk-12". I was assuming that 12 was following a new naming convention.
 
Campbell Ritchie
Marshal
Posts: 64622
225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Carey Brown wrote:. . . Campbell, is that really the directory where your JDK-12 installed? . . . . I was assuming that 12 was following a new naming convention.

No, at the moment it is in /usr/java/jdk-12/bin/java. I don't usually use Windows®. I think the basic JDK12 installation was called jdk-12 and the next update, which I don't have just at the moment, is in ...jdk-12.0.1/bin.
 
Campbell Ritchie
Marshal
Posts: 64622
225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Sorry, but I appear to have misquoted Carey about the 0.1 bit on the folder name.
 
Carey Brown
Bartender
Posts: 5897
57
Eclipse IDE Firefox Browser MySQL Database VI Editor Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Campbell Ritchie wrote:Sorry, but I appear to have misquoted Carey about the 0.1 bit on the folder name.


Thanks, but I screwed up and showed the directory for JDK-12, you are correct for JDK-12.0.1 which is jdk-12.0.1.

I thought I had updated my environment to 0.1 but on further checking I had not. I thought Oracle was doing some new install conventions where an update would overwrite the directories of the same major release. Guess not.
 
Campbell Ritchie
Marshal
Posts: 64622
225
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Continuing in the long‑standing tradition of introducing new forms of confusion into Java®/Java™ version numbering
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!