• 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 Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

Getting an error message upon writing my first main() method after typing javac Zoo.java

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello All, I am new to Java. I am using OCA Study Guide by Boyarsky and Selikoff and I am on page 6 (Chapter 1). I was unsure which editor to use to write a Java Program so I downloaded notepad++ and I typed this code:-



I save as file in my Downloads folder as Zoo.java

Then I use command prompt to CD (change directory) into my Downloads folder where I see my Zoo.java file and I type javac Zoo.java

However, I get an error message such as 'javac' is not recognized as an internal or external command, operable program or batch file.

Any help/feedback would be appreciated? Also, what other tool or editor should i download to run java programs?
 
Marshal
Posts: 80634
471
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch

I think NotePad++ is very good. If you are still at the stage where you are getting that error message, maybe you shouldn't be using a cert exam study guide. Consider a more basic book, e.g. Head First Java by Bates and Sierra (O'Reilly, 2005). Because it is an old book, be sure to get a second‑hand copy.
That error message is almost always caused by not setting your PATH environment variable correctly. It only occurs on Windows®. Can you remember the folder where you installed Java®? It will probably be something like C:\Program Files\Java\jdk1.8.0.122, in which case you need to add "C:\Program Files\Java\jdk1.8.0.122\bin"; to the beginning of the current PATH; if you use Win10, it goes on a line by itself and probably doesn't need the ; ut it probably does need the quotes.
Have a look at our FAQ,
 
aku pat
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for your post Campbell Ritchie. I haven't installed the Java Development Kit. I went to the wikipedia page of JDK and clicked on this link: https://www.oracle.com/technetwork/java/index.html and I see a bunch of Java Software to download under new and top downloads. I am unsure which one to download. My best guess is the JDeveloper and ADF. Please advise.

Also, you mention not using a cert exam study guide. How basic is Head First Java? I have prior experience coding in JavaScript. Would that be enough to use this cert exam study guide or do i still need to get Head First Java? I appreciate your feedback.

 
Rancher
Posts: 4801
50
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
https://www.oracle.com/technetwork/java/javase/downloads/index.html

That's the Java download page.
You want one of the JDK ones.
The current (just released) is 13.
 
aku pat
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Dave Tolls for the Java Download Page URL.
 
Sheriff
Posts: 7126
185
Eclipse IDE Postgres Database VI Editor Chrome Java Ubuntu
  • Likes 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This is a good Wiki on how to setup your environment for your first program:

https://coderanch.com/wiki/659740/create-Java-program
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic