LoadJava Utility uploading Java files as Invalid (Doc ID 103536.1)

Last updated on JUNE 22, 2017

Applies to:

Oracle Database - Enterprise Edition - Version 8.1.5.0 and later
Information in this document applies to any platform.
***Checked for relevance on 22-Jun-2017***

Symptoms

 Using loadjava to load a java class into the database results in a status of INVALID.

Create a simple "Hello world" java file that will define a class, "Hello" with a "Hello.world()" method.

    public class hello
    {
        public static String world()
        {
        return "Hello World";
        }
    }

Compile the class by invoking the java compiler in order to create the java binary file Hello.class.

    javac Hello.java

Next use the "loadjava" utility to upload the file to the server.
 
    loadjava -user scott/tiger Hello.class

The "-user" argument specifies the username and password is used in the logon schema, this is required. This example of the loadjava directs "loadjava" to communicate with the database using the OCI JDBC drivers. The OCI JDBC drivers is the default, however you may use the thin JDBC drivers instead simply by specifying "-thin" on the command line as one of the loadjava options.

Check the upload results:

SQL> select object_name, object_type, status, timestamp from user_objects where object_name = 'hello';

OBJECT_NAME
----------------------------------------------
OBJECT_TYPE        STATUS  TIMESTAMP
------------------ ------- -------------------
hello
JAVA CLASS         INVALID 2000-03-28:10:51:23  


NOTE: status is INVALID

Changes

 None

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms