Setting the Java version when using ExportJob (command line)

One Star

Setting the Java version when using ExportJob (command line)

We are currently using Java 5 and are now moving to Java 6. What do we need to set (environment variables / registry settings etc), to ensure that we build the jobs with the correct version of Java? We use the commandline to perform the builds on a windows XP Pro platform.
Many thanks in advance.
Dave
One Star

Re: Setting the Java version when using ExportJob (command line)

Hi Dave
For commandline, please change the Java environment variables.
Regards,
Pedro
One Star

Re: Setting the Java version when using ExportJob (command line)

Hi Pedro,
We already do this ? I set 2 variables JAVA_JRE (this is set to the target jre\bin folder) & JAVA_HOME (set to the target jdk folder)
These are both added to our Path variable.
We then call the comandline:
Talend-win32-x86.exe" -nosplash -application org.talend.commandline.CommandLine -consoleLog -data commandline-workspace scriptFile TALEND_JOB_CommandLineScript
TALEND_JOB_CommandLineScript contains:
initRemote http://url/org.talend.administrator
logonProject -pn project -ul username -up password
exportJob jobname -dd output-dir -jc Default -af jobname
logoffProject
I can guarantee that JRE components used in the build come from the location specified in JAVA_JRE, but JDK components do not come from the location specified in JAVA_HOME.
Many thanks
Dave
One Star

Re: Setting the Java version when using ExportJob (command line)

Hi
We have built a job changing the settings to use a Java 6 environment, but it is still building to version 1.5. I ran a class file through Javap. The following was present in the output.
Compiled from "BULK_EXTRACT_ORDSRV_RO_DETL.java"
class dfreg.bulk_extract_ordsrv_ro_detl_0_1.BULK_EXTRACT_ORDSRV_RO_DETL$1ComparableLoad_Context_1_VALUESStruct extends dfreg.bulk_extract_ordsrv_ro_detl_0_1.BULK_EXTRACT_ORDSRV_RO_DETL$Load_Context_1_VALUESStruct implements java.lang.Comparable
SourceFile: "BULK_EXTRACT_ORDSRV_RO_DETL.java"
Signature: length = 0x2
00 35
EnclosingMethod: length = 0x4
00 37 00 39
InnerClass:
#61= #1; //ComparableLoad_Context_1_VALUESStruct=class dfreg/bulk_extract_ordsrv_ro_detl_0_1/BULK_EXTRACT_ORDSRV_RO_DETL$1ComparableLoad_Context_1_VALUESStruct
public #62= #3 of #55; //Load_Context_1_VALUESStruct=class dfreg/bulk_extract_ordsrv_ro_detl_0_1/BULK_EXTRACT_ORDSRV_RO_DETL$Load_Context_1_VALUESStruct of class dfreg/bulk_extract_ordsrv_ro_detl_0_1/BULK_EXTRACT_ORDSRV_RO_DETL
minor version: 0
major version: 49
Constant pool:
Not
minor version: 0
major version: 50
We need to be able to deploy jobs built to Java 1.6 very soon so need to know how to configure ExportJob to use a specific JDK.
Many thanks Dave
Community Manager

Re: Setting the Java version when using ExportJob (command line)

Hi Dave
Try to set the <JRE installation path>/bin/ to the system PATH variable. For example, here is the value of my PATH variable:
E:\app\Java1\jre1.6.0\bin;C:\Program Files\Common Files\NetSarang;E:\app\oracle\bin;E:\app\oracle\jre\1.4.2\bin\client;E:\app\oracle\jre\1.4.2\bin;%SystemRoot%\system32;%SystemRoot%;%SystemRoot%\System32\Wbem;...
Aslo, you can specify a JRE by setting -vm parameter in the startup script when launching Commandline. If we have multiple JRE installation on one machine, we can specify one JRE to launch Java application instead of modifying the system PATH variable. for example:
Talend-win32-x86.exe -vm E:\app\Java1\jre1.6.0\bin -nosplash -application org.talend.commandline.CommandLine -consoleLog -data commandline-workspace scriptFile TALEND_JOB_CommandLineScript

