Re: [Ikvm-developers] java.lang.ClassNotFoundException for custom java classes
Brought to you by:
jfrijters
|
From: ¨˜”°º•<C0...@lk...> - 2011-01-21 08:00:25
|
Thanks a lot, that solved the issue. One more request, I was also experimenting this with IronRuby 1.1. Any idea how this attribute can be added there? -- Manish On Fri, Jan 21, 2011 at 1:18 PM, Jeroen Frijters <je...@su...> wrote: > Hi, > > Setting the CLASSPATH has no effect by default. If you want the CLASSPATH to be used you should apply this custom attribute to your .exe assembly: > > [assembly: IKVM.Attributes.CustomAssemblyClassLoader(typeof(ikvm.runtime.ClassPathAssemblyClassLoader))] > > Regards, > Jeroen > >> -----Original Message----- >> From: ¨˜”°º•C0D3w@lk3r•º°”˜¨ [mailto:c0d...@gm...] >> Sent: Friday, January 21, 2011 8:32 AM >> To: ikv...@li... >> Subject: [Ikvm-developers] java.lang.ClassNotFoundException for custom >> java classes >> >> 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("CLAS >> SPATH")); >> >> 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 >> >> ------------------------------------------------------------------------ >> ------ >> Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! >> Finally, a world-class log management solution at an even better price- >> free! >> Download using promo code Free_Logger_4_Dev2Dev. Offer expires February >> 28th, so secure your free ArcSight Logger TODAY! >> http://p.sf.net/sfu/arcsight-sfd2d >> _______________________________________________ >> Ikvm-developers mailing list >> Ikv...@li... >> https://lists.sourceforge.net/lists/listinfo/ikvm-developers > |