View Full Version : Can't use absolute path of a license file to createLicenseSource

05-08-2007, 07:14 AM
In the Java API document, License should support the relative or absolute path of a license file, for example "/a/b/c/license.lic". But it failed with Invalid Server Port Number (-500,4018) returned. Any suggestion?

FLEXnet Licensing version: v11.4.0.0.
under winXP Professional version2002 SP2

05-08-2007, 01:14 PM
Could you post a fragment of the code that fails?

For example, this seems to work:

LicenseSource f1LicSrc =
LicenseSource.createLicenseSource("C:\\jflexapp.lic", viTestInfo, null);

f1license = new License(f1spec, f1LicSrc);


// etc.

05-08-2007, 10:50 PM
Hi, Thanks! But same error returned when we used your sample code!
The following are the fragment of my code
String licSource = System.getenv("VENDOR_LICENSE_FILE");
lic = new License(fs, licSource, vInfo, new ConnectionDataAdapter(){…});

05-09-2007, 10:25 AM
As a sanity check, what is the value of VENDOR_LICENSE_FILE on your system?

(And it seems you're not using createLicenseSource, but if you do, be aware that it takes only a single source and not a list of sources.)

05-09-2007, 09:47 PM
We have changed our code like yours. Still don’t work.

//--changed code--//
fs = new FeatureSpecifier(featureName, version);
LicenseSource f1LicSrc = LicenseSource.createLicenseSource("C:\\20070731-wesley.lic", vInfo, null);
lic = new License(fs, f1LicSrc);

//--our original code--//
String licSource = System.getenv("VENDOR_LICENSE_FILE");
// value of "VENDOR_LICENSE_FILE" is "C:\20070731.lic".
lic = new License(fs, licSource, vInfo, new ConnectionDataAdapter(){…});

05-10-2007, 07:42 AM
To try to isolate the issue, here's a complete simple app that uses a hard-coded absolute path (using the demo toolkit, adapted from 11.4 toolkit sample BasicExample.java):

import com.macrovision.flexlm.*;

public class SimpleExample implements FlexlmConstants
public static final void main(String args[])
// get a VendorInfo instance (below)
VendorInfo vInfo = getVendorInfo( );

FeatureSpecifier fs = null;
License lic = null;

fs = new FeatureSpecifier("F1", "1.0");
lic = new License(fs, "C:\\jflexapp.lic", vInfo, null);

// check out a license

Feature feat = lic.getFeature( );
String vendorString = feat.getVendorString( );
"\nF1 checked out (VENDOR_STRING: " + vendorString + ")\n");
System.out.print("Press Enter to check back in... ");

// wait for user...
try { int i = System.in.read( ); } catch (java.io.IOException e) { }

// check the license back in
lic.checkin( );

} catch (FlexlmException drat)
System.out.println(drat.getMessage( ));

private static VendorInfo getVendorInfo( )
VendorInfo vInfo = null;
try {
vInfo = new demoInfo( );
} catch (FlexlmException e) {
throw new RuntimeException(e.getMessage( ));
return vInfo;
Contents of C:\jflexapp.lic are something like this:
INCREMENT F1 demo 1.0 1-jan-2010 uncounted \
VENDOR_STRING="Hello from JFlexapp.lic!" HOSTID=DEMO SIGN="..."

05-10-2007, 10:33 PM
Thx again. But we have tried this example. Failed with same error.

05-11-2007, 04:30 AM
This is resolved! It is caused by incorrect port in SERVER line of license file.

=original license file
SERVER hostname hostid ANY
=updated license file
SERVER hostname hostid 27000

After updating port in the license file, it works for Java now. But notice that with original license file, license server has been started without any warning or error and C++ application could check out license successfully.