Results 1 to 9 of 9
- 11-08-2008, 01:56 PM #1
Member
- Join Date
- Nov 2008
- Posts
- 71
- Rep Power
- 0
javac is not recognized as internal or external command, operable program or batch...
please help me guys to solve this... "javac is not recognized as internal or external command, operable program or batch file", im trying to code java in notepad and compile it through "cmd".... but this is the result everytime i type javac Filename.java..... :(
and where i can find the j2sdk.... is it the same in jdk1.6.0_10???
tnx....
- 11-08-2008, 02:14 PM #2
classpath
relax, this is all known issues.Think of letters such as C:\Program Files or ~/developer/project as a way for the machine to find things. Okay, on my machine a program called javac.exe is in a location. That location is "C:\Program Files\Java\jdk1.5.0\bin\javac.exe"
Find where yours is.
Then make that the first part of your instructions to the machine, the command line.
Then we have several switches and so on, which we will discuss but first we find the location of your code, easiest to do that is "File Save As..." on Windows. This is called a path. That is the next thing on the command line. We can do this with batch files, replacing a rather nasty snag of trying to figure something called "CLASSPATH" which will often be the way people say to do it. There are several editors, many of them will do this classpath stuff for you. Better right now to do it manually so as to see what is going on. Basically, yes. Java 2 is a naming convention decided by the sales department. Figure generally that that happend at jdk 1.2 and we are now up to 6 with 7 not too far away. For beginner work this is not much of an issue except for download times, I use jdk 5Introduction to Programming Using Java.
Cybercartography: A new theoretical construct proposed by D.R. Fraser Taylor
- 11-10-2008, 04:43 AM #3
Member
- Join Date
- Nov 2008
- Posts
- 71
- Rep Power
- 0
sir.... ive done your instruction but it says that "the directory is invalid"....
this is what ive done:
1.type "cmd" in prompt
2. C:\Documents and Settings\aShiniSha> cd C:\Program Files\Java\jdk1.6.0_10\bin\javac.exe
3. after i typed the statement in no.2, the result says that "The directory name is invalid...
my javac.exe is located at no.2 path...
tnx sir
- 11-10-2008, 05:35 AM #4
Member
- Join Date
- Oct 2008
- Posts
- 24
- Rep Power
- 0
Update the PATH variable (Optional)
You can run the JDK without setting the PATH variable, or you can optionally set it as a convenience.
Should I set the PATH variable?
Set the PATH variable if you want to be able to conveniently run the JDK executables (javac.exe, java.exe, javadoc.exe, etc.) from any directory without having to type the full path of the command. If you don't set the PATH variable, you need to specify the full path to the executable every time you run it, such as:
C:> "\Program Files\Java\jdk1.6.0_<version>\bin\javac" MyClass.java
It's useful to set the PATH permanently so it will persist after rebooting.
How do I set the PATH permanently?
To set the PATH permanently, add the full path of the jdk1.6.0_<version>\bin directory to the PATH variable. Typically this full path looks something like C:\Program Files\Java\jdk1.6.0_<version>\bin. Set the PATH as follows on Microsoft Windows:
1. Click Start > Control Panel > System on Windows XP or Start > Settings > Control Panel > System on Windows 2000.
2. Click Advanced > Environment Variables.
3. Add the location of bin folder of JDK installation for PATH in User Variables and System Variables. A typical value for PATH is:
C:\Program Files\Java\jdk1.6.0_<version>\bin
* PATH environment variable is a series of directories separated by semi-colons (;) and is not case sensitive. Microsoft Windows looks for programs in the PATH directories in order, from left to right.
* You should only have one bin directory for a JDK in the path at a time. Those following the first instance are ignored. If one is already present, update it to jdk1.6.0_<version>\bin.
* If you are not sure where to add the path, add it to the right end of the PATH in the User Variables.
* The new path takes effect in each new command window you open after setting the PATH variable.
- 11-10-2008, 09:10 AM #5
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
Or else you can do it temporary, set the path on the working folder as follows.
actually the above path should be your JDK installation path. The above one can be change depends on your PC installation. Once you do it type javac. If you still get the same error you get initially at runtime, check installation path again.Java Code:path=D:\Program Files\Java\jdk1.6.0_07\bin\
This is not a best practice actually. Reason is each time when you run a Java class must do the same thing above before run the class.
You can do the same thing using AUTOEXEC.BAT file. I advice you that don't do anything there, if you don't have familiar with AUTOEXEC.bat file editing.
- 11-16-2008, 07:14 AM #6
Member
- Join Date
- Nov 2008
- Posts
- 71
- Rep Power
- 0
thank you J-LIve... got it.... also eranga and mr. jordan... :)
- 11-17-2008, 05:02 AM #7
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
If you have solve the problem please mark it as solved. It's really helpful to all other members.
- 11-18-2008, 08:49 AM #8
Member
- Join Date
- Nov 2008
- Posts
- 71
- Rep Power
- 0
how can i mark it??? tnx :)
- 11-18-2008, 09:21 AM #9
- Join Date
- Jul 2007
- Location
- Colombo, Sri Lanka
- Posts
- 11,374
- Blog Entries
- 1
- Rep Power
- 18
On top of this thread there is a menu, see your first post. On that menu click Tread Tools. You can find an option to do it.
Similar Threads
-
javac not recognized as an internal or external command
By kotoko in forum New To JavaReplies: 28Last Post: 10-26-2010, 04:39 AM -
javac command not recognized
By sunshine39 in forum New To JavaReplies: 7Last Post: 03-04-2009, 03:54 AM -
'javac' is not recognized as an internal or external command
By sam_1032002@btopenworld.c in forum New To JavaReplies: 3Last Post: 10-18-2008, 02:40 AM -
'cmd' is not recognized as an internal or external command
By thelukestir in forum New To JavaReplies: 6Last Post: 07-30-2008, 03:50 AM -
type javac on the command line from any directory of your machine
By silvia in forum New To JavaReplies: 4Last Post: 07-20-2007, 04:18 AM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks