HI there,

sorry, this is an incredibly basic problem, its just confusing me no end - no previous programming experience and trying to get my head round java - i have followed some guides for the source code and have came up with the following to display 'welcome to java!' in the command prompt.

-----------------------
// Welcome.java: This application program prints Welcome to Java!
public class Welcome {
public static void main(String[] args) {
System.out.println("Welcome to Java!");
}
}

----------------------

The problem i now have is after installing JDK 1.4 on my machine, the 'javac' command (to compile the source code??) does not seem to be working, i.e. 'c:\Documents and Settings\Paul>javac Welcome.java' is unrecognised.


I know the commands or file organisation are wrong, but im really not sure how or why :sad:

Any help would be greatly greatly appriciated!

cheers,


paul

Hi Paul,

The problem is that javac is not in your path. To add it to your path, first find where javac is. For me this is in C:\Program Files\j2sdk_nb\j2sdk1.4.2\bin. Yours may be different. (See picture 1 _javac.JPG).

Then, you should go to your Control Panel, and goto Performance and Maintenance if you have it, then open System. (see control panel.JPG) Under System you should see Environment variables. (see environment variables.JPG) Click there. You should then see something like my 3nd attached screenshot "environment variables2.JPG". Goto Path and hit edit. Add to the end of your path this "; C:\{PATH_TO_YOUR_JAVA}\bin\

Hope this helps!


Ed

Attachments control_panel.JPG 61.01 KB environment_variables2.JPG 39.6 KB _javac.JPG 60.95 KB

Thank you very much!

I've managed to create a few cool little dialog box programs now!

many many thanks!!! :)

This article has been dead for over six months. Start a new discussion instead.