* Calling JGNAT task from a Java applet?
@ 2002-04-24 15:23 John Kern
0 siblings, 0 replies; only message in thread
From: John Kern @ 2002-04-24 15:23 UTC (permalink / raw)
Has anyone ever succeeded in calling an Ada task from a Java applet? I
get
the following runtime error when invoking my Java program containing:
-------[snip]-------------from my applet Java code----
controller control; \\ control is of type controller
public viod run()
{
control.init(); \\ init should initialize the Ada runtime Adainit
\\ from ada_testcontroller.adainit
with the line:
D:\WSU\ECE7990\ControlProject\GUI>appletviewer otest.html
java.lang.NoClassDefFoundError: jgnat/adalib/GNAT_libc
at controller.init(controller.adb:41)
at PhysicalPlant.run(PhysicalPlant.java, Compiled Code)
at java.lang.Thread.run(Thread.java:472)
followed when exiting the applet by:
java.security.AccessControlException: access denied
(java.lang.RuntimePermission modifyThread )
at
java.security.AccessControlContext.checkPermission(AccessControlConte
xt.java, Compiled Code)
at
java.security.AccessController.checkPermission(AccessController.java,
Compiled Code)
at
java.lang.SecurityManager.checkPermission(SecurityManager.java,
Compi
led Code)
at
sun.applet.AppletSecurity.checkAccess(AppletSecurity.java:106)
at java.lang.Thread.checkAccess(Thread.java:1036)
at java.lang.Thread.stop(Thread.java:560)
at PhysicalPlant.stop(PhysicalPlant.java:727)
at sun.applet.AppletPanel.run(AppletPanel.java:371)
at java.lang.Thread.run(Thread.java:472)
This is my controller.ads
-------------------------------------
pragma Extensions_Allowed (On);
with Java; use Java;
package Controller is
task Controller_Task;
procedure Init;
end Controller;
pragma Export (Java, Controller, "controller");
pragma Extensions_Allowed (Off);
---------------------------------------
This is my controller.adb:
------------------------------------------
pragma Extensions_Allowed (On);
with Ada.Text_IO; use Ada.Text_IO;
with Ada.Calendar; use Ada.Calendar;
with Sensor_Interface;
with Actuator_Interface;
package body Controller is
Start: Time;
task body Controller_Task is
Interval: constant Duration := 1.0;
Next: Time := Clock + Interval;
begin
Start := Clock;
loop
delay until Next;
Ada.Text_IO.put('*' & ascii.BEL);
Ada.Text_IO.put_line(sensor_interface.position'image(sensor_interface.read_p
osition));
Next := Next + Interval;
end loop;
end Controller_Task;
procedure Init is
procedure Adainit;
pragma Import (Ada, Adainit, "ada_testcontroller.adainit");
begin
Adainit;
end Init;
end Controller;
pragma Extensions_Allowed (Off);
---------------------------------------------
And this program testcontroller.adb
------------------------------------------
with Controller; use Controller;
procedure testcontroller is
begin
null;
end testcontroller;
-------------------------------------------
runs fine with the commands:
D:\WSU\ECE7990\ControlProject\GUI>java -version
java version "1.2.2"
Classic VM (build JDK-1.2.2_011, native threads, symcjit)
D:\WSU\ECE7990\ControlProject\GUI>java testcontroller
* 0.00000E+00
* 0.00000E+00
* 0.00000E+00
^C
D:\WSU\ECE7990\ControlProject\GUI>
It seems like I can only get a runtime ada_testcontroller.class
(containing
adainit) when I build the testcontroller program, but it is not
otherwise
necessary for building the Java applet. I'm not sure what is being
referred
to by the initial error message:
jgnat/adalib/GNAT_libc
because my e:\gnat\jgnat-1.1p\lib\jgnat\adalib directory has no
subdirectories nor a GNAT_libc file.
Can anybody supply additional insight?
TIA
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2002-04-24 15:23 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2002-04-24 15:23 Calling JGNAT task from a Java applet? John Kern
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox