How to set java version in the exported autonomous (batch file) job

Highlighted
Six Stars

How to set java version in the exported autonomous (batch file) job

Can we set the java version in batch file which is exported as autonomus job?

 

Also, If i have java7 and java8 installed, how come changing the compliance level from studio makes the difference in using java version while running the job from console and from studio?


Accepted Solutions
Community Manager

Re: How to set java version in the exported autonomous (batch file) job

Here is how you can set the versions of Java inside your bat file. It is important to note that the best Java version to use is the JRE that comes with a JDK. This is a weird requirement (and may actually not be essential anymore....but it was, so I always use it) Anyway, your bat file will start like this.....

 

%~d0
cd %~dp0
java -Xms256M -Xmx4096M -cp .;../lib/routines.jar..........etc

Edit it to point to your JDK's JRE, like this....

 

%~d0
cd %~dp0
"C:/Program Files/Java/jdk1.8.0_91/jre/bin/java" -Xms256M -Xmx4096M -cp .;../lib/routines.jar..........etc

Note, that I am pointing my my JRE there. You will have to tailor it to your machine's JDK's JRE location.


All Replies
Moderator

Re: How to set java version in the exported autonomous (batch file) job

Hello,

For your question 1, do you want to specify another jvm to start up your talend open studio?

For your question 2, you can set JDK Compliance level in Studio Java Compiler preferences. 1.png

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.
Six Stars

Re: How to set java version in the exported autonomous (batch file) job

Thanks for reply.

 

Yes, I wan't to set specific jvm at the time of running the job from console. Ex, my job is running from Task Scheduler. And I want to use specific jvm. So is there any way to achieve this? like editing of batch file or passing any dos parameter in Tasks scheduler ?

 

Regarding setting compliance level, I am aware of the option of setting compliance level from studio. But my question is what exact difference it makes when we set the compliance level?

Community Manager

Re: How to set java version in the exported autonomous (batch file) job

Here is how you can set the versions of Java inside your bat file. It is important to note that the best Java version to use is the JRE that comes with a JDK. This is a weird requirement (and may actually not be essential anymore....but it was, so I always use it) Anyway, your bat file will start like this.....

 

%~d0
cd %~dp0
java -Xms256M -Xmx4096M -cp .;../lib/routines.jar..........etc

Edit it to point to your JDK's JRE, like this....

 

%~d0
cd %~dp0
"C:/Program Files/Java/jdk1.8.0_91/jre/bin/java" -Xms256M -Xmx4096M -cp .;../lib/routines.jar..........etc

Note, that I am pointing my my JRE there. You will have to tailor it to your machine's JDK's JRE location.

Six Stars

Re: How to set java version in the exported autonomous (batch file) job

Thanks a lot.

That's exactly what I wanted. 

Though in my case it works with jre as well as jdk Smiley Happy 

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Agile Data lakes & Analytics

Accelerate your data lake projects with an agile approach

Watch