Quantcast
Channel: Pentaho Community Forums
Viewing all articles
Browse latest Browse all 16689

Calling a Java Class From a Java Package (.jar)

$
0
0
Hi

I have developed a java class exported into a .jar library to be called by a Pentaho 'modified java script'. The .jar is compiled in Eclipse with JDC Compliance level 1.7).

When I try to use this class inside a 'modified java script', I get the error: ReferenceError: “xeroCallPackage” is not defined. I have tried lots of things without much luck so far.

My file xeroCallPackage.jar is in the path with the other *.jar files in Pentaho (..\data-integration\lib\)

For info:

1. The stripped down (for simplicity) java library code is here:

package xeroCallPackage;


import java.io.IOException;
import java.net.URISyntaxException;
import java.util.Collections;
import java.util.Map;


public class xeroURLCall {



public String getResponse(String CONSUMER_KEY, String CONSUMER_PRIVATE_KEY, String URL) throws IOException, OAuthException, URISyntaxException {

// stripped out code here


return response.readBodyAsString();
}

}


2. The stripped down Pentaho 'modified java script' is here:



java


var CONSUMER_KEY = "ffffff";
var CONSUMER_PRIVATE_KEY = "aaaaa";
var URL = "https://api.xero.com/api.xro/2.0/Organisation";


var ResponseAsString;



ResponseAsString = new xeroCallPackage.xeroURLCall.getResponse(CONSUMER_KEY,CONSUMER_PRIVATE_KEY,URL);

Viewing all articles
Browse latest Browse all 16689

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>