Re: Porting from Java (Sun)
From: George Birbilis [MVP J#] [9880] (birbilis_at_kagi.com)
Date: 03/13/04
- Next message: Umesh Unnikrishnan [MSFT]: "RE: New Project"
- Previous message: George Birbilis [MVP J#] [9880]: "Re: Possible bug in Class.isAssignableFrom(Class)"
- Messages sorted by: [ date ] [ thread ]
Date: Sat, 13 Mar 2004 23:09:44 +0200
> Converting some code over from Java to .NET and there is a method in
> the java.lang.ClassLoader class with the signature
> protected final java.lang.Class defineClass ( String name , byte[] data
> , int offset , int length ) that is called from within our Java code.
> The problem is this method is implemented in Visual J#.NET, but it's
> implementation does nothing more than throw an exception... anyone now
> how to get around this? This is a real show stopper!
Obviously this method creates a Class from an array of Java (VM) bytecode
(maybe from a .class file you transported via the network). J# works with
.NET IL, not Java bytecode so it's logical it doesn't support that stuff
If you call the MS .class->IL assembly converter at runtime you could maybe
solve your problem (not sure if there's an API to it or need to have the
.NET framework installed at the client too and call its jbimp command-line
tool [hidden] under the hood to do the job). You may need to add code to
behave decently if jbimp tool fails or is not found etc. (parse its output
or the error code/status it returns)
If you already have those classes as .class files and know them from
beforehand, convert them all to .NET and pass .NET assemblies arround, plus
load them dynamically at the other side of the wire (instead of using the
defineClass stuff).
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
George Birbilis <birbilis@kagi.com> [MVP J#] [9880]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ QuickTime VCL and ActiveX controls (for PowerPoint/VB/Delphi etc.)
+ Plugs VCL and ActiveX controls (InterProcess/Internet communication)
+ TransFormations, VB6 forms to ASP.net WebForms convertion
http://www.kagi.com/birbilis
+ Robotics
http://www.mech.upatras.gr/~robgroup
........................................................................
- Next message: Umesh Unnikrishnan [MSFT]: "RE: New Project"
- Previous message: George Birbilis [MVP J#] [9880]: "Re: Possible bug in Class.isAssignableFrom(Class)"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|