Using a Custom .jar File in Your Java Concurrent Program

September 6, 2013
Michael S.

Custom_Jar_File_Blog

Remember when I said I’d cover custom .jar files?  Here it is: my follow-up to creating your first Java Concurrent program.

In the previous post, we covered all the steps necessary to create, compile, deploy and run a Java Concurrent Program as made available through the Standard Request Submission form in Oracle applications.  This is a logical way to start, but it may not be the preferred method from a “best practice” point of view.  The more appropriate method might be to compile your solution and archive your class files into a .jar file that represents all components of your solution.

Revising Your Solution

If you selected the option above to package your code under a custom top – within a solution-related .jar file OR if you intend to include any third-party .jar files that are not (and I assume will not be) included in the CLASSPATH of the EBS middle-tier – then you will need to specify the “–classpath” option when creating your Concurrent Program.

The process as outlined in my previous post still stands, however you must specify the following:

jsar_copy

If your program relies on third-party .jar files, or if you located your class in a .jar file that is not by default included with the CLASSPATH for the middle-tier application server, see the Special Notes section.

… where the Options field contains the following:

-classpath

/d01/oracle/EBSVIS/apps/apps_st/comn/java/classes:/d01/oracle/EBSVIS/apps/apps_st/appl/au/12.0.0/java/appsborg.zip:/d01/oracle/EBSVIS/apps/apps_st/appl/pps/12.0.0/java/json_simple-1.1.jar

The json_simple-1.1.jar is just an example of including a custom or third-party .jar in the classpath.

This –classpath “overrides” the default CLASSPATH that would be inherited from the middle-tier.  As such, the general specification is:

-classpath <path_to_JAVA_TOP>:<path_to_appsborg.zip>/appsborg.zip:<path_to_your_custom.jar>/custom.jar

This option must always have the following:

  1. The path to $JAVA_TOP
  2. The appsborg.zip
  3. A path and archive for your and/or third-party archives
  4. Be specified as the literal path, and may not contain $VARIABLE references
  5. Be used when working with archives that are not part of standard CLASSPATH for middle-tier

Conclusion

Although not covered in great detail, remember these key components when compiling your .jar file:

  • Echoing Parameters – you could use something similar to the following:

// echo program start and parameters

out.writeln("PPS CardConnect Reconciliation Program - Program start: "
+ PPSUtils.getDateTime() + "n");

int pCount = 0;
String rDate = null, mid = null;

out.writeln("Parameters submitted from CCM:n");

while(parms.hasMoreElements()) {
NameValueType parm = parms.nextParameter();
out.writeln("t(" + ++pCount + ") " + parm.getName() + " = ""
+ parm.getValue() + """);

   if(parm.getName().equalsIgnoreCase("p_date")) rDate = parm.getValue();
if(parm.getName().equalsIgnoreCase("p_mid" )) mid   = parm.getValue();
}

 

  • Signaling Completion Status – Use the ctx.getReqCompletion().setCompletion() method as appropriate.  Valid values for completion status are ERROR, NORMAL, PAUSE and WARNING
  • Log File and Out File Writes – The log method accepts a second parameter, which is an indication of the type of log entry, although I could not find supporting documentation.  Valid values are int 1..6.

Feel free to leave me any questions in the Comments below.  Good luck!