Setting up of up environment variables is necessary in java so here are some steps for JAVA_HOME environment variables:
1. My Computer icon from start menu >>select properties>> Advanced Tab >> Environment Variables button
2. You will be with System Variable, and then click New
3. You need to then enter variable name as JAVA_HOME
4. You need to enter the variable value as the install path for the Development Kit (C:\Program Files\Java\jdk1.5.0_14\).
5. Click OK >> Apply Changes.
Then you are all set to run the hello world program. I guess you may be having the same program as it is your first program and to run your program, you need to move in the windows explorer and make a directory called c:\test.
If you are not having any java program , I will provide for the same.
Code:
public class HelloWorld {
public static void main(String[] args) {
System.out.println("Hello, World");
}
}
You need to create a file called c:\test\HelloWorld.java with the above content in the notepad.
You also need to set your CLASSPATH environment variable , you will be having an System variable box, and then click on New , then type in CLASSPATH and a period ( . ) into the two text boxes, and then click ok .
Then run your command prompt. Then type in cd \test.
write javac in your command prompt and this will confirm that your setup was installed properly. Then it will have a whole log of some files , Type in javac HelloWorld.java which will state the errors and if that it ok, then you need to Type in java HelloWorld that will execute your program.
Bookmarks