Search code examples
javajarpentahokettledata-integration

Pentaho Data Integration User Defined Java Class


I create simple java class and export it to jar:

package test;
public class Test {

    public Test() {
        // TODO Auto-generated constructor stub
    }

}

Jar file add to lib folder in Pentaho (there are many jar files) Next step I want to use my class in Pentaho Data Integration so I created User Defined Java Class:

public boolean processRow(StepMetaInterface smi, StepDataInterface sdi) throws KettleException
{
    test.Test t = new test.Test();
    return true;
}

When I click Test class I get the following information:

Line 3, Column 12: Class "test.Test" not found

So I have a question: Where is the mistake and why is the class not found?


Solution

    1. Try checking the launcher.property file inside the /design-tools/data-integration/launcher folder. Make sure that the classpath and the libraries are having the path of the jar defined. Since you have placed your JAR file inside the lib folder, look for that.

    enter image description here

    1. Restart the Spoon after editing and it would work ideally.

    I have placed the code inside the libext folder, so i have added :../libext to the classpath and libraries. And below is the code snip:

    enter image description here

    In case it still throws an error, try checking the Java code again. I assume something might have gone wrong there.

    Also documented the above in here.

    Hope it helps :)