I'm developing an Unity(Unity3D 5.3.5f1) project with using Java library converted into dll with IKVM 8.1 RC0 (Additionally using VS for c# development)
I converted several related jars into one dll file. There was no warning or error in converting sequence. And I put them in Assets folder in Unity project.
I tried to run my java code in C#.
This is my C# code where executes java logics (Actually shorten a lot)
using UnityEngine;
using com.mypackage.hierarchy1;
using com.mypackage.hierarchy2; // Same as the package name from Java
public class Test : MonoBehaviour {
...... // several variables
private Class1 var1;
private Class2 var2;
// note that, Class1 and Class2 are the same name used in Java
void Start() {
var1 = new Class1();
var2 = new Class2();
}
void Update() {
method1(certain_param_in_int);
}
......
void method1(int param) {
method2(param, param2, param3,...);
}
void method2(int param, string param2, int param3, int param4) {
var1.method_v1(param, param2,...); // Works well with no problem
var2.initialize("str", var1.getResult(), "anotherstr");
var2.run(); // This method occurs the problem
}
}
The problem is that when var2.run() is executed. method from var1 has no problem. I checked the result was correct. Anyway, var2.run() shows NullReferenceException as below
NullReferenceException: Object reference not set to an instance of an object
com.mypackage.hierarchy2.Class2.run ()
Test.method2 (Int32 param, System.String param2, Int32 param3, Int32 param4) (at Assets/Scripts/Test.cs:93)
Test.method1 (Int32 param) (at Assets/Scripts/Test.cs:66)
Test.Update () (at Assets/Scripts/Test.cs:33)
So, I tested whether it is null or not by checking var2 == null and also var2.Equals(null) with Debug.Log() just before calling val2.run(), but all of them showed 'False'. They are not null.
What is the problem? Should I change Java side code and re-generate dll?
Thanks.
p.s. My java side code uses java.util.logging.Logger and related with other java project. (which is also referenced when converting jar into dll, as I said in second sentence of the question)
p.s.2. I'm sorry but I can't open java codes here because it is confidential code
I found that it was an error of our own code, but not java code itself. configurations.