Menu

Robocode error with .net plugin

Help
2019-06-20
2019-06-22
  • Marcio Sousa

    Marcio Sousa - 2019-06-20

    I installed robocode 1.9.3.3, tested it and it worked perfectly (I created one and compiled everything normally), after installation of the .net plugin is no longer opening, can you help me? Here's the error:

    C:\robocode>java -Xmx512M -cp libs/robocode.jar;libs/jni4net.j-0.8.7.0.jar -XX:+
    IgnoreUnrecognizedVMOptions "--add-opens=java.base/sun.net.www.protocol.jar=ALL-
    UNNAMED" "--add-opens=java.base/java.lang.reflect=ALL-UNNAMED" "--add-opens=java
    .desktop/sun.awt=ALL-UNNAMED" robocode.Robocode
    Loaded net.sf.robocode.api
    Loaded net.sf.robocode.core
    Loading plugins from C:\robocode\libs
    Loaded net.sf.robocode.battle
    Can't bind bridge:Can't initialize proxy java.lang.System
    Can't bind bridge:net.sf.jni4net.jni.JNIException: Can't initialize proxy java.l
    ang.System ---> System.Reflection.TargetInvocationException: Uma exceção foi aci
    onada pelo destino de uma chamada. ---> java.lang.LinkageError: runFinalizersOnE
    xit
    em net.sf.jni4net.jni.JNIEnv.ExceptionTest()
    em net.sf.jni4net.jni.JNIEnv.GetStaticMethodID(Class clazz, String name, Stri
    ng sig)
    em java.lang.System.InitJNI(JNIEnv __env, Class __class)
    --- Fim do rastreamento de pilha de exceções internas ---
    em System.RuntimeMethodHandle.InvokeMethod(Object target, Object[] arguments,
    Signature sig, Boolean constructor)
    em System.Reflection.RuntimeMethodInfo.UnsafeInvokeInternal(Object obj, Objec
    t[] parameters, Object[] arguments)
    em System.Reflection.RuntimeMethodInfo.Invoke(Object obj, BindingFlags invoke
    Attr, Binder binder, Object[] parameters, CultureInfo culture)
    em System.Reflection.MethodBase.Invoke(Object obj, Object[] parameters)
    em net.sf.jni4net.utils.Registry.RegisterStaticAndMethods(RegistryRecord reco
    rd, JNIEnv env)
    --- Fim do rastreamento de pilha de exceções internas ---
    em net.sf.jni4net.utils.Registry.RegisterStaticAndMethods(RegistryRecord reco
    rd, JNIEnv env)
    em net.sf.jni4net.utils.Registry.BindJvm(RegistryRecord record, ClassLoader c
    lassLoader, JNIEnv env)
    em net.sf.jni4net.utils.Registry.BindJvm(RegistryRecord record, JNIEnv env)
    em net.sf.jni4net.utils.Registry.RegisterType(Type type, Boolean bindJVM, JNI
    Env env)
    em net.sf.jni4net.utils.Registry.RegisterAssembly(Assembly assembly, Boolean
    bindJVM)
    em net.sf.jni4net.Bridge.RegisterAssembly(Assembly assembly)
    em net.sf.jni4net.Bridge.BindCore(JNIEnv env, BridgeSetup newSetup)
    em net.sf.jni4net.Bridge.initDotNetImpl(IntPtr envi, IntPtr clazz)
    Can't initialize jni4net BridgeC
    net.sf.jni4net.inj.INJException: Can't initialize jni4net Bridge
    at net.sf.jni4net.CLRLoader.init(CLRLoader.java:56)
    at net.sf.jni4net.CLRLoader.init(CLRLoader.java:42)
    at net.sf.jni4net.Bridge.init(Bridge.java:46)
    at net.sf.robocode.dotnet.host.Module.Init(Module.java:51)
    at net.sf.robocode.dotnet.host.Module.<clinit>(Module.java:28)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInsta
    nce0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInsta
    nce(NativeConstructorAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newI
    nstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constru
    ctor.java:500)
    at java.base/java.lang.reflect.ReflectAccess.newInstance(ReflectAccess.j
    ava:166)
    at java.base/jdk.internal.reflect.ReflectionFactory.newInstance(Reflecti
    onFactory.java:404)
    at java.base/java.lang.Class.newInstance(Class.java:590)
    at net.sf.robocode.core.Container.loadModule(Container.java:154)
    at net.sf.robocode.core.Container.loadJars(Container.java:142)
    at net.sf.robocode.core.Container.loadFromPath(Container.java:120)
    at net.sf.robocode.core.Container.<clinit>(Container.java:83)
    at net.sf.robocode.core.RobocodeMainBase.robocodeMain(RobocodeMainBase.j
    ava:39)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Nativ
    e Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Native
    MethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(De
    legatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:567)
    at net.sf.robocode.security.HiddenAccess.robocodeMain(HiddenAccess.java:
    281)
    at robocode.Robocode.main(Robocode.java:27)
    Caused by: net.sf.jni4net.inj.INJException: C
    at net.sf.jni4net.Bridge.initDotNet(Native Method)
    at net.sf.jni4net.CLRLoader.init(CLRLoader.java:48)
    ... 22 more</clinit></clinit>

    java.lang.Error: Can't initialize .NET Robocode
    at net.sf.robocode.dotnet.host.Module.Init(Module.java:70)
    at net.sf.robocode.dotnet.host.Module.<clinit>(Module.java:28)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInsta
    nce0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInsta
    nce(NativeConstructorAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newI
    nstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constru
    ctor.java:500)
    at java.base/java.lang.reflect.ReflectAccess.newInstance(ReflectAccess.j
    ava:166)
    at java.base/jdk.internal.reflect.ReflectionFactory.newInstance(Reflecti
    onFactory.java:404)
    at java.base/java.lang.Class.newInstance(Class.java:590)
    at net.sf.robocode.core.Container.loadModule(Container.java:154)
    at net.sf.robocode.core.Container.loadJars(Container.java:142)
    at net.sf.robocode.core.Container.loadFromPath(Container.java:120)
    at net.sf.robocode.core.Container.<clinit>(Container.java:83)
    at net.sf.robocode.core.RobocodeMainBase.robocodeMain(RobocodeMainBase.j
    ava:39)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Nativ
    e Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Native
    MethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(De
    legatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:567)
    at net.sf.robocode.security.HiddenAccess.robocodeMain(HiddenAccess.java:
    281)
    at robocode.Robocode.main(Robocode.java:27)
    Caused by: net.sf.jni4net.inj.INJException: Can't initialize jni4net Bridge
    at net.sf.jni4net.CLRLoader.init(CLRLoader.java:56)
    at net.sf.jni4net.CLRLoader.init(CLRLoader.java:42)
    at net.sf.jni4net.Bridge.init(Bridge.java:46)
    at net.sf.robocode.dotnet.host.Module.Init(Module.java:51)
    ... 19 more
    Caused by: net.sf.jni4net.inj.INJException: C
    at net.sf.jni4net.Bridge.initDotNet(Native Method)
    at net.sf.jni4net.CLRLoader.init(CLRLoader.java:48)
    ... 22 more</clinit></clinit>

    java.lang.reflect.InvocationTargetException
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Nativ
    e Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(Native
    MethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(De
    legatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:567)
    at net.sf.robocode.security.HiddenAccess.robocodeMain(HiddenAccess.java:
    281)
    at robocode.Robocode.main(Robocode.java:27)
    Caused by: java.lang.Error: Can't initialize .NET Robocode
    at net.sf.robocode.dotnet.host.Module.Init(Module.java:70)
    at net.sf.robocode.dotnet.host.Module.<clinit>(Module.java:28)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInsta
    nce0(Native Method)
    at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInsta
    nce(NativeConstructorAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newI
    nstance(DelegatingConstructorAccessorImpl.java:45)
    at java.base/java.lang.reflect.Constructor.newInstanceWithCaller(Constru
    ctor.java:500)
    at java.base/java.lang.reflect.ReflectAccess.newInstance(ReflectAccess.j
    ava:166)
    at java.base/jdk.internal.reflect.ReflectionFactory.newInstance(Reflecti
    onFactory.java:404)
    at java.base/java.lang.Class.newInstance(Class.java:590)
    at net.sf.robocode.core.Container.loadModule(Container.java:154)
    at net.sf.robocode.core.Container.loadJars(Container.java:142)
    at net.sf.robocode.core.Container.loadFromPath(Container.java:120)
    at net.sf.robocode.core.Container.<clinit>(Container.java:83)
    at net.sf.robocode.core.RobocodeMainBase.robocodeMain(RobocodeMainBase.j
    ava:39)
    ... 6 more
    Caused by: net.sf.jni4net.inj.INJException: Can't initialize jni4net Bridge
    at net.sf.jni4net.CLRLoader.init(CLRLoader.java:56)
    at net.sf.jni4net.CLRLoader.init(CLRLoader.java:42)
    at net.sf.jni4net.Bridge.init(Bridge.java:46)
    at net.sf.robocode.dotnet.host.Module.Init(Module.java:51)
    ... 19 more
    Caused by: net.sf.jni4net.inj.INJException: C
    at net.sf.jni4net.Bridge.initDotNet(Native Method)
    at net.sf.jni4net.CLRLoader.init(CLRLoader.java:48)
    ... 22 more</clinit></clinit>

     
  • Flemming N. Larsen

    Hi Marcio,

    I took some time for me to reproduce the issue at my system. I found out if I use Java 11 or newer, the jni4net (allowing NET to interact with Java) will not work.
    Hence, when running Robocode with the .NET plugin, you must run it on Java 10 or older, e.g. the JRE 10.

     
  • Marcio Sousa

    Marcio Sousa - 2019-06-22

    That's right! I changed the java version and it worked perfectly. Thank you very much.

     

Log in to post a comment.