Jump to content
Excelsior Forums
Sign in to follow this  
Xray

Calling DLL created via JET from Java

Recommended Posts

I am new so excuse the naivety of this question.....

I wrote a class in Java and built a DLL from it using JET

I want to use this DLL from other languages but also from Java.

When I try to use my new DLL I get the usual "java.lang.UnsatisfiedLinkError".

I reviewd the examples in /samples/invocation and understand them (I believe)

But there were no examples of how to call the DLL from a java application.

Any help here would be greatly appreciated.

my java which was used to make the dll looks like:

public class MyDLL

{

    public static String getId(String aParam)

  {

        return aParam;

  }

}

my java which calls the dll is:

public class TestDLL

{

    public native static String getId(String aParam);

    public static void main(String[] args)

  {

String lib = "C:/bin/MyDll.dll";

System.load(lib);

System.out.println("done loading library");

getId("XXXX");

    }

}

Share this post


Link to post
Share on other sites

Hello,

You can reference Java classes compiled into DLL as usual.

So in your example you can write something like

public class TestDLL
{
   
    public static void main(String[] args)
   {
     MyDLL.getId("XXXX");
    }
}

For several complete examples, take a look at JET/samples/DLL.

Also, before trying to build application consisting of multiple parts (DLL/EXE), I would recommend you to read JET User's Guide, chapter "Dynamic Linking", section "Multi-component applications".

-AlexM

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×