Thread: [Ikvm-developers] property files in the classpath
Brought to you by:
jfrijters
|
From: jun_li <ju...@cr...> - 2009-07-23 14:19:09
|
Hi, I am just starting to use IKVM.NET. I have some java jar files which I converted to dll as a library. I will call the java library class in c#. There are some property files in the classpath. Just wondering how can I have the dll to load the property file which used to be in the java classpath. Thanks, Jun -- View this message in context: http://www.nabble.com/property-files-in-the-classpath-tp24626742p24626742.html Sent from the IKVM .NET - Dev mailing list archive at Nabble.com. |
|
From: Jeroen F. <je...@su...> - 2009-07-23 15:00:13
|
Hi, Some recommended articles to get started are these: http://weblog.ikvm.net/PermaLink.aspx?guid=4e0b7f7c-6f5d-42a3-a4d6-5d05a99c84ff http://weblog.ikvm.net/PermaLink.aspx?guid=8a457a80-1e5f-4182-8f78-b2cd67845553 http://weblog.ikvm.net/PermaLink.aspx?guid=375f1ff8-912a-4458-9120-f0a8cfb23b68 Regards, Jeroen > -----Original Message----- > From: jun_li [mailto:ju...@cr...] > Sent: Thursday, July 23, 2009 16:19 > To: ikv...@li... > Subject: [Ikvm-developers] property files in the classpath > > > Hi, > > I am just starting to use IKVM.NET. > I have some java jar files which I converted to dll as a library. > I will call the java library class in c#. > > There are some property files in the classpath. > Just wondering how can I have the dll to load the property file which > used to be in the java classpath. > > Thanks, > Jun > -- > View this message in context: http://www.nabble.com/property-files-in- > the-classpath-tp24626742p24626742.html > Sent from the IKVM .NET - Dev mailing list archive at Nabble.com. > > > ----------------------------------------------------------------------- > ------- > _______________________________________________ > Ikvm-developers mailing list > Ikv...@li... > https://lists.sourceforge.net/lists/listinfo/ikvm-developers |
|
From: jun_li <ju...@cr...> - 2009-07-23 19:16:01
|
Hi Jeroen,
I try to add the following in App.config
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<appSettings>
<add key="ikvm:java.class.path" value="C:\properties"/>
</appSettings>
</configuration>
It doesn't work.
Please advise.
Thanks,
Jun
--
View this message in context: http://www.nabble.com/property-files-in-the-classpath-tp24626742p24632512.html
Sent from the IKVM .NET - Dev mailing list archive at Nabble.com.
|
|
From: jun_li <ju...@cr...> - 2009-07-24 18:59:02
|
Hi there, Looks like I can not find ikvm.runtime.AssemblyClassLoader now. However, I did see a java class in the source code distribution. How can I build the jar file which contains AssemblyClassLoader? Thx, Jun -- View this message in context: http://www.nabble.com/property-files-in-the-classpath-tp24626742p24650087.html Sent from the IKVM .NET - Dev mailing list archive at Nabble.com. |
|
From: Jeroen F. <je...@su...> - 2009-07-24 08:45:05
|
Hi Jun, Setting the java.class.path system property has no effect (other than setting the system property), because the default system class loader ignores the class path completely. For this to have any effect, your main application executable assembly will need to have a ClassPathAssemblyClassLoader. See this blog entry: http://weblog.ikvm.net/PermaLink.aspx?guid=8a457a80-1e5f-4182-8f78-b2cd67845553 Regards, Jeroen > -----Original Message----- > From: jun_li [mailto:ju...@cr...] > Sent: Thursday, July 23, 2009 21:16 > To: ikv...@li... > Subject: Re: [Ikvm-developers] property files in the classpath > > > Hi Jeroen, > > I try to add the following in App.config <?xml version="1.0" > encoding="utf-8" ?> <configuration> > <appSettings> > <add key="ikvm:java.class.path" value="C:\properties"/> > </appSettings> > </configuration> > > It doesn't work. > Please advise. > > Thanks, > Jun > -- > View this message in context: http://www.nabble.com/property-files-in- > the-classpath-tp24626742p24632512.html > Sent from the IKVM .NET - Dev mailing list archive at Nabble.com. > > > ----------------------------------------------------------------------- > ------- > _______________________________________________ > Ikvm-developers mailing list > Ikv...@li... > https://lists.sourceforge.net/lists/listinfo/ikvm-developers |
|
From: jun_li <ju...@cr...> - 2009-07-24 14:54:39
|
Hi Jeroen, Thanks you so much for your quick response! I was able to use the -recurse flag to include all the properties files in the dll. It works for some of the property files which were loaded from classpath previously. I had some problem with the spring config properties. And I also would like to try the ClassPathAssemblyClassLoader approach you pointed out. The app I developed in c# is a outlook addin, not sure how can I pass the classpath args to the add-in. Any suggestion will be great appreciated. Jun -- View this message in context: http://www.nabble.com/property-files-in-the-classpath-tp24626742p24645644.html Sent from the IKVM .NET - Dev mailing list archive at Nabble.com. |
|
From: jun_li <ju...@cr...> - 2009-07-24 19:19:15
|
I did try that before.
I have 0.40.0.1 version downloaded.
There is no IKVM.OpenJDK.ClassLibrary.dll. When I tried
IKVM.OpenJDK.Core.dll
I got the following error:
ikvmstub IKVM.OpenJDK.Core.dll
Warning: Running ikvmstub on ikvmc compiled assemblies is not supported.
cli.System.IO.FileNotFoundException: Could not load file or assembly
'System.Cor
e, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one
of
its dependencies. The system cannot find the file specified.
at cli.System.ModuleHandle.ResolveMethod(Unknown Source)
at cli.System.ModuleHandle.ResolveMethodHandle(Unknown Source)
at cli.System.ModuleHandle.ResolveMethodHandle(Unknown Source)
at cli.System.RuntimeType.GetMethodBase(Unknown Source)
at cli.System.RuntimeType.GetMethodBase(Unknown Source)
at cli.System.Reflection.CustomAttributeData.<init>(Unknown Source)
at
cli.System.Reflection.CustomAttributeData.GetCustomAttributes(Unknown
Source)
at
cli.System.Reflection.CustomAttributeData.GetCustomAttributes(Unknown
Source)
at IKVM.Internal.AttributeHelper.GetInnerClass(Unknown Source)
at IKVM.Internal.CompiledTypeWrapper.GetName(Unknown Source)
at
IKVM.Internal.AssemblyClassLoader+AssemblyLoader.CreateWrapperForAsse
mblyType(Unknown Source)
at
IKVM.Internal.AssemblyClassLoader.GetWrapperFromAssemblyType(Unknown
Source)
at IKVM.Internal.ClassLoaderWrapper.GetWrapperFromType(Unknown
Source)
at
IKVM.NativeCode.ikvm.runtime.Util.getFriendlyClassFromType(Unknown So
urce)
at ikvm.runtime.Util.getFriendlyClassFromType(Native Method)
at cli.NetExp.ProcessAssembly(Unknown Source)
at cli.NetExp.Main(Unknown Source)
at cli.NetExp.Main(Unknown Source)
Warning: Assembly reflection encountered an error. Resultant JAR may be
incomple
te.
Error: Assembly contains no public IKVM.NET compatible types
Thanks,
Jun
--
View this message in context: http://www.nabble.com/property-files-in-the-classpath-tp24626742p24650384.html
Sent from the IKVM .NET - Dev mailing list archive at Nabble.com.
|
|
From: Jeroen F. <je...@su...> - 2009-07-24 15:02:01
|
One option is to write a custom assembly class loader and then override findResource() and return a URL to the properties file (if the requested resource is the properties file, of course). Regards, Jeroen > -----Original Message----- > From: jun_li [mailto:ju...@cr...] > Sent: Friday, July 24, 2009 16:35 > To: ikv...@li... > Subject: Re: [Ikvm-developers] property files in the classpath > > > Hi Jeroen, > > Thanks you so much for your quick response! > I was able to use the -recurse flag to include all the properties > files in the dll. > It works for some of the property files which were loaded from > classpath previously. > I had some problem with the spring config properties. > > And I also would like to try the ClassPathAssemblyClassLoader approach > you pointed out. > The app I developed in c# is a outlook addin, not sure how can I pass > the classpath args to the add-in. > > Any suggestion will be great appreciated. > > Jun > -- > View this message in context: http://www.nabble.com/property-files-in- > the-classpath-tp24626742p24645644.html > Sent from the IKVM .NET - Dev mailing list archive at Nabble.com. > > > ----------------------------------------------------------------------- > ------- > _______________________________________________ > Ikvm-developers mailing list > Ikv...@li... > https://lists.sourceforge.net/lists/listinfo/ikvm-developers |
|
From: jun_li <ju...@cr...> - 2009-07-24 15:52:26
|
Hi Jereon, Ok, I will try to use a custom assembly class loader per your link http://weblog.ikvm.net/PermaLink.aspx?guid=375f1ff8-912a-4458-9120-f0a8cfb23b68 http://weblog.ikvm.net/PermaLink.aspx?guid=375f1ff8-912a-4458-9120-f0a8cfb23b68 Sorry that I need ask some stupid questions after I did some research. It seems to me the classload is written in java. If so, what's the jar file for compile the cli.System.Reflection.Assembly? After I have the custom class loader, what I need to do? Specify it in the app.config? If so, are the following config correct since I am not sure both key and value? <?xml version="1.0" encoding="utf-8" ?> <configuration> <appSettings> <add key="ikvm:ikvm.runtime.AssemblyClassLoader" value="MyCustomClassLoader" /> </appSettings> </configuration> Thanks a lot, Jun -- View this message in context: http://www.nabble.com/property-files-in-the-classpath-tp24626742p24647050.html Sent from the IKVM .NET - Dev mailing list archive at Nabble.com. |
|
From: Valeriy P. <pik...@gm...> - 2009-07-24 16:44:24
|
your config is wrong, look here: http://weblog.ikvm.net/PermaLink.aspx?guid=8a457a80-1e5f-4182-8f78-b2cd67845553 "Here the key is ikvm-classloader: followed by the simple name of the assembly. The value must be the assembly qualified type name of the custom assembly class loader type." E.g. if your .NET output after ikvmc is MyAssembly.dll, then its config file: <configuration> <appSettings> <add key="ikvm-classloader:MyAssembly" value="ikvm.runtime.MyCustomAssemblyClassLoader, MyCustomClassLoaderAssembly, Version=1.0.0.0, Culture=neutral" /> ... Also, the same custom classloader's name should be specified while compiling via ikvmc: ikvmc.exe ... -out:MyAssembly.dll -target:library -classloader:ikvm.runtime.MyCustomAssemblyClassLoader Jeroen, please correct me if I wrong. Valeriy. On Fri, Jul 24, 2009 at 6:52 PM, jun_li<ju...@cr...> wrote: > > Hi Jereon, > > Ok, I will try to use a custom assembly class loader per your link > http://weblog.ikvm.net/PermaLink.aspx?guid=375f1ff8-912a-4458-9120-f0a8cfb23b68 > http://weblog.ikvm.net/PermaLink.aspx?guid=375f1ff8-912a-4458-9120-f0a8cfb23b68 > Sorry that I need ask some stupid questions after I did some research. > It seems to me the classload is written in java. > If so, what's the jar file for compile the cli.System.Reflection.Assembly? > > After I have the custom class loader, what I need to do? > Specify it in the app.config? > If so, are the following config correct since I am not sure both key and > value? > <?xml version="1.0" encoding="utf-8" ?> > <configuration> > <appSettings> > <add key="ikvm:ikvm.runtime.AssemblyClassLoader" > value="MyCustomClassLoader" /> > </appSettings> > </configuration> > > > Thanks a lot, > Jun > -- > View this message in context: http://www.nabble.com/property-files-in-the-classpath-tp24626742p24647050.html > Sent from the IKVM .NET - Dev mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > _______________________________________________ > Ikvm-developers mailing list > Ikv...@li... > https://lists.sourceforge.net/lists/listinfo/ikvm-developers > |
|
From: Jeroen F. <je...@su...> - 2009-07-25 06:45:02
|
Valeriy Pikulskyy wrote: > E.g. if your .NET output after ikvmc is MyAssembly.dll, then its config > file: > > <configuration> > <appSettings> > <add key="ikvm-classloader:MyAssembly" > value="ikvm.runtime.MyCustomAssemblyClassLoader, > MyCustomClassLoaderAssembly, Version=1.0.0.0, Culture=neutral" /> > ... > Also, the same custom classloader's name should be specified while > compiling via ikvmc: > > ikvmc.exe ... -out:MyAssembly.dll -target:library > -classloader:ikvm.runtime.MyCustomAssemblyClassLoader Actually, you only need one of these two. The App.config feature is primarily to modify the class loader of external assemblies that you don't control. For ikvmc generated assemblies, the -classloader:<class> option is the best approach and for C# (or other .NET languages) you can specify the IKVM.Attributes.CustomAssemblyClassLoaderAttribute custom attribute. Regards, Jeroen |
|
From: jun_li <ju...@cr...> - 2009-07-24 16:49:38
|
Thank you so much to clarify the config and the dll build. The last piece of the puzzle (hopefully) I had is that which file contains the cli.System.Reflection.Assembly? Best Regards, Jun -- View this message in context: http://www.nabble.com/property-files-in-the-classpath-tp24626742p24647982.html Sent from the IKVM .NET - Dev mailing list archive at Nabble.com. |
|
From: Valeriy P. <pik...@gm...> - 2009-07-24 17:17:23
|
cli.System.Reflection.Assembly is inside ikvm-0.40.0.1\classpath\mscorlib.jar You will add it to the classpath when you build your custom class loader on java. Then you will ikvmc it into .NET dll and then specify it as a custom classloader. On Fri, Jul 24, 2009 at 7:49 PM, jun_li<ju...@cr...> wrote: > > Thank you so much to clarify the config and the dll build. > > The last piece of the puzzle (hopefully) I had is that which file contains > the cli.System.Reflection.Assembly? > > Best Regards, > Jun > -- > View this message in context: http://www.nabble.com/property-files-in-the-classpath-tp24626742p24647982.html > Sent from the IKVM .NET - Dev mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > _______________________________________________ > Ikvm-developers mailing list > Ikv...@li... > https://lists.sourceforge.net/lists/listinfo/ikvm-developers > |
|
From: Valeriy P. <pik...@gm...> - 2009-07-24 19:11:01
|
http://weblog.ikvm.net/PermaLink.aspx?guid=375f1ff8-912a-4458-9120-f0a8cfb23b68 see Jeroen's comments: "You probably need to run ikvmstub on IKVM.OpenJDK.ClassLibrary.dll and add the resulting jar to your classpath instead of the ikvm directory." The creation of a custom class loader definetly lacks a step-by-step instructions. On Fri, Jul 24, 2009 at 9:58 PM, jun_li<ju...@cr...> wrote: > > Hi there, > > Looks like I can not find ikvm.runtime.AssemblyClassLoader now. > However, I did see a java class in the source code distribution. > How can I build the jar file which contains AssemblyClassLoader? > > Thx, > Jun > -- > View this message in context: http://www.nabble.com/property-files-in-the-classpath-tp24626742p24650087.html > Sent from the IKVM .NET - Dev mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > _______________________________________________ > Ikvm-developers mailing list > Ikv...@li... > https://lists.sourceforge.net/lists/listinfo/ikvm-developers > |
|
From: Valeriy P. <pik...@gm...> - 2009-07-24 19:43:49
|
http://weblog.ikvm.net/PermaLink.aspx?guid=abe9dce7-ea83-4d21-851a-1f819794b445 Jeroen mentioned a "-shared" param for ikvmstub: "ikvmstub -shared ikvm.openjdk.core" and below: "Added hack to ikvmstub (-shared option) to generate stubs for core class library." On Fri, Jul 24, 2009 at 10:19 PM, jun_li<ju...@cr...> wrote: > > I did try that before. > I have 0.40.0.1 version downloaded. > There is no IKVM.OpenJDK.ClassLibrary.dll. When I tried > IKVM.OpenJDK.Core.dll > I got the following error: > > ikvmstub IKVM.OpenJDK.Core.dll > Warning: Running ikvmstub on ikvmc compiled assemblies is not supported. > cli.System.IO.FileNotFoundException: Could not load file or assembly > 'System.Cor > e, Version=3.5.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089' or one > of > its dependencies. The system cannot find the file specified. > at cli.System.ModuleHandle.ResolveMethod(Unknown Source) > at cli.System.ModuleHandle.ResolveMethodHandle(Unknown Source) > at cli.System.ModuleHandle.ResolveMethodHandle(Unknown Source) > at cli.System.RuntimeType.GetMethodBase(Unknown Source) > at cli.System.RuntimeType.GetMethodBase(Unknown Source) > at cli.System.Reflection.CustomAttributeData.<init>(Unknown Source) > at > cli.System.Reflection.CustomAttributeData.GetCustomAttributes(Unknown > Source) > at > cli.System.Reflection.CustomAttributeData.GetCustomAttributes(Unknown > Source) > at IKVM.Internal.AttributeHelper.GetInnerClass(Unknown Source) > at IKVM.Internal.CompiledTypeWrapper.GetName(Unknown Source) > at > IKVM.Internal.AssemblyClassLoader+AssemblyLoader.CreateWrapperForAsse > mblyType(Unknown Source) > at > IKVM.Internal.AssemblyClassLoader.GetWrapperFromAssemblyType(Unknown > Source) > at IKVM.Internal.ClassLoaderWrapper.GetWrapperFromType(Unknown > Source) > at > IKVM.NativeCode.ikvm.runtime.Util.getFriendlyClassFromType(Unknown So > urce) > at ikvm.runtime.Util.getFriendlyClassFromType(Native Method) > at cli.NetExp.ProcessAssembly(Unknown Source) > at cli.NetExp.Main(Unknown Source) > at cli.NetExp.Main(Unknown Source) > Warning: Assembly reflection encountered an error. Resultant JAR may be > incomple > te. > Error: Assembly contains no public IKVM.NET compatible types > > Thanks, > Jun > -- > View this message in context: http://www.nabble.com/property-files-in-the-classpath-tp24626742p24650384.html > Sent from the IKVM .NET - Dev mailing list archive at Nabble.com. > > > ------------------------------------------------------------------------------ > _______________________________________________ > Ikvm-developers mailing list > Ikv...@li... > https://lists.sourceforge.net/lists/listinfo/ikvm-developers > |
|
From: jun_li <ju...@cr...> - 2009-07-24 20:26:06
|
Hi Valeriy,
Thanks again for the help.
I tried with the -shared option, I got the following error:
ikvmstub -shared IKVM.OpenJDK.Core.dll
Warning: Running ikvmstub on ikvmc compiled assemblies is not supported.
java.lang.NullPointerException
at IKVM.Internal.CompiledTypeWrapper.GetMethodAnnotations(Unknown
Source
)
at
IKVM.NativeCode.java.lang.reflect.Method.getDeclaredAnnotationsImpl(U
nknown Source)
at java.lang.reflect.Method.getDeclaredAnnotationsImpl(Native
Method)
at
java.lang.reflect.Constructor.declaredAnnotations(Constructor.java:63
1)
at
java.lang.reflect.Constructor.getDeclaredAnnotations(Constructor.java
:625)
at ikvm.internal.stubgen.StubGenerator.run(StubGenerator.java:169)
at ikvm.internal.stubgen.StubGenerator.run(StubGenerator.java:42)
at
java.security.AccessController.doPrivileged(AccessController.java:258
)
at
java.security.AccessController.doPrivileged(AccessController.java:303
)
at
ikvm.internal.stubgen.StubGenerator.generateStub(StubGenerator.java:5
4)
at
gnu.java.net.protocol.ikvmres.Handler.readResourceFromAssembly(Handle
r.java:155)
at
gnu.java.net.protocol.ikvmres.Handler.readResourceFromAssembly(Handle
r.java:122)
at
gnu.java.net.protocol.ikvmres.IkvmresURLConnection.connect(Handler.ja
va:53)
at
gnu.java.net.protocol.ikvmres.IkvmresURLConnection.getInputStream(Han
dler.java:77)
at java.net.URL.openStream(URL.java:1027)
at java.lang.ClassLoader.getResourceAsStream(ClassLoader.java:1181)
at java.lang.Class.getResourceAsStream(Class.java:2060)
at cli.NetExp.WriteClass(Unknown Source)
at cli.NetExp.ProcessAssembly(Unknown Source)
at cli.NetExp.Main(Unknown Source)
Warning: Assembly reflection encountered an error. Resultant JAR may be
incomplete.
The output jar file does not contains the ikvm.runtime.AssemblyClassLoader
I am pretty ikvm.runtime.AssemblyClassLoader in the dll since I was able to
get it in the Visual Studio.
Jun
--
View this message in context: http://www.nabble.com/property-files-in-the-classpath-tp24626742p24651380.html
Sent from the IKVM .NET - Dev mailing list archive at Nabble.com.
|
|
From: Jeroen F. <je...@su...> - 2009-07-25 06:46:47
|
Hi Jun, Sorry, I (once again) forgot to test generated a jar from the core class libraries before releasing. Here is the jar that you need: http://www.frijters.net/IKVM.OpenJDK.Core.jar Regards, Jeroen > -----Original Message----- > From: jun_li [mailto:ju...@cr...] > Sent: Friday, July 24, 2009 22:26 > To: ikv...@li... > Subject: Re: [Ikvm-developers] property files in the classpath > > > Hi Valeriy, > > Thanks again for the help. > I tried with the -shared option, I got the following error: > > ikvmstub -shared IKVM.OpenJDK.Core.dll > Warning: Running ikvmstub on ikvmc compiled assemblies is not > supported. > java.lang.NullPointerException > at > IKVM.Internal.CompiledTypeWrapper.GetMethodAnnotations(Unknown > Source > ) > at > IKVM.NativeCode.java.lang.reflect.Method.getDeclaredAnnotationsImpl(U > nknown Source) > at java.lang.reflect.Method.getDeclaredAnnotationsImpl(Native > Method) > at > java.lang.reflect.Constructor.declaredAnnotations(Constructor.java:63 > 1) > at > java.lang.reflect.Constructor.getDeclaredAnnotations(Constructor.java > :625) > at > ikvm.internal.stubgen.StubGenerator.run(StubGenerator.java:169) > at > ikvm.internal.stubgen.StubGenerator.run(StubGenerator.java:42) > at > java.security.AccessController.doPrivileged(AccessController.java:258 > ) > at > java.security.AccessController.doPrivileged(AccessController.java:303 > ) > at > ikvm.internal.stubgen.StubGenerator.generateStub(StubGenerator.java:5 > 4) > at > gnu.java.net.protocol.ikvmres.Handler.readResourceFromAssembly(Handle > r.java:155) > at > gnu.java.net.protocol.ikvmres.Handler.readResourceFromAssembly(Handle > r.java:122) > at > gnu.java.net.protocol.ikvmres.IkvmresURLConnection.connect(Handler.ja > va:53) > at > gnu.java.net.protocol.ikvmres.IkvmresURLConnection.getInputStream(Han > dler.java:77) > at java.net.URL.openStream(URL.java:1027) > at > java.lang.ClassLoader.getResourceAsStream(ClassLoader.java:1181) > at java.lang.Class.getResourceAsStream(Class.java:2060) > at cli.NetExp.WriteClass(Unknown Source) > at cli.NetExp.ProcessAssembly(Unknown Source) > at cli.NetExp.Main(Unknown Source) > Warning: Assembly reflection encountered an error. Resultant JAR may be > incomplete. > > The output jar file does not contains the > ikvm.runtime.AssemblyClassLoader I am pretty > ikvm.runtime.AssemblyClassLoader in the dll since I was able to get it > in the Visual Studio. > > Jun > -- > View this message in context: http://www.nabble.com/property-files-in- > the-classpath-tp24626742p24651380.html > Sent from the IKVM .NET - Dev mailing list archive at Nabble.com. > > > ----------------------------------------------------------------------- > ------- > _______________________________________________ > Ikvm-developers mailing list > Ikv...@li... > https://lists.sourceforge.net/lists/listinfo/ikvm-developers |
|
From: jun_li <ju...@cr...> - 2009-07-27 14:46:16
|
Hi, I downloaded the jar file and complied the customer class loader. And when I tried to build the dll afte I copied MyCustomClassLoader.class into the same dir with all the jar files, I got an error: ikvmc -output mydll.dll -target:library *.jar *.class -classloader:MyCustomClassLoader Warning IKVMC0100: class "cli.System.Reflection.Assembly" not found Link Error: Method "ikvm.runtime.AssemblyClassLoader.<init>(Lcli.System.Reflect on.Assembly;)V" has a argument type "cli.System.Reflection.Assembly, mscorlib, ersion=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" instead of ty e "cli.System.Reflection.Assembly (unknown assembly)" as expected by "MyCustomC assLoader" Then, I copied the generated mscorlib.jar to the same dir, I got another error: System.NotSupportedException: Specified method is not supported. at IKVM.Reflection.Emit.Impl.TypeBase.get_Assembly() at IKVM.Internal.CompilerClassLoader.Compile() at IKVM.Internal.CompilerClassLoader.Compile(List`1 optionsList) at IkvmcCompiler.Main(String[] args) Any ideas? Thanks, Jun -- View this message in context: http://www.nabble.com/property-files-in-the-classpath-tp24626742p24682000.html Sent from the IKVM .NET - Dev mailing list archive at Nabble.com. |
|
From: Jeroen F. <je...@su...> - 2009-07-27 14:48:13
|
Hi, Use -r:mscorlib with ikvmc. Regards, Jeroen > -----Original Message----- > From: jun_li [mailto:ju...@cr...] > Sent: Monday, July 27, 2009 16:46 > To: ikv...@li... > Subject: Re: [Ikvm-developers] property files in the classpath > > > Hi, > > I downloaded the jar file and complied the customer class loader. > And when I tried to build the dll afte I copied > MyCustomClassLoader.class into the same dir with all the jar files, I > got an error: > ikvmc -output mydll.dll -target:library *.jar *.class - > classloader:MyCustomClassLoader > > Warning IKVMC0100: class "cli.System.Reflection.Assembly" not found > Link Error: Method > "ikvm.runtime.AssemblyClassLoader.<init>(Lcli.System.Reflect > on.Assembly;)V" has a argument type "cli.System.Reflection.Assembly, > mscorlib, ersion=2.0.0.0, Culture=neutral, > PublicKeyToken=b77a5c561934e089" instead of ty e > "cli.System.Reflection.Assembly (unknown assembly)" as expected by > "MyCustomC assLoader" > > Then, I copied the generated mscorlib.jar to the same dir, I got > another > error: > System.NotSupportedException: Specified method is not supported. > at IKVM.Reflection.Emit.Impl.TypeBase.get_Assembly() > at IKVM.Internal.CompilerClassLoader.Compile() > at IKVM.Internal.CompilerClassLoader.Compile(List`1 optionsList) > at IkvmcCompiler.Main(String[] args) > > Any ideas? > > Thanks, > Jun > -- > View this message in context: http://www.nabble.com/property-files-in- > the-classpath-tp24626742p24682000.html > Sent from the IKVM .NET - Dev mailing list archive at Nabble.com. > > > ----------------------------------------------------------------------- > ------- > _______________________________________________ > Ikvm-developers mailing list > Ikv...@li... > https://lists.sourceforge.net/lists/listinfo/ikvm-developers |
|
From: jun_li <ju...@cr...> - 2009-07-27 14:54:52
|
Hi Jeroen, Thank nyou for your quick response. I removed the mscorlib jar and tried the -r:mscorlib, I still got the folowing error: System.NotSupportedException: Specified method is not supported. at IKVM.Reflection.Emit.Impl.TypeBase.get_Assembly() at IKVM.Internal.CompilerClassLoader.Compile() at IKVM.Internal.CompilerClassLoader.Compile(List`1 optionsList) at IkvmcCompiler.Main(String[] args) I noticed that the jar you gave it 0.40.0.2 and my ikvm version is 0.40.0.1, not sure if it does matter. Best Regards, Jun > -----Original Message----- > From: jun_li [mailto:ju...@cr...] > Sent: Monday, July 27, 2009 16:46 > To: ikv...@li... > Subject: Re: [Ikvm-developers] property files in the classpath > > > Hi, > > I downloaded the jar file and complied the customer class loader. > And when I tried to build the dll afte I copied > MyCustomClassLoader.class into the same dir with all the jar files, I > got an error: > ikvmc -output mydll.dll -target:library *.jar *.class - > classloader:MyCustomClassLoader > > Warning IKVMC0100: class "cli.System.Reflection.Assembly" not found > Link Error: Method > "ikvm.runtime.AssemblyClassLoader.<init>(Lcli.System.Reflect > on.Assembly;)V" has a argument type "cli.System.Reflection.Assembly, > mscorlib, ersion=2.0.0.0, Culture=neutral, > PublicKeyToken=b77a5c561934e089" instead of ty e > "cli.System.Reflection.Assembly (unknown assembly)" as expected by > "MyCustomC assLoader" > > Then, I copied the generated mscorlib.jar to the same dir, I got > another > error: > System.NotSupportedException: Specified method is not supported. > at IKVM.Reflection.Emit.Impl.TypeBase.get_Assembly() > at IKVM.Internal.CompilerClassLoader.Compile() > at IKVM.Internal.CompilerClassLoader.Compile(List`1 optionsList) > at IkvmcCompiler.Main(String[] args) > > Any ideas? > > Thanks, > Jun > -- > View this message in context: http://www.nabble.com/property-files-in- > the-classpath-tp24626742p24682000.html > Sent from the IKVM .NET - Dev mailing list archive at Nabble.com. > > > ----------------------------------------------------------------------- > ------- > _______________________________________________ > Ikvm-developers mailing list > Ikv...@li... > https://lists.sourceforge.net/lists/listinfo/ikvm-developers ------------------------------------------------------------------------------ _______________________________________________ Ikvm-developers mailing list Ikv...@li... https://lists.sourceforge.net/lists/listinfo/ikvm-developers -- View this message in context: http://www.nabble.com/property-files-in-the-classpath-tp24626742p24682130.html Sent from the IKVM .NET - Dev mailing list archive at Nabble.com. |
|
From: Jeroen F. <je...@su...> - 2009-07-27 14:55:56
|
Hi again, It turns out there's a bug. You can work around the bug by making your MyCustomClassLoader class public. Regards, Jeroen > -----Original Message----- > From: jun_li [mailto:ju...@cr...] > Sent: Monday, July 27, 2009 16:46 > To: ikv...@li... > Subject: Re: [Ikvm-developers] property files in the classpath > > > Hi, > > I downloaded the jar file and complied the customer class loader. > And when I tried to build the dll afte I copied > MyCustomClassLoader.class into the same dir with all the jar files, I > got an error: > ikvmc -output mydll.dll -target:library *.jar *.class - > classloader:MyCustomClassLoader > > Warning IKVMC0100: class "cli.System.Reflection.Assembly" not found > Link Error: Method > "ikvm.runtime.AssemblyClassLoader.<init>(Lcli.System.Reflect > on.Assembly;)V" has a argument type "cli.System.Reflection.Assembly, > mscorlib, ersion=2.0.0.0, Culture=neutral, > PublicKeyToken=b77a5c561934e089" instead of ty e > "cli.System.Reflection.Assembly (unknown assembly)" as expected by > "MyCustomC assLoader" > > Then, I copied the generated mscorlib.jar to the same dir, I got > another > error: > System.NotSupportedException: Specified method is not supported. > at IKVM.Reflection.Emit.Impl.TypeBase.get_Assembly() > at IKVM.Internal.CompilerClassLoader.Compile() > at IKVM.Internal.CompilerClassLoader.Compile(List`1 optionsList) > at IkvmcCompiler.Main(String[] args) > > Any ideas? > > Thanks, > Jun > -- > View this message in context: http://www.nabble.com/property-files-in- > the-classpath-tp24626742p24682000.html > Sent from the IKVM .NET - Dev mailing list archive at Nabble.com. > > > ----------------------------------------------------------------------- > ------- > _______________________________________________ > Ikvm-developers mailing list > Ikv...@li... > https://lists.sourceforge.net/lists/listinfo/ikvm-developers |
|
From: jun_li <ju...@cr...> - 2009-07-27 16:46:07
|
Hi Jeroen, I was able to complie the code and generated the dll. And I got the following error when it tried to load the properties file in c#. Looke like it is related with the security provilege? at java.security.AccessController.doPrivileged(Object , AccessControlContext , CallerID )\r\n at java.security.AccessController.doPrivileged(PrivilegedAction action, CallerID )\r\n at IKVM.Internal.ClassLoaderWrapper.DoPrivileged(PrivilegedAction action)\r\n at IKVM.Internal.ClassLoaderWrapper.GetAssemblyClassLoader(Assembly assembly)\r\n at IKVM.Internal.ClassLoaderWrapper.GetWrapperFromType(Type type)\r\n at IKVM.NativeCode.ikvm.runtime.Util.getClassFromTypeHandle(RuntimeTypeHandle handle)\r\n at IKVM.Runtime.ByteCodeHelper.GetClassFromTypeHandle(RuntimeTypeHandle typeHandle)\r\n at ikvm.internal.ClassLiteral`1..cctor() Please advise, Thanks. Jun -- View this message in context: http://www.nabble.com/property-files-in-the-classpath-tp24626742p24684174.html Sent from the IKVM .NET - Dev mailing list archive at Nabble.com. |
|
From: Jeroen F. <je...@su...> - 2009-07-27 16:49:31
|
Hi Jun, Without the full exception, it's impossible to say, but I suspect that the constructor of your custom class loader is throwing an exception. Regards, Jeroen > -----Original Message----- > From: jun_li [mailto:ju...@cr...] > Sent: Monday, July 27, 2009 18:46 > To: ikv...@li... > Subject: Re: [Ikvm-developers] property files in the classpath > > > Hi Jeroen, > > I was able to complie the code and generated the dll. > And I got the following error when it tried to load the properties file > in c#. > > Looke like it is related with the security provilege? > > at java.security.AccessController.doPrivileged(Object , > AccessControlContext > , CallerID )\r\n at > java.security.AccessController.doPrivileged(PrivilegedAction action, > CallerID )\r\n at > IKVM.Internal.ClassLoaderWrapper.DoPrivileged(PrivilegedAction > action)\r\n at > IKVM.Internal.ClassLoaderWrapper.GetAssemblyClassLoader(Assembly > assembly)\r\n at > IKVM.Internal.ClassLoaderWrapper.GetWrapperFromType(Type > type)\r\n at > IKVM.NativeCode.ikvm.runtime.Util.getClassFromTypeHandle(RuntimeTypeHan > dle > handle)\r\n at > IKVM.Runtime.ByteCodeHelper.GetClassFromTypeHandle(RuntimeTypeHandle > typeHandle)\r\n at ikvm.internal.ClassLiteral`1..cctor() > > Please advise, > > Thanks. > Jun > -- > View this message in context: http://www.nabble.com/property-files-in- > the-classpath-tp24626742p24684174.html > Sent from the IKVM .NET - Dev mailing list archive at Nabble.com. > > > ----------------------------------------------------------------------- > ------- > _______________________________________________ > Ikvm-developers mailing list > Ikv...@li... > https://lists.sourceforge.net/lists/listinfo/ikvm-developers |
|
From: jun_li <ju...@cr...> - 2009-07-28 03:00:00
|
Hi Jeroen, Actually, the error is related with log4j which I tried to use in the custom class loader. The problem is fixed now. I can load my own config xml now. But I still have problem to load the spring config.xml even I tried to override the getResourceAsStream() method in class loader. Can you shed any light? Thanks, Jun -- View this message in context: http://www.nabble.com/property-files-in-the-classpath-tp24626742p24691740.html Sent from the IKVM .NET - Dev mailing list archive at Nabble.com. |
|
From: Jeroen F. <je...@su...> - 2009-07-28 06:42:15
|
I'm guessing that Spring isn't using your class loader. Did you apply your custom class loader to the assembly that contains the Spring code? If so, then maybe Spring is using the thread context class loader, instead of it's own class loader. In that case, you'll have to set the thread context class loader to your class loader. Regards, Jeroen > -----Original Message----- > From: jun_li [mailto:ju...@cr...] > Sent: Tuesday, July 28, 2009 05:00 > To: ikv...@li... > Subject: Re: [Ikvm-developers] property files in the classpath > > > Hi Jeroen, > > Actually, the error is related with log4j which I tried to use in the > custom class loader. > The problem is fixed now. I can load my own config xml now. > But I still have problem to load the spring config.xml even I tried to > override the getResourceAsStream() method in class loader. > > Can you shed any light? > > Thanks, > Jun > > -- > View this message in context: http://www.nabble.com/property-files-in- > the-classpath-tp24626742p24691740.html > Sent from the IKVM .NET - Dev mailing list archive at Nabble.com. > > > ----------------------------------------------------------------------- > ------- > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 > 30-Day > trial. Simplify your report design, integration and deployment - and > focus on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > _______________________________________________ > Ikvm-developers mailing list > Ikv...@li... > https://lists.sourceforge.net/lists/listinfo/ikvm-developers |