English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

I am using windows XP

2007-03-19 02:30:00 · 2 answers · asked by nigel d 1 in Computers & Internet Software

2 answers

First you need to set path for the java compiler i.e. you need to tell the cmd where your java compiler is, so for that first search in which directory or folder is your javac.exe file. This file is very imp, without this you won't be able to execute any Java program. It is usually in the bin folder of Java directory. Let's say for eg the directory where the javac.exe file is present is C:\Program Files\Java\jdk1.5.0_07\bin
After you have done that you can set path by the following command:
C:\>set path=path%;C:\Program Files\Java\jdk1.5.0_07\bin;
Now you can compile and run it. For compiling write
C:\>javac filename.java
For executing it
C:\>java filename
Remember you need to save the file as .java and save it in the directory where you are executing above commands in cmd prompt. That is to say in above it is C:\>
If you have saved your Java program in some other directory say C:\Documents and Settings\My Documents
then you need to change the command prompt execution directory appropriately i.e in above case it should be
C:\Documents and Settings\Paritosh\My Documents>set path=path%;C:\Program Files\Java\jdk1.5.0_07\bin;

2007-03-19 02:51:07 · answer #1 · answered by Mr.X 1 · 0 0

first you need to open your terminal and then set the path where your program is save...make sure that your file must be save by .java extention....first of all we need to execute our code for that we have syntex "javac filename .java" and then we need to run it for that we have syntax "java filename" thats it....thank you

2017-02-01 23:37:28 · answer #2 · answered by Omprakash 1 · 0 0

fedest.com, questions and answers