1

For example, i have java class JRXlsExporter, if i instantiated that java from java my code is :

    JRXlsExporter myObject= new JRXlsExporter();

and from PHP become:

    $myObject = new Java("net.sf.jasperreports.engine.export.JRXlsExporter");

It works, but if i have java class with parameter, for example :

    JRXlsExporter myObject= new JRXlsExporter(param1,param2);

How to instantiate/call that java class from PHP ?

1 Answer 1

2

Here is an example of how java.util.Date object is instantiated, with some constructor arguments:

$date = new Java("java.util.Date", 70, 9, 4);

Further, it says:

The new Java("java.util.Date", 70, 9, 4) call creates a new instance of the java.util.Date class using the java.util.Date(int year, int month, int day) constructor.

So, you could maybe try this:

$myObject = new Java("net.sf.jasperreports.engine.export.JRXlsExporter", param1, param2);
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.