× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.




Hi Jack,

The message says it can't find a logging class. If you look at:

http://pdfbox.apache.org/dependencies.html

you'll see it depends on some other items. The download page:

http://pdfbox.apache.org/download.html

leads me to believe that

pdfbox-app-1.6.0.jar 9.8MB, pre-built standalone binary

probably has everything you need, but I expect it needs to be run as an
executable jar so it can use the manifest for dependencies. That's my best
guess. I haven't used pdfbox and don't have the free time to go through the
process.

If I try it like this without the extra quotes, I see a different message
JAVA CLASS('org.apache.pdfbox.PDFBox') PARM('ExtractText /tmp/CONS.PDF' )
CLASSPATH('/JavaPDF/pdfbox-1.6.0.jar')

I expecty It doesn't recognize 'ExtractText /tmp/CONS.PDF' as any known argument and just exits.


Also, you asked:

Is there any advantage to using the JAVA command instead of QSH?

Clarity, IMO. QSH just takes a CMD keyword. In the normal case for
running/submission with variables, you can end up with something like this:

CHGVAR VAR(&CMDVAL) VALUE(&STRVAL *TCAT &SPACE *CAT +
&USER *TCAT &SPACE *CAT &DASHPWD *TCAT +
&SPACE *CAT &PASS *TCAT &SPACE)
QSH CMD(&CMDVAL)

That's from production code. While I had a reason to make that one obscure,
normally the CL command with individual keywords/parameters will be much
clearer to those who come after (and possibly yourself later).

Good Luck!


Joe Sam

Joe Sam Shirah - www.conceptgo.com (904) 302-6870
conceptGO - Consulting/Development/Outsourcing
Java Filter Forum: www.ibm.com/developerworks/java/
Just the JDBC FAQs: www.jguru.com/faq/JDBC
Going International? www.jguru.com/faq/I18N
Que Java400? www.jguru.com/faq/Java400






-----Original Message----- From: Jack Tucky
Sent: Tuesday, March 06, 2012 10:50 AM
To: 'Java Programming on and around the IBM i'
Subject: RE: Question about running a Java Class

Thanks for the reply.

I tried this but it didn't work. It seemed to get further, but I think it
might not be finding the PDF

JAVA CLASS('org.apache.pdfbox.PDFBox') PARM('ExtractText' '/tmp/CONS.PDF'
'/tmp/cons.txt' ) CLASSPATH('/JavaPDF/pdfbox-1.6.0.jar')


Exception in thread "Thread-0" java.lang.NoClassDefFoundError:
org/apache/commons/logging/LogFactory
at java.lang.Throwable.<init>(Throwable.java:196)

at java.lang.Error.<init>(Error.java:49)

at java.lang.LinkageError.<init>(LinkageError.java:36)

at
java.lang.NoClassDefFoundError.<init>(NoClassDefFoundError.java:40)

at
org.apache.pdfbox.pdfparser.BaseParser.<clinit>(BaseParser.java:58)

at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1087)

at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:1053)

at org.apache.pdfbox.pdmodel.PDDocument.load(PDDocument.java:978)

at
org.apache.pdfbox.ExtractText.startExtraction(ExtractText.java:196)

at org.apache.pdfbox.ExtractText.main(ExtractText.java:76)

at org.apache.pdfbox.PDFBox.main(PDFBox.java:42)

Java program completed with exit code 1


If I try it like this without the extra quotes, I see a different message
JAVA CLASS('org.apache.pdfbox.PDFBox') PARM('ExtractText /tmp/CONS.PDF' )
CLASSPATH('/JavaPDF/pdfbox-1.6.0.jar')


usage: java pdfbox-app-x.y.z.jar <command> <args..>
Java program completed with exit code 1




-----Original Message-----
From: java400-l-bounces@xxxxxxxxxxxx [mailto:java400-l-bounces@xxxxxxxxxxxx]
On Behalf Of Joe Sam Shirah
Sent: Tuesday, March 06, 2012 10:25 AM
To: Java Programming on and around the IBM i
Subject: Re: Question about running a Java Class


Hi Jack,

David's answer is close but I wouldn't expect it to work as is. The
reason is that "ExtractText" and "cons.pdf" are separate arguments or
parameters. IOW, using your doc example:

usage: java -jar pdfbox-app-x.y.z.jar ExtractText [OPTIONS] <PDF file> [Text

file]

everything after the jar are arguments, including the ExtractText "command".

So, for JAVA/RUNJVA use PARM( 'ExtractText' 'cons.pdf' ), add any other
arguments as necessary.

If you run the jar as executable, your classpath should just need to be
"/JavaPDF". If you run the class as in the example, your classpath should
be "/JavaPDF/pdfbox-1.6.0.jar". The reason is that an executable jar has
its entry point (class to load) defined in the manifest.

HTH,


Joe Sam

Joe Sam Shirah - www.conceptgo.com (904) 302-6870
conceptGO - Consulting/Development/Outsourcing
Java Filter Forum: www.ibm.com/developerworks/java/
Just the JDBC FAQs: www.jguru.com/faq/JDBC
Going International? www.jguru.com/faq/I18N
Que Java400? www.jguru.com/faq/Java400




-----Original Message----- From: David Gibbs
Sent: Tuesday, March 06, 2012 9:51 AM
To: Java Programming on and around the IBM i
Subject: Re: Question about running a Java Class

On 3/5/2012 7:10 PM, Jack Tucky wrote:
I was able to get the extract to work on my PC using this command.
Can anyone help me "convert" the syntax to Iseries?

Try this:

qsh cmd('java -cp pdfbox-app-1.6.0.jar org.apache.pdfbox.PDFBox
ExtractTextcons.pdf')

or this:

JAVA CLASS('org.apache.pdfbox.PDFBox') PARM('ExtractTextcons.pdf')
CLASSPATH('pdfbox-app-1.6.0.jar')

david



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.