Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Java created with compilation errors

Gowthaman Ganesan-OracleFeb 2 2015 — edited Feb 3 2015

Hi All,

I have created below java source and compile, I am getting "Java Created with compilation errors"

I have given JAVAUSERPRIV to my user.

Pls help to resolve this issue. thanks

CREATE OR REPLACE AND COMPILE JAVA SOURCE NAMED "DirList" AS

       import JAVA.io.*;

       import JAVA.SQL.*;

public class DirList

       public static void getList(String directory) throws SQLException

    {

   File path = new File( Directory );

   String[] List = path.List();

   String element;

  

   for (int i=0; i<List.Length; i++)

   {

    element = List[i];

    #sql{INSERT INTO dir_list (FILENAME) VALUES (:element)};

   }

  }

}

/

Warning: Java created with compilation errors.

SQL> show errors
Errors for JAVA SOURCE "DirList":

LINE/COL ERROR
-------- -----------------------------------------------------------------
0/0      DirList:5: cannot find symbol
0/0      4 errors
0/0      location: class DirList
0/0      public static void GetList(String directory) throws SQLException
0/0      ^
0/0      DirList:7: cannot find symbol
0/0      symbol  : class File
0/0      location: class DirList
0/0      File path = new File( directory );
0/0      ^
0/0      DirList:7: cannot find symbol

LINE/COL ERROR
-------- -----------------------------------------------------------------
0/0      symbol  : class File
0/0      location: class DirList
0/0      File path = new File( directory );
0/0      ^
0/0      DirList:10: cannot find symbol
0/0      symbol  : variable Length
0/0      location: class java.lang.String[]
0/0      for(int i=0; i<List.Length; i++)
0/0      ^
0/0      symbol  : class SQLException
SQL> alter java class "DirList" compile;

Warning: Java altered with compilation errors.

SQL> alter java class "DirList" compile;

Warning: Java altered with compilation errors.

SQL> show errors
Errors for JAVA CLASS "DirList":

LINE/COL ERROR
-------- -----------------------------------------------------------------
0/0      ORA-29535: source requires recompilation
SQL> alter java class "DirList" compile;

Warning: Java altered with compilation errors.

SQL> show errors
Errors for JAVA CLASS "DirList":

LINE/COL ERROR
-------- -----------------------------------------------------------------
0/0      ORA-29535: source requires recompilation

This post has been answered by odie_63 on Feb 3 2015
Jump to Answer
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Mar 3 2015
Added on Feb 2 2015
8 comments
4,421 views