0

I don't know if this is possible or not, but I have a dll file, which is an external library. In that dll file, I have a class named Calculator, which is stored in a namespace call "myProject.tool".And I want to call this method in the Calculator class:

int doPlus(int num1, int num2){...};

In this specific case, can I called the doPlus method directly from java code and ignored the Calculator class and the namespace by using

public native int doPlus(int num1, int num2);

If I can't, does it mean that I need to have the Calculator object in java? I wonder how can I do it ? Do I need an appropriated java object ?And then how can I call the doPlus method?
I know this question may sounds stupid, but it would be great if you can help me to solve it. Any solution or suggestion is more than welcomed.
Thank you very much.

Xitrum
  • 7,765
  • 26
  • 90
  • 126

1 Answers1

0

You can do it if your original language is C++ using JNI (Java Native Interface)

JNI is a little bit confusing but absolutely it will be enough for you, use this tutorial to do such case

Ihab Ramadan
  • 13
  • 1
  • 5
  • Please don't post links with a only vague bit of context; answers should be substantive and stand on their own,so that even if the site you're linking goes down the answer is still helpful. See [How To Answer](http://stackoverflow.com/help/how-to-answer) for more information. – Nic Mar 23 '15 at 14:41