The Artima Developer Community
Sponsored Link

Legacy Java Answers Forum
September 2000



This page contains an archived post to the Java Answers Forum made prior to February 25, 2002. If you wish to participate in discussions, please visit the new Artima Forums.



Posted by Sandeep on December 26, 2001 at 12:33 AM

Right sir,
we have to give the PATH for each directory. to avoid this either we can edit autoexec.bat or write the following path statement on the root.

set path=%path%;c:/jdk1.3/bin;

this path is applicable for all the directories & sub dir. to the root.

SAndeep Karemore

> Hi
> 1. I suppose you have installed JDK ( Java Development kit ) on your
> computer. If you don't have java installed on you system then visit and download the free version of latest java1.3 and install it.
> 2. I suppose c:\jdk1.3 is the home directory in which you have installed your java software. Now you can include c:\jdk1.3\bin in your PATH environment variable ( I assume you are using windows ) in autoexec.bat file. It is not necessary but it will save you typing some extra words everytime you compile and run your java program.

> 3. NOw you are ready to write a java program which you can compile and run. If you have a java editor then open it. If you need one I will mail it to you. If you don't have java editor then you can open notepad and type the following.

> class Hello {
> public static void main ( String[] args ) {
> System.out.println ( "Hello java!!!" ) ;
> }
> }

> 4. Please type exactly as shown in step3. Java is case sensitive. If you type system instead of System ( note uppercase 'S' ) then your program won't compile.
> 5. Save the notepad file as . Now you have to take extra care. Here the file name has to be ( note uppercase 'H' ) and if you just type when prompted to save a file in notepad then it will save it as . So in save file dialog when you say File -> Save in notepad then type the file within double quotes. So instead of typing the file name as, please type "" and when you type a file name in double quotes then .txt is not appended by notepad. I suppose you saved you in c:\myjava directory.

> 6. Now go to DOS-prompt and change your current directory to your myjava directory. So your dos prompt will look like as foillows.
> C:\myjava>

> 7. Now you can type javac on command line as follows
> C:\myjava>javac
> Please note that even file name is case sensitive for java. You cannot type or HEllo.Java. If you havn't included c:\jdk1.3 in PATH variable then please type as follows
> c:\myjava>c:\jdk1.3\bin\javac

> 8. After pressing enter in STEP 7 , you will get the command line again like
> c:\myjava> if everything went well. At this time you can have your java program compiled and java compiler has created a new file Hello.class . Now you have to run the program
> 9. On Command line type as follows
> C:\myjava>java Hello
> Here you don't have to type or Hello.class, You have to type just Hello the name of the class which we created in out program. You can also type c:\myjava> c:\jdk1.3\bin\java Hello

> 10. We use javac to compile a java program using .java file name and java to run a java progran using the class name ( in our case Hello ) .

> 11. If you need more help. Just post a question or write to

> Thanx
> Kishori


Sponsored Links

Copyright © 1996-2009 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use - Advertise with Us