• 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

setting up package at classpath

 
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
1. does it need to set the package directory in the classpath?
2.
 
Suka Hati
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sorry...
2.
 
Suka Hati
Ranch Hand
Posts: 56
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
sorry again....some silly mistake
2. is it enough...if i want to use a package in my servlet...i just import it....e.g

import bla.*;
 
Ranch Hand
Posts: 160
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you are going to import a package, that package root directory must be in class path.

eg. com.test.mypackage is the package.

and you are have your source java file Test.java in C:\MyJava folder and you are importing the mypackage in your source file.

and this com directory is in C:\MyJava drive. then.. the folder MyJava should be in Classpath, while compiling and executing the source file Test.java

set classpath=C:\MyJava;%classpath%
 
Author and all-around good cowpoke
Posts: 13078
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
But note that Tomcat does not pay any attention to your environment CLASSPATH, instead it has its own conventions on where to find class files - see the class-loader-howto.html file under tomcat-docs in your Tomcat installation.
Bill
reply
    Bookmark Topic Watch Topic
  • New Topic