Re: Porting from Java (Sun)

From: George Birbilis [MVP J#] [9880] (birbilis_at_kagi.com)
Date: 03/13/04


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
........................................................................



Relevant Pages

  • Re: where do us long time VBers move on to?
    ... > application over to Java. ... > to add when using M$' incomplete controls. ... > While they bragged that converting User Defined or 3rd party controls was ... They had VBers ...
    (microsoft.public.vb.general.discussion)
  • Re: Need HTML/Access Coding Guru for Question
    ... controls on the forms, including combo boxes and formats, would be ... Also can I create an API for other software companies to connect to? ... I have a company who uses Java or Netbeans, I can't remember and they want ... Converting the code to VB.NET could potentially solve both problems. ...
    (microsoft.public.access.formscoding)
  • Re: Modernizing PICK applications
    ... In the PICK BASIC application that we converted, the file definitions ... The codes, i.e. ... the process of converting from a MV file structure to a ... n-tiered application in .NET or JAVA. ...
    (comp.databases.pick)
  • Re: Importing files into the J# IDE
    ... > provides equivalents for much of the functionality described in the Java 2 ... so use JbImp tool to import the compiled classes (the tool doesn't need the ... QuickTime VCL and ActiveX controls ... Plugs VCL and ActiveX controls ...
    (microsoft.public.dotnet.vjsharp)
  • Re: Use VJ# as a way to learn Java?
    ... That's why I suggested the OP not to use the VS IDE to learn Java ... QuickTime VCL and ActiveX controls ... Plugs VCL and ActiveX controls ...
    (microsoft.public.dotnet.vjsharp)