I'm sorry if this request seems rather basic, but i am trying to teach myself Java from a book called "Java made simple" by author P.K.McBride.
I followed all the instructions to the letter, I downloaded and installed SDK from java.sun.com, and then i created the necessary .BAT file in notepad and set the PATH to my working folder. Then I saved the file into the Windows folder as GOJAVA.BAT This allows me to goto my working folder from the DOS prompt by just typing gojava SO far so good !! The FIRST task asks you to compile an example using the command "javac", again i followed all the steps. It tells you to type at the DOS propmt "javac Hello.java", in order to compile the text i wrote in notepad and saved in my working folder as "Hello.java"
I get an error message saying....
'javac' is not recognised as an internal or external command, operable program or batch file.
Can anyone help me please..??
Note.. The pictures in the book show Windows 98 as the OS I am using XP pro not sure if that makes a difference..??
You need to include the bin folder under SDK main folder in your PATH environment variable. I am assuming that you always execute your gojava.bat before compiling your program. Suppose you have installed your SDK in c:\java2 folder. Then javac.exe resides as c:\java2\bin\javac.exe. Now you need to include c:\java2\bin in your PATH. in gojava.bat file you can include a line as: SET PATH=%PATH%;c:\java2\bin .....Here goes rest of your code.....
Now when you type javac your_file_name.java then you won't get any error message as you were getting.
Alternatively, you can type the full path of javac to compile your java classes as; c:\java2\bin\javac your_file_name.java
You may also want to set this PATH permanently for yourself. For windows 95/98 you set it in autoexec.bat file. For NT/2000/XP you set it as Start -> Control Panel -> System -> Advanced (Tab) -> Environment Variables (Button)