Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

CLASSPATH Problem in Windows  RSS feed

 
Steve Stanicki
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello All,
I had this problem before, and I thought I solved it, but there is still an issue with it. I am working out of the Head First book.

I am running Windows XP.

I have a directory "C:\MyJava" for my work.

My CLASSPATH is set to C:\MyJava.

My source compiles and runs from directly under MyJava. But I would like to keep my work in separate directories under MyJava. Like this:
C:\MyJava\BeatBox\BeatBox.java etc...

Someone in another post said use a . (dot). I assume he meant to set the
CLASSPATH = C:\MyJava\.

This didn't help.

Any suggestions?

Thanks in advance,
Steve
 
Steve Fahlbusch
Bartender
Posts: 612
7
Mac OS X Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Steve,

First try the link above (the FAQ) and look at the link for #8 - if that doesn't work for you, repost.

-steve
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Steve Stanicki:
... Someone in another post said use a . (dot). I assume he meant to set the CLASSPATH = C:\MyJava\.
...

The "dot" is a symbol for the current directory and should be added as a separate item in the CLASSPATH list. In Windows, items are separated by a semicolon, so you would have something like...

CLASSPATH = .;C:\MyJava

(The system will start from the left and work towards the right until it finds an option that works. So the dot is a good first candidate to be first -- where it's also easily seen.)
[ January 10, 2006: Message edited by: marc weber ]
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You have not correctly included the current directory in your path. "C:\MyJava\." is equivalent to "C:\MyJava\". At this point, I suggest that you get rid of the CLASSPATH variable all together, if this is your only entry in it. This will solve your current problem and avoid any future problems.

If you insist on using the CLASSPATH, you need to understand how your operating system specifies individual directories and lists of directories. I think in Windows you need to use a semi-colon ( to separate multiple directories in a list. However, you should double-check this since it has been a while since I configured such things in Windows.

Layne

p.s. What marc said!

p.p.s. At this point, I don't think you need C:\MyJava in the classpath. This potentiall can slow down compilation since the compiler will look in this directory for .class files or for directories representing packages. Again, I strongly encourage you to remove the CLASSPATH variable completely. You do not need it at this stage in your Java education.
[ January 10, 2006: Message edited by: Layne Lund ]
 
Steve Stanicki
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi again,
I ended up doing a search on the Ranch on CLASSPATH.

I found one post that said if you are running jdk > 1.1, you shouldn't have to worry about the class path, and that the default is the dot. I deleted the CLASSPATH variable altogether, and things seem to be back to normal.

Thanks for your patience.

Steve
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Steve Stanicki:
...I deleted the CLASSPATH variable altogether, and things seem to be back to normal...

Good option! I'm glad you got it resolved.
 
Layne Lund
Ranch Hand
Posts: 3061
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Steve Stanicki:
Hi again,
I ended up doing a search on the Ranch on CLASSPATH.

I found one post that said if you are running jdk > 1.1, you shouldn't have to worry about the class path, and that the default is the dot. I deleted the CLASSPATH variable altogether, and things seem to be back to normal.

Thanks for your patience.

Steve


I'm glad to hear that you got it working. You will probably want to learn more about the CLASSPATH later, but for now it looks like your solution will work. Please come back in the future with more questions.

Layne
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!