plugin license setup
We have license for marvin plugin and was put in ../username/chemaxon/licenses.dat in windows file system and running marvin sketch executible can pick it up.
Now when I worked in C# with JNBridge to run plugin, I got license error after the first molecule. However if I use LicenseHandler.set("chemaxon.marvin.calculations.logDPlugin","********") in the init code, the license exists exception was throws.
Can you tell me how to setup the license in the code, or do I have to do it in Java side?
Which Marvin version are you using?
In your .NET application configuration file (<executable>.config), what is the scheme attribute of the configuration/jnbridge/dotNetToJavaConig element? Is it "sharedmem"?
Marvin Sketch version is 4.1.6 and I do use sharemem with JNBridge 3.1.
I would like to know how to put license in code, instead of config file or license file.
Both Marvin 4.1.6 and Marvin 4.1.7 pick up the licensing information in %SystemDrive%\Documents and Settings\%USERNAME%\chemaxon\licenses.dat without problem in my environment.
Regarding LicenseHandler.set(...), I wonder how you managed to compile your .NET code with a reference to the chemaxon.LicenseHandler. This class is not included in the public API and we don't generate a .NET proxy for this class.
Still, if I generate a proxy for the LicenseHandler class, I can use its set(String, String) method without problem in .NET like this:
(I used Marvin 4.1.7 for this test.)
Notice that I use the license code of the logP plugin, which will turn on logD as well.
Also note that calling chemaxon.LicenseHandler.set(String, String) will create a license.dat file anyway in %SystemDrive%\Documents and Settings\%USERNAME%\chemaxon\. This is something I've noticed just now myself... In some cases, I had to manually delete this "generated" licesenses.dat file to ensure that chemaxon.LicenseHandler.set(String, String) work after application restart.
I forgot to add that I have used JNBridgePro v3.0.1 (2.0-targeted) for my tests. This is the version we have tested Marvin and JChem with. You can download it from here: http://www.chemaxon.com/jnbridge/
If you use the runtime downloadable from our site, please, execute the following command after unpacking:
|registrationTool.exe /n /SE |
in order to register it in the Standard Edition mode.
(There is one registrationtool.exe in the 1.x-targeted and one in the 2.0-targeted directory. You have to pick the one corresponding to your .NET version.)
chemaxon.LicenseHandler.set(String, String) is an internally used method to save the license key - set with the LicenseHandler GUI - to the licenses.dat file (as Peter pointed out before). This method is not part of the public API.
Please prefer using the common way (our applications/classes read the license keys from the licenses.dat file, and use them automatically), we will fully support your application development in .NET through JNBridge. If you can not avoid setting the license keys from a java/C# class in your application, then please email us.
Soory for not reply in time, right now I am using a workaround by copying the license file to user's home dir, but I have not tested it on different machine yet. It might cause some security issue when coupled with Clickonce, I will update after I did test.