11 Replies Latest reply: Feb 1, 2007 5:05 AM by 843804 RSS

    Question on creating dll

    843804
      I have a java program(MyCustomBean) which depends on other classes for it to successfully run. Now I need to create an ActiveX object for MyCustomBean. How do I include the other classes in my dll deployment? Do I create another jar with the depending classes and then create a dll for that? If so, how will MyCustomBean.dll know where to look for the classes it calls?

      I am totally confused on this.

      Can anybody please help?

      Thanks
        • 1. Re: Question on creating dll
          843804
          The way I did it was to put the supporting classes into jar file(s) and put them into the <jre_home>/lib/ext directory

          • 2. Re: Question on creating dll
            843804
            I only create package DLL's for the beans I need exposed. The supporting classes are still accesible from the bean, just not directly from COM.

            So, I package MyCustomBean to create MyCustomBean.dll and register that. I can do a CreateObject on the MyCustomBean and if it references some other class in it's constructor or methods, those classes are still accessible from the bean's JVM, just not from COM.

            Hope this helps.
            • 3. Re: Question on creating dll
              843804
              I created a dll for myBean and had my other dependent classes dir in my classpath. But somehow the bean doesn't run and gives me
              Runtime Error 438: Object doesn't support this property or method from the VB.

              The error occurs at calling the method.
              ===========

              Dim objBean As Object
              Set objBean = CreateObject("CustomLabelBean.Bean.1")

              Dim btArray() As Byte
              Dim bg As String
              Dim ft As String

              bg = "file"
              ft = "type"
              btArray = objBean.Render(bagname, filetype)
              =============
              any pointers?
              • 4. Re: Question on creating dll
                843804
                You create one bean class and one jar package with other java classes the bean object can return to activeX. If a bean object method returns another class X object than in the activeX simple use the Set command, i.e late binding.

                i.e Set classObj = bean.getAnotherClassObj(param1, param<n>)
                classObj.methodCall
                .....
                Set classObj = Nothing

                Regards
                Abraham Khalil


                • 5. Re: Question on creating dll
                  843804
                  Sounds not like a class path problem or even really a registration problem.

                  I see that the method you're trying to call is supposed to return an array of bytes. I've had problems in the past returning arrays of objects to COM. However, I was always returning arrays of objects not primitives like byte.

                  I wonder if it's a mismatch between the java-to-COM type mapping between the method's signature and the signature of the variable you're trying to update.

                  Yeah, try using Set for sure. You might also want to think about

                  1. Looking up the byte-Byte mapping from/to Java
                  2. Changing your methods signature to return a count and then an indexed value (could be expensive if that array is large).

                  Good luck.
                  • 6. Re: Question on creating dll
                    843804
                    Yeah, you are right. I did have problems returning the Byte array to VB. But then when I changed the Byte to Variant in VB it works fine. Thanks for your help.

                    • 7. creating dll IN JAVA
                      843804
                      I AM A STUDENT .I WANT PROPER NOTES FOR HOW TO CREATE DLL COMPONENT IN JAVA
                      • 8. Re: creating dll IN JAVA
                        843804
                        Dear Sir,
                        I am a student. I want to know how to create a DLL component in JAVA. Please help me.
                        • 9. Re: creating dll IN JAVA
                          843804
                          Dear Sir,
                          I am a student. I want to know how to create a DLL
                          component in JAVA. Please help me.
                          "DLL component in Java"?
                          Do you mean embed Java GUI in an ActiveX component, or create an "invisible" DLL (JNI) that can be accessed from Java code?
                          • 10. Re: Question on creating dll
                            843804
                            how to execute native method and how to craete .dll
                            • 11. creating dll from java
                              843804
                              i d like to knw if there is a way of creating a dll from java source code,that would be usable by some c code... and also the vice versa