fleetwoodfc
Posts: 3
Joined: Mon Dec 13, 2010 4:23 pm

Trial License java integration

I am trying to figure out "How do I interrogate the licensing library to get license information?" from a java program. Tried to implement a test program based upon the java sample provided i.e.

public class MyMainClass {

public native static String GetPropertyValue(String aName) throws Exception;
...
try {
String value = GetPropertyValue("TrialName");
...
} catch (Exception e) {
e.printStackTrace();
}
...
}

My version is:

public class MyMainClass {

native static short DisplayRegistration();
native static String GetPropertyValue(String aName) throws Exception;

public static void main(String args [] ) {

System.loadLibrary("Trial");

try{
String test = GetPropertyValue("TrialName");
} catch (Exception e) {
e.printStackTrace();
}
}
}
Can't get this to work - error is:
Exception in thread "main" java.lang.UnsatisfiedLinkError: MyMainClass.GetPropertyValue(Ljava/lang/String;)Ljava/lang/String;
at MyMainClass.GetPropertyValue(Native Method)
at MyMainClass.main(MyMainClass.java:24)

Any help would be appreciated.
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: Trial License java integration

Hi,

A "java.lang.UnsatisfiedLinkError" usually occurs when the library can't be found. Can you please make sure the call "System.loadLibrary("Trial");" is loading
correctly the resource "Trial.dll"?

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
fleetwoodfc
Posts: 3
Joined: Mon Dec 13, 2010 4:23 pm

Re: Trial License java integration

Seems like it finds the DLL ok but has trouble calling the method (ie. can't find GetPropertyValue in my case). I have only just started with this but from a quick google there is information on how to make a 'JNI DLL' in Visual C++ - have you addressed this in your solution?
Bogdan
Posts: 2796
Joined: Tue Jul 07, 2009 7:34 am
Contact: Website

Re: Trial License java integration

Hi,

We have made a test jar with the same code you are using and the package works correctly. After certain test scenarios we managed to reproduce your error only if the Java Product
is not added to the list of "Trialware Products" from the Licensing page, Options tab, lower side of the page.

You can easily add the product to the list using the "Add..." button from the right side of the view.

Regards,
Bogdan
Bogdan Mitrache - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
survival
Posts: 2
Joined: Sun Mar 20, 2011 9:39 pm

Re: Trial License java integration

Hi,

We have made a test jar with the same code you are using and the package works correctly. After certain test scenarios we managed to reproduce your error only if the Java Product
is not added to the list of "Trialware Products" from the Licensing page, Options tab, lower side of the page.

You can easily add the product to the list using the "Add..." button from the right side of the view.
I don't know anymore what to do

Can I get a tutorial step-by-step with screenshoot or view video tutorials

please let me know,
where I could visit all about it

:?: :?: :?:

Return to “Common Problems”