Using a Java class / jar

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

Kaprice
Ebase User
Posts: 12
Joined: Sat Apr 04, 2015 3:43 pm
Contact:

Using a Java class / jar

#1

Postby Kaprice » Mon Jul 27, 2015 10:15 pm

I have a java class that creates and combines PDFs.

If't in the WEB-INF/classes/lib folder

I've referenced it as an external resource in Form Properties.

Beyond that, I can't figure out how to use it.

Do I have to do an importPackage in my script?

Nothing I've tried seems to give my script access to any of the functionality of this class.

This is the code:

Code: Select all

importPackage(com.ebasetech.xi.api);
importPackage(com.ebasetech.xi.services);
importPackage(org.apache.pdfbox.util.PDFMergerUtility);

 var merger = new PDFMergerUtility();
This is the error I'm getting:
com.ebasetech.ufs.runtime.events.rhinojavascript.JavascriptExecutionHandler$RhinoScriptException: Function importPackage must be called with a package; had "[JavaClass org.apache.pdfbox.util.PDFMergerUtility]" instead. (MERGEPDFS#3)


And, if I remove the importPackage line, I get this error:
com.ebasetech.ufs.runtime.events.rhinojavascript.JavascriptExecutionHandler$RhinoScriptException: ReferenceError: "PDFMergerUtility" is not defined. (MERGEPDFS#5)
What am I missing?
0 x
Kap

User avatar
dvanhussel
Ebase User
Posts: 161
Joined: Fri Oct 19, 2007 12:45 pm
Location: Haarlem, the Netherlands

#2

Postby dvanhussel » Mon Jul 27, 2015 11:49 pm

Hi,

The error Message means that PDFMergerUtility is a class, not a package.

I think that

Code: Select all

importPackage(org.apache.pdfbox.util);
Will work.

Regards,
David
0 x

Kaprice
Ebase User
Posts: 12
Joined: Sat Apr 04, 2015 3:43 pm
Contact:

#3

Postby Kaprice » Tue Jul 28, 2015 12:36 am

WOOHOO! That did the trick. I haven't tested past that first line, but we're past the reference error, so this is great news.

Thank you so much!
0 x
Kap


Who is online

Users browsing this forum: No registered users and 22 guests