.NET - Java Interoperability


  • Hi,


    we are building a .net application in which we need to call java methods.we created a JAR file from the CLASS, converted the JAR file to a DLL.

    The DLL is referenced in the application, at run-time it is throwing a exception "java.lang.ClassNotFoundException You cann't use Dummy Type : com.crystaldecisions.sdk.framework.CrystalEnterprise". Could some help me to solve this.


    Note:-Java program at runtime isn't giving exception.


    I used the command D:\SriramJava>jbimp /usestubrefs /t:library BOMigrationJar.jar /out:BOMigration.dll to convert JAR to DLL.


    I copied the below after executing jbimp command



    D:\SriramJava>jbimp /usestubrefs /t:library BOMigrationJar.jar /out:BOMigration.dll

    Microsoft (R) Java-language bytecode to MSIL converter version 2.0.50727.42

    for Microsoft (R) .NET Framework version 2.0.50727

    Copyright (C) Microsoft Corp 2000-2002. All rights reserved.


    JbImp warning: Using stub type for Class com.crystaldecisions.sdk.framework.CrystalEnterprise

    JbImp warning: Using stub type for Class com.crystaldecisions.sdk.framework.ISessionMgr

    JbImp warning: Using stub type for Class com.crystaldecisions.sdk.framework.IEnterpriseSession

    JbImp warning: Using stub type for Class com.crystaldecisions.sdk.occa.security.ILogonTokenMgr

    JbImp warning: Using stub type for Class com.crystaldecisions.sdk.occa.infostore.IInfoStore

    JbImp warning: Using stub type for Class com.businessobjects.rebean.wi.ReportEngines

    JbImp warning: Using stub type for Class com.businessobjects.rebean.wi.ReportEngines$ReportEngineType

    JbImp warning: Using stub type for Class com.businessobjects.rebean.wi.ReportEngine

    JbImp warning: Using stub type for Class com.crystaldecisions.sdk.exception.SDKException

    Created BOMigration.dll



    If this is not the correct aliasto post, please suggest where to post these kind of issues





    Dienstag, 5. Juni 2007 09:03


  • Hi-


    While using the userstubrefs option in JBIMP, here is the known behavior – “If a class is referenced and not present in the input, the CLASSPATH environment variable is automatically searched for the missing class and the first found location is displayed with the error information. If this option is not specified, conversion stops if any of the referenced classes are not present in the input. If this option is specified, stub types are emitted into the created assembly for each of the missing classes. This causes the conversion to succeed, but will cause an exception to be thrown when an attempt is made to access a missing class member at run time.”


    From the above, it seems that at runtime you are trying to access the missing class member com.crystaldecisions.sdk.framework.CrystalEnterprise which is not present in the input.


    Also, you need to ensure that the class files do not use functionality from versions other than JDK 1.1.4 (JDK 1.2 equivalent to some) which is what J# supports. For complete information on classes supported by J# in Visual Studio 2005, you might want to refer the following- http://msdn2.microsoft.com/library/67f25kx3(en-us,vs.80).aspx


    More information about JBIMP can be found here - http://msdn2.microsoft.com/en-us/library/y9teabc2(VS.80).aspx.


    Hope this helps.




    Mittwoch, 6. Juni 2007 13:51