 |
|
Oracle Java PL/SQL scripts
Oracle Database Tips by Donald Burleson |
Just as in PL/SQL you can have stand alone programs
called scripts (anonymous PL/SQL blocks in PL/SQL) and class and
method declarations called applets (stored procedures, functions in
PL/SQL). In addition, classes can be rolled up into packages just
like individual procedures and functions can be rolled up into
packages in PL/SQL. A class definition, as was shown above, is
virtually identical in both languages.
JAVA code is stored in files just like the code
from other languages, however, the name of the file must match, both
in content and format, the name of the class contained within the
file. A JAVA file usually ends in the ".java" extension. All JAVA
code must be passed through the JAVA compiler and be made into a
CLASS before it can be used. the JAVA compiler is called "javac".
There are two environmental variables that will
effect the operation of your JAVA programs such as java, javac and
appletviewer, these are PATH and CLASSPATH. On UNIX they can be set
in the ".profile" file for each user or through a global setup
".profile" (file name may differ depending on the shell you use
under UNIX). On a WIN95 platform a simple addition to the
autoexec.bat file in the boot directory is all that is required and
on Windows NT you can use the autoexec.bat method added to a trip
through the registry editor. I have it difficult to get the various
browsers to recognize new CLASSPATH variables, so getting some
expert help to add this data to your browser path is suggested.
* CLASSPATH - Used to
provide the system a path to user-defined classes. Directories are
separated by semi-colons, for example,
.;C:\users\classes;C:\tools\java\classes
* PATH - Used to tell
the operating system what path to traverse to search for executables
|