Menu ▾ ▴

#59 CLR.CLS (ooRexx.NET) cannot initialize jni4net 0.8.8 on Java 11+: LinkageError on System.runFinalizersOnExit

Next Release
wont-fix
None
5
2 days ago
2 days ago
No

Hello Rony,

ooRexx.NET does not start on my machine: the first clr.import fails because jni4net cannot initialize its bridge under a current Java.

Environment:

  • Windows 11 (10.0.26200), x64
  • ooRexx 5.2.0 r13156
  • BSF4ooRexx 850, refresh v850-20261024 (bsf4ooRexx-v850-20261024-bin.jar)
  • Java: IBM Semeru Runtime Open Edition 21.0.5.11 (OpenJ9 0.48.0), 64-bit
  • .NET Framework 4.8 (release 533509)
  • CLR.CLS 100.20160812, jni4net 0.8.8.0 as shipped in lib\ and clr\

Smallest failing program:

path = clr.import("System.IO.Path")
say path~GetTempPath
::requires "CLR.CLS"

Result: Error 40.900 from BSF.CLS: "net.sf.jni4net.inj.INJException: Can't initialize jni4net Bridge", raised by CLR.CLS's .clr.dir~bridge~bsf.dispatch("init") while ::requires "CLR.CLS" runs.

With net.sf.jni4net.Bridge~setVerbose(.true) before init, jni4net reports the cause:

loading core from C:/WINDOWS/assembly/GAC_MSIL/jni4net.n-0.8.8.0/0.8.8.0__134a23405600bab4/jni4net.n-0.8.8.0.dll
Can't bind bridge:Can't initialize proxy java.lang.System
... java.lang.LinkageError: java/lang/System.runFinalizersOnExit(Z)V ...
   at net.sf.jni4net.jni.JNIEnv.GetStaticMethodID(Class clazz, String name, String sig)
   at java.lang.System.InitJNI(JNIEnv __env, Class __class)
   ...
   at net.sf.jni4net.Bridge.BindCore(JNIEnv env, BridgeSetup newSetup)

jni4net 0.8.8's generated .NET proxy for java.lang.System binds System.runFinalizersOnExit, which Java 11 removed (deprecated since 1.2), so binding the core proxies fails on any Java from 11 on. Raffel's 2015 thesis lists Oracle Java 8 as the prerequisite, which fits.

Possible remedies I can see: a jni4net core rebuilt from proxies generated against Java 11+ (without runFinalizersOnExit), or a note in the documentation and the installer that ooRexx.NET needs Java 8. Is a rebuilt jni4net available, or planned?

Thank you,

Seymour J. Metz (H: Shmuel שמואל בן לייביש ולאה)

(Drafted with the help of Claude, an AI engine; reviewed by me.)

Discussion

  • Rony G. Flatscher

    Hi Shmuel,
    yes this is a permanent restriction as the used library breaks with Java's internal changes starting with Java 11, so you need to use Java 8 for this functionality of BSF4ooRexx. This is not as terrible/difficult as it may seem as it easy to have multiple Java versions installed on the same machine.
    The restriction is permanent as there is a new .NET library for ooRexx 5.3.0 beta in development, which includes CLR.CLS support. It already runs all of the BSF4ooRexx .Net samples and supplies CLR.CLS für backward support for those programs that got already written with the BSF4ooRexx infrastructure. Also, that library loads much faster as it does not have to load Java first.
    So, currently: you should use Java 8 to run .Net applications via BSF4ooRexx. Alternatively, you could already use the portable version of ooRexx 5.3.beta with the .NET library (modeled after BSF4ooRexx as the libraries to Python, Lua and JS) from Josep Maria Blasco's github.
    Cheers
    ---rony

     
  • Rony G. Flatscher

    • status: open --> wont-fix
    • assigned_to: Rony G. Flatscher
     

Log in to post a comment.