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:
http://ideone.com/ydUNgo
import java.util*;
import java.lang.*;
import java.io.*;
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
java.lang.java 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,
CM
One Star

Re: How does Java work in Talend?

Hi,
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.
Regards,
TRF

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

6 Ways to Start Utilizing Machine Learning with Amazon We Services and Talend

Look at6 ways to start utilizing Machine Learning with Amazon We Services and Talend

Blog