Dear CDKers,
I would like to point a little issue concerning CDK descriptors
calculation. In my application, the user has the possibility to
calculate one, several or all CDK descriptors using a checking tree.
To build this tree, I have to get all descriptors classes, and
corresponding descriptors name for each class. To do so, I use the
following snippet:
DescriptorEngine engine = new DescriptorEngine(
DescriptorEngine.MOLECULAR);
String[] dClasses = engine.getAvailableDictionaryClasses();
Which should normaly returns all descriptors classes available. The
problem appears when I deploy my application as an executable jar
file. Briefly, my application is organised as follow:
myApp.jar
lib/*.jar (including the CDK)
settings/*
As you can see, all external JAR files are not included in the
application jar file, but are bundled in the same directory under the
lib/ folder. And with such organisation, the dClasses array is simply
empty at execution...
Why? I checked the method getAvailableDictionaryClasses(), and finally
figured that the class list is created by scanning each jar file
contained in the java.class.path property, as shown in the following
snippet extracted from the getDescriptorClassNameByPackage(String
packageName, String [] jarFileNames) method:
if (packageName == null || packageName.equals("")) {
packageName = "org.openscience.cdk.qsar.descriptors.molecular";
}
String[] jars;
if (jarFileNames == null) {
String classPath = System.getProperty("java.class.path");
jars = classPath.split(File.pathSeparator);
}
else {
jars = jarFileNames;
}
List<String> classlist = new ArrayList<String>();
for (String jar : jars) {
(....)
The problem is actually the java.class.path property. This property
does not actually contains the full classpath, but only the classpath
as defined at the application startup. This results, in my case, in a
single jar file explored on the loop: myApp.jar, which obviously does
not contains any CDK descriptor class.
So here is my questions:
1. Are you aware of this?
2. In the default case (when we create a descriptor engine using the
default parameters), why don't you simply load all descriptors classes
available in the CDK? In such case, there is no need to check any jar
file as we have already a direct access to all classes..
Cheers :)
Vincent.
------------------------------------------------------------------------------
This SF.Net email is sponsored by the Verizon Developer Community
Take advantage of Verizon's best-in-class app development support
A streamlined, 14 day to market process makes app distribution fast and easy
Join now and get one step closer to millions of Verizon customers
http://p.sf.net/sfu/verizon-dev2dev
_______________________________________________
Cdk-user mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/cdk-user