Java applications


Some API also exist for java in the shape of the classes Gdh, Errh and Qcom. Below is
an example of a java application attaching the realtime database and reading and writing
an attribute.

import jpwr.rt.*;

public class MyJappl {
   public MyJappl() {
     Gdh gdh = new Gdh( null);

     CdhrBoolean rb = gdh.getObjectInfoBoolean( "H1-H2-Start.ActualValue");

     PwrtStatus rsts = gdh.setObjectInfo( "H1-H1-Start.ActualValue",
!rb.value);
   }

   //Main method
   public static void main(String[] args) {
     new MyJappl();
   }
}

To compile and execute you have to put $pwr_lib/pwr_rt.jar and the working directory into
CLASSPATH, and $pwr_exe into LD_LIBRARY_PATH

> export CLASSPATH=$pwr_lib/pwr_rt.jar:$pwrp_src/myjappl
> export LD_LIBRARY_PATH=$pwr_exe

Compile with
> javac MyJappl.java

and execute with
> java MyJappl

For auto start of the application you create a shellscript that exports CLASSPATH and
LD_LIBRARY_PATH, and starts the java application. The script is inserted into the appl-file
in the same way as a c application.