Forums Register Login

classpath problem win2000

+Pie Number of slices to send: Send
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?
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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 helloworldapp.java thinking it could be my javawsourceCode with similar results.

However helloworldapp.java did compile if I change to the directory path and compile.
But my MainSourceCode.java 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 helloworldapp.java
error: cannot read: helloworldapp.java
1 error

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

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

c:\SourceDir>Javac MainSourceCode.java
MainSourceCode.java:84: 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.
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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.
+Pie Number of slices to send: Send
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 MainSourceCode.java: 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 ]
+Pie Number of slices to send: Send
Here is a good link for how to set the classpath on any Windows version:

http://www.cadenhead.org/book/java21/jdkhelp6.shtml
+Pie Number of slices to send: Send
Thanks everyone.
Dinner will be steamed monkey heads with a side of tiny ads.
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com


reply
reply
This thread has been viewed 852 times.
Similar Threads
what does this error message mean?
can't run java in windows2000 server
How to set up jdk environment variables in Window 2000
Help - J2EE RI Server not running
system variables
More...

All times above are in ranch (not your local) time.
The current ranch time is
Mar 29, 2024 09:00:31.