• 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
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

classpath setting rightly. But strange problem

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i have my java files in the below directory and i wanted my class files to be generated in the same directory
C:\jakarta-tomcat-4.1.31\webapps\examples\WEB-INF\classes\coreservlets

i need to compile 3 files in the above path which are namely
Primes.java
PrimeList.java
PrimeNumbers.java
The relation between them is like this
PrimeNumbers.java (needs) PrimeList.java (needs) Primes.java

The following is the way i am doing it.

C:\jakarta-tomcat-4.1.31\webapps\examples\WEB-INF\classes\coreservlet>set CLASS
PATH=%CLASSPATH%;C:\jakarta-tomcat-4.1.31\webapps\examples\

C:\jakarta-tomcat-4.1.31\webapps\examples\WEB-INF\classes\coreservlets>javac Pri
mes.java

C:\jakarta-tomcat-4.1.31\webapps\examples\WEB-INF\classes\coreservlets>javac Pri
meList.java
PrimeList.java:45: cannot resolve symbol
symbol : variable Primes
location: class coreservlets.PrimeList
BigInteger start = Primes.random(numDigits);
^
PrimeList.java:47: cannot resolve symbol
symbol : variable Primes
location: class coreservlets.PrimeList
start = Primes.nextPrime(start);
^
2 errors

I hope setting classpath is done right way and this PrimeList.java which needs Primes.java should be able to identify Primes.class. But i wonder what could be the problem.
[ August 24, 2005: Message edited by: narayana babu reddyvari ]
 
Sheriff
Posts: 9109
12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Your classpath needs to point to the directory that contains the classes. You said your classes should be in
C:\jakarta-tomcat-4.1.31\webapps\examples\WEB-INF\classes\coreservlets
but your classpath points to
C:\jakarta-tomcat-4.1.31\webapps\examples\

Unless Primes.java, PrimeList.java, and PrimeNumbers.java are in a package named coreservlets, in which case the classpath should point to
C:\jakarta-tomcat-4.1.31\webapps\examples\WEB-INF\classes\
and you should compile using
C:\jakarta-tomcat-4.1.31\webapps\examples\WEB-INF\classes>javac coreservlets\Primes.java
etc.
 
Greenhorn
Posts: 16
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,
if you are using eclips as a editor for java then no need to worry there is a option so that you can set output directory.your java file after compilation stoard in output directory. so no need to set class path everytime.
in eclips you need to create new project give him source directory and output directory
it takes java file from source directory and compiled it ,after compilation it stored in output directory werever you set the output dir.

for the detail infromation you can search for eclips site
[ August 25, 2005: Message edited by: prashant fusate ]
 
babu hiran
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Marilyn de Queiroz
-------------------
i did it as told by u and it started working. Thank you so much.
But i have a doubt. some time back when i set class path to a directory and compile java files in its child directory, it was able to identify other classes in diff files that it is refering to in the same dirctory. so big confusion about what are the possible ways of doing it.

prashant
-----------
As u said i have actually used borland jbuilder which doesnt need all these classpath issues.
[ August 25, 2005: Message edited by: narayana babu reddyvari ]
reply
    Bookmark Topic Watch Topic
  • New Topic