Standalone job: Need help with java calling sequence, jar files

One Star

Standalone job: Need help with java calling sequence, jar files

Hi Everyone,
I am using Talend (for Data Integration, 6.0.0 on OS X, java version "1.8.0_45") to
export and construct jobs that will need to run on a cloud service like iron.io.  I
can export the job and get it to run successfully on my local machine using the .sh
script created by Talend.  I am running into an issue when trying to get the code to
run on iron.io, and I think it might come down to differences in how the java code is
being called.  My question pertains to the fundamentals of java rather than the specifics
of Talend or iron.io. Let me explain.
1) I currently build a job called ironiotest_0_1. Talend ouputs a jar file called
ironiotest_0_1.jar plus jar files for other supporting libraries needed for the
execution.  ironiotest_0_1.jar contains the contents:
META-INF/
META-INF/MANIFEST.MF
test/
test/ironiotest_0_1/
test/ironiotest_0_1/ironiotest$1.class
test/ironiotest_0_1/ironiotest$ContextProperties.class
test/ironiotest_0_1/ironiotest$row2Struct.class
test/ironiotest_0_1/ironiotest$TalendException.class
test/ironiotest_0_1/ironiotest.class
2) The script from Talend reads like:
java -cp test.ironiotest_0_1.ironiotest
This command works fine on my local machine. I put all the supporting jar files into the
working directory in order to simulate how things will be arranged on iron.io.
3) Iron.io builds execution scripts using the alternate
java -cp -jar ironiotest_0_1.jar
syntax.  This does not work on the server or my local machine.  My local machine gives
"Error: Could not find or load main class test.ironiotest_0_1.ironiotest"
Is there something I can do to the jar file (e.g., update or repack it) to
make iron.io's preferred syntax work?  Note, I have tried adding a "manifest.txt" containing
"Main-Class: test.ironiotest_0_1.ironiotest" to the top level of the ironiotest_0_1.jar file.
This does not fix the issue (unless the manifest.txt needs to be put elsewhere in the jar?).
Thanks!
Moderator

Re: Standalone job: Need help with java calling sequence, jar files

Hi,
The job run successfully in your studio and Local machine? Is there any Java environments on cloud service?
Best regards
Sabrina
--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
One Star

Re: Standalone job: Need help with java calling sequence, jar files

Hi Sabrina, thanks for replying.  Yes, the job runs fine on the local machine in the studio and in the terminal when I use the
java -cp test.ironiotest_0_1.ironiotest
syntax.  It fails when I use the alternate syntax
java -cp -jar ironiotest_0_1.jar
and I do not understand why.
The Java environment on iron.io is version 1.7, which is slightly older than what I have locally.