The procedure for invoking the JAR package Java method in ODI is as follows:
1. Write Java code as follows
ImportJava.io.File;ImportJava.io.FileOutputStream;ImportJava.io.OutputStream; Public classFileWriter { Public Static voidWriteFile ()throwsException {//1. Find a fileFile File=NewFile ("D:" + File.separator + "Temp.txt");//2. Instantiating OutputStream objectsOutputStream out=Newfileoutputstream (file); String Info= "Hello world!!!";//the string to outputbyteData[] = Info.getbytes ();//Changing a string into a byte arrayout.write (data);//Output Contentout.close ();}}
2. Compile and package into a jar package
Compile the. Java class from the command line
Create. jar file from the class
d:\>javac filewriter.javad:\>844523) d:\>
3. Copy jar package to
C:\Users\<user-name>\AppData\Roaming\odi\oracledi\userlib
比如我的为
C:\Users\XQZT\AppData\Roaming\odi\oracledi\userlib
4. Launch ODI, new procedure call jar
The code is as follows
Import OS Import SYS Import FILEWRITERFW=FileWriter () fw.writefile ()
5. Run and verify the process
Reference:
http://karanbalkar.com/2013/06/tutorial-33-using-custom-java-code-in-odi/
Http://shrikantdhagefmw.blogspot.com/2014/05/invoking-jar-in-oracle-data-integrator.html
Http://askankit.blogspot.com/2010/09/call-java-jar-methods-from-odi.html
Invoking jar in Oracle Data integrator