[Ikvm-developers] java.lang.ClassNotFoundException for custom java classes
Brought to you by:
jfrijters
|
From: ¨˜”°º•<C0...@lk...> - 2011-01-21 07:32:01
|
Hi, I'm trying to read a java object (Student) which has been serialized and stored in a file "st.bin". All the IKVM dlls are in my path. I'm using IKVM version 0.44.0.5 on Windows 7 The Student class is in the "st.jar" file. The code to do that is as follows: using System; using System.Collections.Generic; using System.Text; using java.io; namespace DotNetJavaInterop { class Program { static void Main(string[] args) { System.Environment.SetEnvironmentVariable("CLASSPATH",".;./st.jar;"); System.Console.WriteLine(System.Environment.GetEnvironmentVariable("CLASSPATH")); FileInputStream fis = new FileInputStream("st.bin"); ObjectInputStream ois = new ObjectInputStream(fis); Object obj = ois.readObject(); System.Console.WriteLine(obj.GetType().ToString()); } } } Unhandled Exception: java.lang.ClassNotFoundException: Student at java.io.ObjectInputStream.readObject() at DotNetJavaInterop.Program.Main(String[] args) in C:\..\Visual Studio 2010\Projects\DotNetJavaInterop\DotNetJavaInterop\Program.cs:line 16 This erro only occurs for custom java classes, not the existing java classes like ArrayList, etc. What is wrong here and how can I correct this? -- Manish |