Best regards
Shong
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: Setting the Java version when using ExportJob (command line)

Hi Shong,
This is exactly what we are doing. We have now tried using the ?vm option in the call to Talend-win32-x86.exe as well ? we can happily compile with this pointing to the jre1.6.0_17 ? the trouble is, as explained above, this builds uses a class files with a major version of 49, not 50, so we are compiling with java 1.5.
Again as I?ve said above, this is not suprising ? javac, the compiler, is not part of jre, it is part of jdk.
We need, and are asking you, what is the mechanism to ensure that we use the java compiler that we want to ? our build machines need to have different compilers (at different versions) for different products ? we do not just build Talend, and we need to be able to specify which compiler to use ? that means we need either a variable or registry setting to ensure that we are compiling with the correct compiler.
Regards
Dave
Community Manager

Re: Setting the Java version when using ExportJob (command line)

Hi Dave
One quick question, all the jobs are built with java 1.5 even though you have specified java 1.6 to lanuch the commandline or only this job?
----------------------------------------------------------
Talend | Data Agility for Modern Business
One Star

Re: Setting the Java version when using ExportJob (command line)

Hi Shong,
We use FinalBuilder to build all of the software we develop. The Talend jobs are built using a generic control script called by FinalBuilder. This script has been modified to point to our Java 1.6 jre. We have tried to build 2 different jobs, each with the same result ? the 1.6 jre is used, but the class files output are built to Java 1.5.
How do we specify java 1.6 when launching the commandline. Specifying the jre version does not determine the java compiler that is used ? this is in the jdk
Regards
Dave
One Star

Re: Setting the Java version when using ExportJob (command line)

Hi We have done further work on this but are still having issues building jobs to Java 6 (JDK 1.6). These are the steps that have been taken (we are using Clearcase to hold the version of teh JDK we build against).
1) I have added to the jdk to ClearCase
2) I have added ?vm jdk-location to my Talend_win32-x86.ini file
3) I have set my Code Compliance to 1.6 in Studio.
4) I have run the build ? the call to do the build is:
a. "C:\Program Files\Talend\Talend-All-r76583-V4.2.4\Talend-win32-x86.exe" -nosplash -application org.talend.commandline.CommandLine -consoleLog -data commandline-workspace scriptFile C:\\temp\\Talend\\FB\\EXTRACT_REG_ROLE_CommandLineScript
b. C:\\temp\\Talend\\FB\\EXTRACT_REG_ROLE_CommandLineScript is
5) The zip file builds ok.
6) The command are run in a ClearAudit shell (this is part of ClearCase, and records every file within CearCase that has been touched as part of the process.
7) Analysis of EXTRACT_REG_ROLE.zip, using the learCase catcr tool, shows that javaw.exe and a series of files in the jre are accessed from the jdk location specified in (2) above.
8) However, there is no access to javac in this output, demonstration that the compiler being used is NOT from my jdk location.
9) Using javap against one of the classfiles produced in the.zip gives a major version of 49.
10) All of this indicates that dispite the changes that we have made are still not invoking the java compiler in the location that we want.
One Star

Re: Setting the Java version when using ExportJob (command line)

We have renamed every occurrence of javac.exe (the java compiler) on the build PC, and run the command-line export, which ran successfully.
We then renamed the only occurrence of javac.exe on our server, and again ran the command-line export, which was successful.
Additionally I can export a job from within the TIS, even though there is no javac on the machine, and explicitly not one in either the jre location specified in Talend-win32-x86.ini, nor in the location specified in the Java Intepreter field on the Talend tab in TIS preferences.
Does this mean that Talend does not use javac.exe to compile it?s code, or that Talend has its own copy of the compiler embedded?