13.2 What and When to Load
You must load resource files using the loadjava
tool. If you create .class
files outside the database with a conventional compiler, then you must load them with the loadjava
tool. The alternative to loading class files is to load source files and let Oracle Database compile and manage the resulting class schema objects. In Oracle Database 12c Release 1 (12.1), the most productive approach is to compile and debug most of your code outside the database, and then load the .class
files. For a particular Java class, you can load either its .class
file or the corresponding .java
file, but not both.
The loadjava
tool accepts Java Archive (JAR) files that contain either source and resource files or class and resource files. When you pass a JAR or ZIP file to the loadjava
tool, by default, it opens the archive and loads its members individually.
Note:
When you load the contents of a JAR into the database, you have the option of creating a database object representing the JAR itself.
A file, whose content has not changed since the last time it was loaded, is not reloaded. As a result, there is little performance penalty for loading JAR files. Loading JAR files is a simple, fool-proof way to use the loadjava
tool.
It is illegal for two schema objects in the same schema to define the same class. For example, assume that a.java
defines class x
and you want to move the definition of x
to b.java
. If a.java
has already been loaded, then the loadjava
tool will reject an attempt to load b.java
. Instead, do either of the following:
-
Drop
a.java
, loadb.java
, and then load the newa.java
, which does not definex
. -
Load the new
a.java
, which does not definex
, and then loadb.java
.
Related Topics