View Full Version : Java API Issue

07-21-2008, 02:25 PM
I'm attempting to write a short java program that, when ran, will list to the user which features are currently being served by the active license manager. However, I haven't found a way of doing this other than the following way:

String licEnvVar = System.getenv("VENDOR_LICENSE_FILE");
fs = new FeatureSpecifier("f1", "1.0");
lic = new License(fs, licEnvVar, new vendor(), null);
LicenseSource ls = lic.getLicenseSource();
String[] feat = ls.getFeatureList();
for (int i=0; i<feat.length; i++) {
System.out.println("" + feat[i]);

Is there a way, using either the Java API or the flex C libraries, that I can write a program to list out all the supported features with the program itself being ignorant of the features themselves (not having to create a FeatureSpecifier)?

07-21-2008, 03:05 PM
For a single license source, you can use LicenseSource.createLicenseSource instead of using a feature specifier; something like this, perhaps:
ls = LicenseSource.createLicenseSource("@localhost", viDemoInfo, null);

String[] featureList = ls.getFeatureList("demo");

if (featureList != null)
for (int i = 0; i < featureList.length; i++)
System.out.println("Server knows about: " + featureList[i]);
} catch (FlexlmException darn)
System.out.println(darn.getMessage( ));

07-21-2008, 03:52 PM
That worked! Thank you very much.