Yurttas/PL/OOL/Java/F/02/08/cpath.html

From ZCubes Wiki
Jump to navigation Jump to search

oo programming with java - package


CLASSPATH - Setup and check on a Solaris machine.

Assumptions :

  • You are on a local cpsc machine which runs under Solaris.
  • You have a directory: ~/JClasses/classes
  • Your package is in a subdirectory of ~/JClasses/classes.

Based on the assumptions given then you can setup your CLASSPATH as follows:



setenv CLASSPATH .:/usr/local/java/lib:/usr/local/java/jre/lib:$HOME/JClasses/classes

Obviously, you can have your java PATH and CLASSPATH set by unix setenv, given the aliases, through your own ".cshrc" as follows:



alias jpath 'setenv PATH /usr/local/java/j2se/bin/java:${PATH}'

alias jcpath 'setenv CLASSPATH .:/usr/local/java/lib:/usr/local/java/jre/lib:$HOME/JClasses/classes'

It is more appropriate to set your CLASSPATH before and whenever you need it, instead of automating it through ".cshrc" so that it won't clash with the existing CLASSPATH used by your local browsers which might be set up differently.

Anytime you are in doubt or in conflict with javac to locate your needed class files then check as follows:



echo $CLASSPATH

or

setenv