Hitachi Vantara Pentaho Community Forums
Results 1 to 5 of 5

Thread: how to use java in kettle

  1. #1

    Default how to use java in kettle

    I want to add some java code in the script step,but I don't now how to use to use the java class in kettle?:
    /* the var date is a field get from last step and have two kinds of formats 'dd/MM/yyyy' and 'yyyy-MM-dd' ,I want convert it to 'yyyyMMdd'
    //use the java code like this:

    var dateFormat=new java.text.SimpleDateFormat("yyyyMMdd");
    var PriceDate =dateFormat.parse(date);

    but there is a erro

    Couldn't execute this script! Error on position (5:0) :
    Wrapped java.text.ParseException: Unparseable date: "test value test value test value test value test value test value test value test value test value test value" (script#5)

  2. #2
    Join Date
    May 2006


    You can't test, but you can execute... I belief this was changed in 3.2

    What you see is that in old versions when you pressed the test button "dummy" data was inserted on the input... and if you did need a specific format in your data you were out of luck.


  3. #3


    not just test have erro ,but also the runing .I have questiong about use java in kettle .Should I add the local JDK and JRE lib path to the kettle's path(in the spoon.bat)? If not we can't use the basic object such as java.util.* ,java.text.* in kettle right?

  4. #4
    Join Date
    Nov 1999


    var dateFormat=new"yyyyMMdd");

  5. #5


    Quote Originally Posted by MattCasters View Post
    var dateFormat=new"yyyyMMdd");
    I have did by this way and when I run the test script and get avaiables that a erro like this
    "Wrapped java.text.ParseException: Unparseable date: "test value test value"" ,but when I priview it the date format is 'yyyy/MM/dd'
    Before this step I generate a rows and set the default value like 'yyyy-MM-dd'

    BTW,if we have a mixed data format filed,how to do this.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
Privacy Policy | Legal Notices | Safe Harbor Privacy Policy

Copyright © 2005 - 2019 Hitachi Vantara Corporation. All Rights Reserved.