File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes classpath problem win2000 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "classpath problem win2000" Watch "classpath problem win2000" New topic

classpath problem win2000

davade davade

Joined: Oct 13, 2004
Posts: 3
javac is unable to recognize classpath in win2000.

I tried setting classpath with no success.

Could this have anything to do with the several hotfixes from Microsoft?
reason is this wayback this OS without the most recent service pack work well on another machine.
Please help what am i doing wrong?
Rob Shields

Joined: Oct 11, 2004
Posts: 19
Can you post the error message you're getting?

Also try typing echo %CLASSPATH% at the command prompt to see the contents of the classpath system variable.
Tony Morris
Ranch Hand

Joined: Sep 24, 2003
Posts: 1608
You do not set the CLASSPATH environment variable for a standard SDK install.

Some argue (including myself) that setting the CLASSPATH environment variable at any time (i.e. not SDK installation) is a bad idea.

Tony Morris
Java Q&A (FAQ, Trivia)
davade davade

Joined: Oct 13, 2004
Posts: 3
I never seen such difficulties before.

I tries everything.

I did the same j2sdk1.4.2_06 installation on two machines with similar OS with the same results.
I even tried compile thinking it could be my javawsourceCode with similar results.

However did compile if I change to the directory path and compile.
But my which call external class will not compile. (See errors below.)

I force classpath setting using Set classpath @ command prompt also set classpath at mycomputer properties, even using Javac -classpath to set classpath. No success.

Here are the errors:
@ c:\ Javac
error: cannot read:
1 error

@ c:\sourceDir> Javac (this compile ok)

But when I use my which requires calling other classes which by the way resides in this same directory the this is what happen:

c:\SourceDir>Javac unreachable statement
1 error

If I were able to compile withing the source directory I would be contented but I am unable to compile source code that requires calling other external classes though they reside in the same directory.

I hope this is detailed enough.

Did anyone see this happening before.
Jeroen Wenting
Ranch Hand

Joined: Oct 12, 2000
Posts: 5093
classpath on NT and Unix like systems (which includes Win2000) does not by default include the current directory.
Add ;. at the end of your classpath.

To be able to compile from anywhere check the javac help, it should tell you that you can include a commandline option -sourcepath <path> and -d <path> to tell the compiler where to read sources and write compiled classfiles.

Type javac -help to get the full list of options.

Kj Reddy
Ranch Hand

Joined: Sep 20, 2003
Posts: 1704
You are setting the class path in wrong way. try to clean up the class path and set it again. I am using win 2000 i dont have any problem.
Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

Jeroen points out something very important, but doesn't necessarily state it directly enough:

You seem to be assuming that javac uses CLASSPATH to find *.java files. That's wrong -- it does not. It only uses CLASSPATH to find *.class files. There is a command-line -sourcepath option you can use, or (as I believe is far, far more common) you can compile from the directory where the source is located.

As far as the syntax error in that has nothing to do with the classpath -- your code needs fixing.

So to say this all again: from your description, it appears that everything is working as its supposed to.
[ October 14, 2004: Message edited by: Ernest Friedman-Hill ]

[Jess in Action][AskingGoodQuestions]
Elouise Kivineva
Ranch Hand

Joined: Feb 07, 2002
Posts: 154
Here is a good link for how to set the classpath on any Windows version:
davade davade

Joined: Oct 13, 2004
Posts: 3
Thanks everyone.
I agree. Here's the link:
subject: classpath problem win2000
It's not a secret anymore!