Hello,
I currently have a .jar library I need to use in Unity along in C#. Unfortunately, that library is not given in C# natively (it is however also given in C). After surfing the internet for a bit, I found something called IKVM which lets you convert .jar libraries into .dlls for use. Thus, I moved my now converted .dll as well as the IKVM .dll's into the Plugins folder. Additionally, I followed the library's tutorial here (in Java):
[http://www.unidata.ucar.edu/software/thredds/current/netcdf-java/tutorial/NetcdfFile.html][1]
[1]: http://www.unidata.ucar.edu/software/thredds/current/netcdf-java/tutorial/NetcdfFile.html
to use the library. It works perfectly in pure Java. However, when I do the same thing in Unity and run the game, an error always occurs whenever I try to read the file: "NullPointerException: charset is null".
Here is the script for reference (It's attached to the appropriate Plane object and ucar.nc2 is the library):
using UnityEngine;
using System.Collections;
using ucar.nc2;
using System.IO;
public class PlaneScript : MonoBehaviour {
// Use this for initialization
void Start () {
string fileName = Application.dataPath + "/Resources/snofh.nc";
//NetcdfFile ncFile = null;
//ncFile = NetcdfFile.open("C:\\Users\\mughi\\Documents\\wgrib2\\snohf.nc");
NetcdfFile ncFile = null;
try {
ncFile = NetcdfFile.open(fileName);
} catch (IOException ioe) {
Debug.Log("trying to open " + fileName);
} finally {
if (null != ncFile) {
try {
ncFile.close();
} catch (IOException ioe) {
Debug.Log("trying to close " + fileName);
}
}
}
}
// Update is called once per frame
void Update () {
}
}
The error occurs precisely at the first IOException catch.
Can anyone please give any insight into why the error is occurring/what it means?
Thank you!
↧