1

I am trying to compile a Java code in PL/SQL (Toad) as Java source in Oracle Database. I have few import org. and com. statements in my code.

import org.json.JSONObject;
import org.springframework.beans.factory.annotation.Value;
import com.fasterxml.jackson.core.type.TypeReference;

I'm getting cannot find symbol error after compiling. But not getting any error for java.io.* packages.

Can you please let me know if do I need to configure anything for importing these packages?

MT0
  • 143,790
  • 11
  • 59
  • 117
Rohit
  • 169
  • 7
  • 17

2 Answers2

0

Find the jar files containing those dependencies then use the loadjava utility to store them in the database so that Oracle can find them on its classpath.

MT0
  • 143,790
  • 11
  • 59
  • 117
-2

Any package with an org or com in its namespace is, by convention, meant to be available on the internet. As such, you would need to download them and place them somewhere in your classpath as .jar files.

To do that, simply point the classpath to the file in whatever directory it resides in, either by specifying it using the -cp or -classpath flag while compiling it in the command line, or adding it to your libraries in whatever IDE you prefer.

  • That may apply to generic Java applications but not when you are running Java internally to the database. You need to either use the [`loadjava` command-line utility](https://docs.oracle.com/database/122/JJDEV/loadjava-tool.htm#JJDEV10060) or use a [`CREATE JAVA` statement](https://docs.oracle.com/cd/B28359_01/server.111/b28286/statements_5013.htm#SQLRF01211) within the database. – MT0 Jul 13 '17 at 13:27
  • Yeah I realized this was in the context of a database after I posted it. Apparently I can't delete the answer now. – Rezaak1024 Jul 13 '17 at 14:35