File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Cattle Drive and the fly likes Classpath problem (probably typical) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "Classpath problem (probably typical)" Watch "Classpath problem (probably typical)" New topic
Author

Classpath problem (probably typical)

Joel Cochran
Ranch Hand

Joined: Mar 23, 2001
Posts: 301
I'm trying to compile my first go at OOP-1 and have completed the following steps:
1) Downloaded JavaRanchCommon.zip into my C:\JavaSource\CattleDrive directory where all my .java and .class files are stored.
2) Created the Source code with the following import statement:
import com.javaranch.common.* ;
3) In my DOS prompt I have executed "set classpath=%classpath%c:\JavaSource\CattleDrive\JavaRanchCommon.zip"

When I compile, however, I get the following error:
C:\JavaSource\CattleDrive>javac DaysOld.java
DaysOld.java:1: package com.javaranch.common does not exist
import com.javaranch.common.* ;
^
This must be a common (groan) problem, but I can't see what I'm missing... any ideas?
Joel


Wait a minute, I'm trying to think of something clever to say...<p>Joel
Greg Harris
Ranch Hand

Joined: Apr 12, 2001
Posts: 1012
for servlets i have javaranch.common in c:/orion/lib
or would that be c:\orion\lib
[This message has been edited by Greg Harris (edited November 29, 2001).]


what?
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9047
    
  10
Originally posted by Joel Cochran:
3) In my DOS prompt I have executed <pre>"set classpath=%classpath%c:\JavaSource\CattleDrive\JavaRanchCommon.zip"</pre>

Do you have a semicolon between %classpath% and the other stuff?

Side note:
Setting your classpath this way is only good while you are in the same DOS box. It's not transferable. You'll probably want to set your environment classpath eventually. Which OS are you using?

JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Joel Cochran
Ranch Hand

Joined: Mar 23, 2001
Posts: 301
Thanks Marilyn, the missing semi-colon did it...
I'm running Win98, so I would have to set this in the Autoexec.bat, right?
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9047
    
  10
Yes. You should change the classpath in your autoexec.bat
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Classpath problem (probably typical)