When you choose to build Java class libraries, you have two deployment choices. You can build call-interface driven (middle-tier) or server-side Java class libraries. Call-interface libraries act like server-side includes to your Apache server. They must be replicated to all nodes of your Apache server and are managed within the structure of your web server load-balancing tool. These components act like external programs that call into the Oracle server and are better treated in Enterprise Java books.
Server-side Java class libraries are stored objects within the Oracle JVM, which is a subcomponent of the Oracle database. Server-side Java class libraries are the core theme of this chapter. In the next two sections, you値l learn how to build internal server Java functions and procedures.
Java programming ranges from simple to complex, but these examples should be straightforward. You have two core executables to run Java programs, which you値l use in the examples. They are
The file-naming convention in Java is case-sensitive so you should ensure you name files consistent with the web-based code example files. If you attempt to compile a Java file when the file name and class name are different, you値l receive an error. Also, the file extension for Java programs is a lowercase .java. You値l now build a simple HelloWorld1.java file to make sure the balance of the examples works. If you池e working in Microsoft Windows, please open a Command Prompt Window. If you池e working in UNIX, please use a terminal window. The following is the code for HelloWorld.java: -- Available online as part of HelloWorld1.java file. Java text files are compiled by the following syntax: javac HelloWorld1.java Successful compilation does not return anything to the console. The lack of any message is a good thing. The way to verify whether or not you have a Java byte code file is to run the Microsoft Windows directory (dir) command or UNIX list (ls) command for files matching HelloWorld1.* in the present working directory. You should see two files displayed to the console: HelloWorld1.java After building the Java byte code compiled program, you can test its execution by doing the following: java HelloWorld1
You値l receive the following results: Hello World. The next section covers how you build server-side or internal server Java programming units. You値l learn how to build Java class files to support stored functions and procedures and how to wrap their existence in PL/SQL packages. The following two sections are sequential and the second section assumes you have worked through the first.
blog comments powered by Disqus |