hi........

i'm new to java......
i m running a java program on cmd prompt,i want to compile but i m getting error like

'javac' is not recognised as internal and external command ,operable program

plzzzzzzzzzzz help me:)

Recommended Answers

All 12 Replies

please help me:(

set up your system path correctly to include the $JAVA_HOME/bin directory (after of course setting the $JAVA_HOME environment variable correctly).

Java installation steps can be found here

still i'm not getting

If environment variables are not setup then go to cmd and type
cd C:\Program Files\Java\jdk1.6.0_04\bin (hit enter)

This path may vary according to your jdk version.
After this, now paste the program that you want to execute in the folder bin.

Now go to cmd and then complie the program:
javac programname.java (file that contains main method)
After compiling run the program:
java programname (hit enter)

Now the program will run.

But it is better to set environmental variables(just google it and you will find the solution),If you do not want to set environmental variable then every time you will have to paste the programs in bin folder and then for compiling you will have to navigate to C:\Program Files\Java\jdk1.6.0_04\bin and then compile and run it.
Hope this solves your problem.

still i'm not getting

That is a helpful comment...

What you did?
What you are doing?
What exact errors you getting?

So you can show us what is happening (on Windows)
To copy the contents of the command prompt window:
Click on Icon in upper left corner
Select Edit
Select 'Select All' - The selection will show
Click in upper left again
Select Edit and click 'Copy'

Paste here.

If you have installed JDK,

1) Locate where your jdk\bin folder is in your system
ex : C:\Program Files\Java\jdk1.6.0_21\bin

2) Now open Command Prompt

3) Now set the path:
set path="C:\Program Files\Java\jdk1.6.0_21\bin"
press enter

4)now type : javac on command prompt.if you get following out put then your java is working

Usage: javac <options> <source files>
where possible options include:
-g Generate all debugging info
-g:none Generate no debugging info
-g:{lines,vars,source} Generate only some debugging info
-nowarn Generate no warnings
-verbose Output messages about what the compiler is doing
-deprecation Output source locations where deprecated APIs are u
sed
-classpath <path> Specify where to find user class files and annotati
on processors
-cp <path> Specify where to find user class files and annotati
on processors
-sourcepath <path> Specify where to find input source files

Why bother setting the path each time in the command prompt?

3) Now set the path:
set path="C:\Program Files\Java\jdk1.6.0_21\bin"
press enter

4)now type : javac

Why not use the full path for the javac command:

"C:\Program Files\Java\jdk1.6.0_21\bin\javac.exe" <SOURCE HERE>.java

set path is used only once after opening command prompt ,Its diffcult to type your command every time

There are some key presses that will cycle thru the commands you have entered if you want to reuse them.

And there is system path variable that you can set in system and no need for all this repetition.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.