CLASSPATH is a Java system variable.
It tells Java where to look for things.
It is actually a list of direrctory paths with a colon as the list
separator, e.g.
CLASSPATH=/Applications/JRun4/lib/jrun.jar:/Applications/JRun4/servers/
lib/alchemy-jaas.jar:/Applications/JRun4/servers/lib/cfmx-j2ee.jar:/
Applications/JRun4/servers/lib/cfmx-ssl.jar
When you write a program in Java you compile the source into a class
file of the same name:
source: myprog.java ---> Java compiler ---> myprog.class
A .jar file is sometimes used to contain several related class files
(like a database program and its drivers or a bunch of drivers for
different databases).
.jar stands for Java ARchive -- and it is roughly equivalent to a zip
file (some zip programs can unzip jar files).
So once, you have compiled your program(s) into class files, and
optionally archived them into jar files, you are ready to tell Java to
run them.
one way to do this:
there is a command line program named java who's job is to run java
class files, so you type the following line into a (CLI) Command Line
Interface such as the Mac OS X Terminal program:
java myprog
Now, this will only work (java will be able to find your program) if
the the myprog.class file is in the current directory -- likely it
isn't, so you get a "Class not found" message.
Say you saved your myprog.class file in:
/Users/Jeff/Desktop/MyJavaPrograms/
Also assume your program use the PointBase JDBC driver that is stored
somewhere in the bowels of the CFMX directory
You need to tell Java where to find these different pieces
One standard way to do this is to append the directory paths to the
existing list of directory paths contained in the CLASSPATH
Once that is done, java will happily locate your class file and the
driver and run them.
OK! But this is very un-Mac-like.
And it gets really messy when your program uses a db driver over here
and a graphics module over there or there are different versions of
things in several places.
On the Mac, Java always looks in some predefined places. you can take
advantage of this!
Say you install MySql and a MySQL jdbc driver -- but you want CFMX and
MySQL use the same driver ( and maybe later your MySQL GUI).
you could make copies of the driver and place them:
---where Java looks when you start MySQL (mysql directory structure)
---where CFMX looks when you start CFMX (CFMX directory structure)
---where ViennaSQL looks when you start ViennaSQL (ViennaSQL directory
structure)
And/or append these paths in the CLASSPATH variable every time you
start them.
Then, whenever you get an updated driver...
On the Mac you just put one copy of the driver where everybody can find
it:
/Library/Java/Extensions
I usually leave the original in its original location.
So, you can do it the hard way or the easy way
When you start a Java program, it usually loads all of the JDBC drivers
it may use.
If you have CFMX running and then install a MySQL (or any other)
driver, CFMX won't find it until you stop/restart (burp) CFMX.
Left a lotta' stuff out that makes it even more flexible (but. alas
more complicated).
HTH
Dick
On Jun 18, 2004, at 9:23 AM, Jeff Small wrote:
> > A GUI Client is useful for experimenting with/validating complex
> > queries before coding them in CF.
> >
> > A fairly good, general-purpose, GUI SQL Client is ViennaSQL -- open
> > Source, written in Java and can interface any DB that has a JDBC
> > Driver.
> >
> > If you go MySQL, CocoaMYSQL is a Mac-specific GUI.
> >
> > BTW, on OS X, you don't need to mess with CLASSPATH -- just drop a
> copy
> > of the jar containing the JDBC driver into:
> >
> >������/Library/Java/Extensions
> >
> > This is on the default CLASSPATH, so every Java program will find
> them
> > (you may need to burp CFMX, tho)
> >
> > HTH
> >
> > Dick
>
> Oh man...this is gonna be *so* hard...I understood like, half of
> that...
>
> *sigh*
>
[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings] [Donations and Support]

