Run the JGNAT program?

I just installed JGNAT on Windows ( gnat-gpl-2010-jvm-bin.exe )

This is a sample hello.adb code from the supplied manual:

with Ada.Text_IO; use Ada.Text_IO;
 procedure Hello is
 begin
    Put_Line ("Hello GNAT for the JVM.");
 end Hello;

Compile it first: jvm-gnatmake hello.adb

jvm-gnatcompile -c hello.adb
jvm-gnatbind -x hello.ali
jvm-gnatlink hello.ali

Looks nice. So let it run it: java hello

Exception in thread "main" java.lang.NoClassDefFoundError: jgnat/adalib/GNAT_libc
    at hello.main(hello.adb)
Caused by: java.lang.ClassNotFoundException: jgnat.adalib.GNAT_libc
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 1 more

Any idea why?

+3
source share
1 answer

Here's the fix. You must set the path to the jar file containing the GNAT_libc.class file.

java -cp C:\GNATPRO\2010\lib\jgnat.jar;. hello
+2
source

Source: https://habr.com/ru/post/1785242/


All Articles