Results 1 to 19 of 19
Thread: [SOLVED] Classpath (again)
- 03-18-2009, 11:35 PM #1
Member
- Join Date
- Mar 2008
- Posts
- 43
- Rep Power
- 0
[SOLVED] Classpath (again)
Sorry guys, I'm stuck with the CLASSPATH problem again. I've done all the usual steps. (set CLASSPATH, restart, restart, reinstall java, reset CLASSPATH, restart, restart).
I'm running windows XP and my path is: C:\Program Files\Java\jdk1.6.0_10
CLASSPATH is:
Any further suggestions?Java Code:C:\Program Files\Java\jdk1.6.0_10\src.jar;C:\Program Files\Java\jdk1.6.0_10\lib\dt.jar;C:\Program Files\Java\jdk1.6.0_10\lib\tools.jar;C:\Program Files\Java\jdk1.6.0_10\jre\lib\il8n.jar;C:\Program Files\Java\jdk1.6.0_10\jre\lib\jaws.jar;C:\Program Files\Java\jdk1.6.0_10\jre\lib\rt.jar;C:\Program Files\Java\jdk1.6.0_10\jre\demo\sound\JavaSound.jar;C:\Program Files\Java\jdk1.6.0_10\demo\jfc\SwingSet2\SwingSet2.jar;C:\Program Files\Java\jdk1.6.0_10\demo\jfc\SwingApplet\SwingApplet.jar;C:\Program Files\Java\jdk1.6.0_10\;C:\Program Files\Java\jdk1.6.0_04\Bin;C:\Program Files\Java\jdk1.6.0_10\Lib;
Is there anywhere that I can go for an up-to-date guide?
I am using SciTE as my IDE, (which sends command line requests and responds with command line responses. At least that is what it looks like).
The command line response is always:
I'm out of ideas to get this thing to work, and I'm not happy.Java Code:...\Code\Java Test>javac nlargest.java 'javac' is not recognized as an internal or external command, operable program or batch file. ...\Code\Java Test>
~fogus
- 03-18-2009, 11:42 PM #2
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,545
- Rep Power
- 11
Why is there so much stuff in the CLASSPATH variable?
I typically do not have a value for this variable set.
When compiling from the command line, I set the classpath I want to use using the -cp option. (Unless I want to the classpath to be the current directory which is the default when there is no CLASSPATH variable.)
When using an IDE I set the classpath I want to use as part of the configuration of the particular project.
Since the desired classpath varies from occasion to occasion, any setting at all for a CLASSPATH variable will sometimes be inappropriate which is why I find easier not to use it.
- 03-18-2009, 11:48 PM #3
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,545
- Rep Power
- 11
Just read your post all the way to the end...
This has nothing to do with the CLASSPATH variable. (Or the classpath, since the javac executable doesn't start and, hence, does not use the classpath...)'javac' is not recognized as an internal or external command,
operable program or batch file.
Rather your OS (or shell) has not got the path set correctly.
From the backslash it appears you are using Windows. This OS uses a variable called PATH to determine where executables will be located. This variable consists of a list of directories (folders) separated by ; that will be searched when you issue a command.
Check out Sun's installation notes, or the Windows documentation for details on how to alter the PATH variable.Last edited by pbrockway2; 03-18-2009 at 11:51 PM.
- 03-19-2009, 12:08 AM #4
Senior Member
- Join Date
- Sep 2008
- Posts
- 564
- Rep Power
- 5
you want your PATH environment variable to point to the jdk's bin directory (C:\Program Files\Java\jdk1.6.0_10\bin ... and may also wanna set your JAVA_HOME to C:\Program Files\Java\jdk1.6.0_10 if you haven't done so already).
difference is that without CLASSPATH, java compiler won't find classes it needs to compile. without PATH, computer won't even find the compiler to get as far as using classpath.
- 03-19-2009, 02:52 AM #5
Senior Member
- Join Date
- Jul 2008
- Posts
- 125
- Rep Power
- 0
I recently installed Java into Window XP
REVISION 2.0
Yesterday I created this post.
It contains a documented procedure which
I find completely reliable for installing
Java on Windows XP systems.
Unfortunately, I made a few 'flakey'
comments about lines 7, 9, and 11 in the
procedure. In this revision, I have removed
those comments, openned the last system I
serviced with this procedure, and
inspected what I had done.
Here is what I found:
The Environment Variables dialog, which
pops up after step 6 in the procedure,
contains two windows, a top window
labeled:
"User variables for Paul"
and a bottom window labeled:
"System variables"
I could not find "Path" in the top,
"User variables for Paul" window.
I found it in the bottom, "System variables"
window, so that is the line I modified.
The author warns:
NOTE: UNDER NO CIRCUMSTANCES SHOULD YOU EDIT OR MODIFY ANY OF
THE "SYSTEM VARIABLES" -- you could render your entire computer unusable! --
But I did it anyway, and my system works
fine. I emphasize: I went against the
author's warning because the "Path"
variable I needed, I found in the
"System variables" window.
Every other detail in this procedure I
followed to the letter. The whole
process took a few minutes, and I have
never had any issues related to the
Java installations.
Java Code:Setting the PATH and CLASSPATH on Windows XP For VERSION 1.5.0_01 of Java (the new version!) NOTE: If a command is given in quotes for you to type, DO NOT TYPE THE QUOTES 1. Click on START (lower left) 2. Under "Settings" click on "Control Panel" 3. Switch to "classic view" (upper left) -- not "category view" 4. Click on the "System" icon. 5. Click on the "Advanced" tab. 6. Click on the "Environment Variables" button (bottom). 7. Highlight "PATH" (in the top window) and click the "edit" button. NOTE: UNDER NO CIRCUMSTANCES SHOULD YOU EDIT OR MODIFY ANY OF THE "SYSTEM VARIABLES" -- you could render your entire computer unusable! -- 8. Edit the "PATH" so it begins: C:\Program Files\Java\jdk1.5.0_01\bin; (note: if you install Java into a different directory, you may need to change the directory from that listed above) 9. For example, the full "PATH" on my computer is: C:\Program Files\Java\jdk1.5.0_01\bin;C:\Program Files\SSHCommunications Security\SSH Secure Shell 10. After you have finished editing the PATH, click "OK". You are done setting your PATH. Now you have to create a new variable, called your CLASSPATH. 11. Click on the "NEW" button below the top window. 12. Under 'variable name' type CLASSPATH 13. Under 'variable value' type . (yes, type a single period). 14. Click OK. 15. EXIT the control panel. 16. Restart your computer. 17. Test your installation by opening up a DOS window and verifying that both the commands "java" and "javac" are recognized.Last edited by paul pasciak; 03-19-2009 at 05:04 PM.
- 03-19-2009, 05:59 AM #6
Member
- Join Date
- Mar 2008
- Posts
- 43
- Rep Power
- 0
"Why is there so much stuff in the CLASSPATH variable?"
I don't know. I read to do that somewhere. What would you put in it instead?
"When using an IDE I set the classpath I want to use as part of the configuration of the particular project."
I am using Scite. Perhaps someone could tell me what code I should put in place of:
I honestly couldn't care less how I get this thing to work; I just need it to.Java Code:command.compile.*.java=javac $(FileNameExt) command.build.*.java=javac *.java command.go.*.java=java $(FileName) command.go.needs.*.java=javac $(FileNameExt)
I am using windows XP.
Thanks all,~fogus
- 03-19-2009, 06:53 AM #7
relax, take a deep breath, and re-read post #3.
[SOLVED] Classpath (again)USE CODE TAGS--> [CODE]...[/CODE]
Get NotePad++ (free)
- 03-19-2009, 07:35 AM #8
Senior Member
- Join Date
- Mar 2009
- Location
- USA
- Posts
- 127
- Rep Power
- 0
download netbeans..!!!!
why worry about setting up classpaths..!
- 03-19-2009, 08:05 AM #9
Member
- Join Date
- Mar 2009
- Posts
- 3
- Rep Power
- 0
you have to set path of java so tht u run javac. Ok do this way,
Right click on My comp
2. Properties
3. Environment Varaible
4. Path
and click on edit button after selecting path a window will come with already existing path. just add a semicolon and ur java bins path like
C:\oraclexe\app\oracle\product\10.2.0\server\bin;% SystemRoot%\system32;%SystemRoot%;%SystemRoot%\Sys tem32\Wbem;C:\Program Files\CyberLink\Power2Go;C:\jdk1.6.0_07\bin
- 03-19-2009, 08:08 AM #10
Member
- Join Date
- Mar 2009
- Posts
- 3
- Rep Power
- 0
See this it will help u if its not done then write small c for the path of c drive in ur path. Some times it faces the problem of character code. I to found this problem wihile runing java prgs. Now i have made the changes as above and its working fine and smooth.
- 03-19-2009, 05:24 PM #11
Senior Member
- Join Date
- Jul 2008
- Posts
- 125
- Rep Power
- 0
I don't understand the "Cult of the Path/ClassPath Variable."
I don't understand why, whenever people make
a request for information on how to set the "Path",
or whatever it is, that usually the response is short
and vague, as if it's a procedure that everyone
who has operated a computer must already know
how to perform.
In the anatomy of the computer, the "Path" seems
like the computer's appendix (appendicts <-SP?).
Most programmers cannot really speak as an
authority on it, and it seems like something
that could be removed from the computer
altogether without causing it any harm.
That aside, I am open to anyone who can provide
a complete, intelligent, and coherent description
of its purpose, and maybe use, as an example,
why it is utilized by Java.
ALSO, I updated a post I contributed earlier to
this thread to make it more complete, intelligent,
and coherent.Last edited by paul pasciak; 03-19-2009 at 05:30 PM.
- 03-19-2009, 07:51 PM #12
Member
- Join Date
- Mar 2008
- Posts
- 43
- Rep Power
- 0
I got it!
User Variable "PATH" set to:
and system variable "CLASSPATH" set to:Java Code:C:\Program Files\Java\jdk1.6.0_10\bin
I don't know if I actually need to have CLASSPATH set to what it is, but no matter.Java Code:C:\Program Files\Java\jdk1.6.0_10\src.jar;C:\Program Files\Java\jdk1.6.0_10\lib\dt.jar;C:\Program Files\Java\jdk1.6.0_10\lib\tools.jar;C:\Program Files\Java\jdk1.6.0_10\jre\lib\il8n.jar;C:\Program Files\Java\jdk1.6.0_10\jre\lib\jaws.jar;C:\Program Files\Java\jdk1.6.0_10\jre\lib\rt.jar;C:\Program Files\Java\jdk1.6.0_10\jre\demo\sound\JavaSound.jar;C:\Program Files\Java\jdk1.6.0_10\demo\jfc\SwingSet2\SwingSet2.jar;C:\Program Files\Java\jdk1.6.0_10\demo\jfc\SwingApplet\SwingApplet.jar;C:\Program Files\Java\jdk1.6.0_10\;C:\Program Files\Java\jdk1.6.0_04\Bin;C:\Program Files\Java\jdk1.6.0_10\Lib;
Thanks guys!~fogus
- 03-19-2009, 10:10 PM #13
Member
- Join Date
- Mar 2008
- Posts
- 43
- Rep Power
- 0
Sounds nice.
I use netbeans and I hate it. For example, have you noticed how scrolling through the list of folders in the "open project" dialogue box is slower than any other program? Yeah, that's the graphics developer I have to use! Get your act together! Stop making joke IDEs! Joke! They can't even make window scroll properly!~fogus
- 03-20-2009, 07:58 AM #14
Member
- Join Date
- Mar 2008
- Posts
- 43
- Rep Power
- 0
- 03-20-2009, 11:47 PM #15
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,545
- Rep Power
- 11
I'm glad you've found a solution.
But I have to point out that it's a secret society that publishes the details of its handshakes meticulously. (For instance in the link given in reply #3). Call me old fashioned, but I prefer RingTFM over "trying different things until they wrok". It's more effective. And I'm always willing to explain the mysteries to anyone who has made the effort to consult the sacred writings and has some precise question about their meaning.
On the "path as appendix": it's the classpath, not the path, that is redundant. (Or, rather, the CLASSPATH variable.). Reply #2.
- 03-21-2009, 01:22 AM #16
Member
- Join Date
- Mar 2008
- Posts
- 43
- Rep Power
- 0
- 03-21-2009, 02:42 AM #17
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,545
- Rep Power
- 11
A couple of things: by adopting the "secret society" metaphor (if only to ridicule it gently), I might have projected the arrogant image of being one of the "enlightened". Well, I'm not.
Second, paulpasciak was referring to an example of the path (or PATH variable) and that's what I'll respond to.
(The third of my couple of things would be that I expressed a willingness to respond to specific questions arising from the detailed, already published, information...)
What is the purpose of the PATH variable? The documentation I linked to put it rather tersely. "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"
So the purpose of the PATH variable is to allow you to issue a command like "javac" and have the operating system somehow convert that into a command like "C:\Program Files\Java\jdk1.6.0_12\bin\javac.exe".
Hopefully it should be clear that this is a boon not just to using the javac compiler. It applies equally to all executable files (.exe, .bat, .cmd etc). For instance I have a .cmd file that does a back up of a certain folder. I like to invoke it as "backup", even though its actual name is "C:\Program Files\MyStuff\backup.cmd". By putting "C:\Program Files\MyStuff" in the PATH variable this magic will happen.
What is the PATH variable? Have a look at Environment Variables in Windows XP (a random result from Google - but it looks like a good one). They quote some Microsoft documentation (not attributed, but Google should find it): "Environment variables are strings that contain information such as drive, path, or file name. They control the behavior of various programs. For example, the TEMP environment variable specifies the location in which programs place temporary files."
So the PATH variable is just a string. I won't repeat the entire description of the PATH variable from that page, just that it "specifies the command search path. Typically, this is a group of directories where executable files that are repeatedly used are to be found". And that the string consists of the directories separated by the ; symbol.
(Sun's documentation says much the same as one of the bullet points in section 4.)
The error message:is saying that the operating system looked everywhere mentioned in the PATH variable, but could not find <your command here>. In other words this error message is the sure sign of a bad PATH variable. (It might also look in other places as well; the current dorectory for instance).'<your command here>' is not recognized as an internal or external command,
operable program or batch file.
How do you set the PATH variable? Again the Sun documentation I linked to was terse but sufficient.
"A # Click Start > Control Panel > System on Windows XP or Start > Settings > Control Panel > System on Windows 2000.
B # Click Advanced > Environment Variables.
C # Add the location of bin folder of JDK installation for PATH in User Variables and System Variables."
The vlaurie.com page I linked to gives another couple of methods: You can just use the command
This will make the PATH variable equal to its current value (that's what %PATH% does) and newdir. In the Java case newdir would be the bin directory containing the java tools. Note this method is only effective in the particular command window you have open.Java Code:path = %PATH%;newdir
Another method they mention is to use the setx.exe executable that is part of WXPSP2 support tools. (I hope the penny is starting to drop: it shows Billy's geeky face and bears the legend "This Ain't a Java Question").
(They also repeat the A/B/C of the method in Sun's documentation - with pictures!)
So... The PATH variable is a semicolon delimited list of directories used to determine the full filing system path to executable files when the files are specified by the leaf name only.
No "appendix" this. If you mess with it, scripts that refer to executable files without specifying their full file names are going to break.
paul's request also required "completeness" of any description. Not a good idea, IMHO, as you are apt to lose the wood for a detailed description of the trees. And then lose track of the trees as all the leaves are intelligently described.
Better to read TFM (or have I mentioned that?) If you read Sun's and the vlaurie.com link you should be able to answer: does the order of the PATH variable entries matter? Their cAsE? What role (if any) does the PATHEXT variable play in locating the javac compiler?Last edited by pbrockway2; 03-21-2009 at 02:48 AM.
- 03-21-2009, 03:52 AM #18
Member
- Join Date
- Mar 2008
- Posts
- 43
- Rep Power
- 0
Thanks very much, pbrockway2. I'll be sure to do all of that.
Useful note you posted:
"I like to invoke it as "backup", even though its actual name is "C:\Program Files\MyStuff\backup.cmd"."
I just made medamonkey open through the run command box. I had always wondered how to make that happen.~fogus
- 03-21-2009, 04:30 AM #19
Moderator
- Join Date
- Feb 2009
- Location
- New Zealand
- Posts
- 4,545
- Rep Power
- 11
Similar Threads
-
Classpath
By dawiz001 in forum New To JavaReplies: 3Last Post: 03-18-2009, 02:18 PM -
help me to set classpath
By srinivaspuvvala in forum Java ServletReplies: 3Last Post: 01-18-2009, 07:13 PM -
j3d classpath
By sales1 in forum New To JavaReplies: 3Last Post: 12-23-2008, 01:51 AM -
Classpath
By Preethi in forum New To JavaReplies: 5Last Post: 06-20-2008, 09:00 AM -
Classpath on mac osx
By jacobb in forum JDBCReplies: 0Last Post: 06-12-2008, 09:41 PM


LinkBack URL
About LinkBacks
Reply With Quote

Bookmarks