Win a copy of Functional Design and Architecture this week in the Functional programming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Rob Spoor
  • Tim Cooke
  • Junilu Lacar
Sheriffs:
  • Henry Wong
  • Liutauras Vilda
  • Jeanne Boyarsky
Saloon Keepers:
  • Jesse Silverman
  • Tim Holloway
  • Stephan van Hulst
  • Tim Moores
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Mikalai Zaikin
  • Piet Souris

Classpath problem (probably typical)

 
Ranch Hand
Posts: 301
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
Ranch Hand
Posts: 1012
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).]
 
Sheriff
Posts: 9103
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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?
 
Joel Cochran
Ranch Hand
Posts: 301
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
Posts: 9103
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes. You should change the classpath in your autoexec.bat
 
You showed up just in time for the waffles! And this tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic