Version 9.5 SP1
 —  EntireX Java Wrapper for Natural  —

Writing Applications with the Java Wrapper for Natural

Following is a simple Java client application that uses the generated Java interface object's calc method to implement an add operation:

package my.business;

import com.softwareag.entirex.aci.Broker;

public class Add {
	
	private Mylib m = new Mylib(new Broker(Mylib.DEFAULT_BROKERID, "user"), Mylib.DEFAULT_SERVER);
	
	public int add(int operand1, int operand2) throws Exception {
		m.setNaturalLogon(true);			// NaturalONE RPC server requires logon
		m.calc("+", operand1, operand2);
		return m.getCalcResult();
	}
	
	public static void main(String[] args) {
		try {
			System.out.println("Result is: " + new Add().add(1,2));
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
}

Top of page