Java component - only runs in java debug mode

One Star

Java component - only runs in java debug mode

I'm relatively new to Talend.  I am trying to incorporate loading data into Sesame into an existing ETL process.
I have created a job, and have a tJava component.  I have loaded the external jar files needed to make this work.  I have tested this code out in Eclipse, and it works fine.  But when I bring the code into Talend, it will only work in Java Debug mode.  When I try to run it any other way within Talend, I receive the error below.  I can print out the classpath in debug mode, and have verified that the jar file in question exists where Talend is looking for it.
Is the classpath different between debug and runtime?  Any other suggestions?  If you think it will help, I am happy to post the code, it is only about 20 lines.  But the fact that it runs successfully in debug mode suggests something other than the code...
Thank you,
Carl.
Starting job Refresh_Sesame_API at 01:08 16/10/2015.
java.lang.NoClassDefFoundError: org/openrdf/rio/RDFParseException
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.privateGetMethodRecursive(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at sun.launcher.LauncherHelper.validateMainClass(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.openrdf.rio.RDFParseException
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 7 more
Error: A JNI error has occurred, please check your installation and try again
Exception in thread "main" 
Job Refresh_Sesame_API ended at 01:08 16/10/2015.
Sixteen Stars

Re: Java component - only runs in java debug mode

This does sound strange, but Talend doesn't always play nicely with external Jars if you use them as you would with Eclipse minus Talend. How are you including your Jars? Are you using a tLibraryLoad component? If not, try this. You should ensure that this component is called prior to you using the Jars in your tJava component's code. Another way to try and fix this is to write your code in a routine (a Java class) and add the Jars to the routine by right clicking on it and selecting "Edit routine libraries". You can then use your routine code in your tJava (or many other Talend components).
One Star

Re: Java component - only runs in java debug mode

I moved the code to a routine and called the routine from the Java component.
Works.
Thank you!