How does Java work in Talend?

Four Stars

How does Java work in Talend?

I am trying to learn Java within Talend and seems to be running into errors. The code works fine here:
import java.util*;
import java.lang.*;
class Stringdemo
public static void main (String [] args) throws java.lang.Exception
String str1 = "Jake Wagner";
String str2 = "Tony Ruggeri";
String str3 = "tony ruGGeri";

// checking for equality
boolean retval1 = str2.equals(str1);
boolean retval2 = str2.equalsIgnoreCase(str3);

// prints the return value
System.out.println("str2 is equal to str1 = " + retval1);
System.out.println("str2 is equal to str3 = " + retval2);


Error in Talend using tJava:
Exception in thread "main" java.lang.Error: Unresolved compilation problems: 
Syntax error on token "import", assert expected
java.util cannot be resolved to a type
Syntax error on tokens, delete these tokens cannot be resolved to a type
Syntax error on tokens, delete these tokens
Syntax error on token "*", class expected
The method main cannot be declared static; static methods can only be declared in a static or top level type
Any assistance would be appreciated.
Thanks in Advance,
One Star

Re: How does Java work in Talend?

Move import to Advanced setting tab dedicated section.
If you need to declare classes and methods, use routine. In tJava* components, just use plain Java.

What’s New for Talend Spring ’19

Watch the recorded webinar!

Watch Now

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.



Introduction to Talend Open Studio for Data Integration.


Downloads and Trials

Test drive Talend's enterprise products.