Hello Nick, Looks like you are using the 1.2.5. version compiled from source. I encountered the same problem, it comes from the fact that a few template files used by the SDG are not included in the source distribution, but they are included in the ready-made jar from sourceforge. This is already known, and should be fixed soon. The exception you see printed is not fatal, your program should complete normally. It just looks very bad because there's a debugging "System.err.println(); ex.printStackTrace();" that was accidentally left in.
here's how to fix it: A) for very lazy people: - Get the full CDK jarfile from sourceforge - use that instead of the manually compiled cdk-from-source jarfile - fixed! B) if you can't use A because you've made changes to the cdk-source: - Again get the full CDK jarfile from sourceforge - open it and find the subfolder "/org/openscience/cdk/layout/templates/" - copy that folder with contents to the same place in the jar-file you use - fixed! The templates are used by the SDG to neatly layout some idiotic substructures like adamantane and cubane, which looks ugly otherwise, they are not necessary for 'normal' structures. Cheers! Jules On 3 August 2010 17:29, Nick Vandewiele <[email protected]> wrote: > Hi, > > When using StructureDiagramGenerator.setMolecule(IMolecule) method in the > code snippet below, it produces a NullPointerException mentioned below. I’m > using cdk1.2.5, although I encountered the same in the cdk1.3.5 branch. What > am I doing wrong here? > > Thanks in advance, > > IMolecule triazole = MoleculeFactory.make123Triazole(); > StructureDiagramGenerator sdg = new StructureDiagramGenerator(); > sdg.setMolecule(triazole); > > Reason: null > java.lang.NullPointerException > at java.io.Reader.<init>(Reader.java:61) > at java.io.InputStreamReader.<init>(InputStreamReader.java:55) > at > org.openscience.cdk.layout.TemplateHandler.loadTemplates(TemplateHandler.java:98) > at > org.openscience.cdk.layout.TemplateHandler.<init>(TemplateHandler.java:83) > at > org.openscience.cdk.layout.StructureDiagramGenerator.setMolecule(StructureDiagramGenerator.java:131) > > at > org.openscience.cdk.layout.StructureDiagramGenerator.setMolecule(StructureDiagramGenerator.java:221) > > at pinanol.main(filename.java:69) > > > > Nick VANDEWIELE > > ------------------------------------------------------------------------------ > The Palm PDK Hot Apps Program offers developers who use the > Plug-In Development Kit to bring their C/C++ apps to Palm for a share > of $1 Million in cash or HP Products. Visit us here for more details: > http://p.sf.net/sfu/dev2dev-palm > _______________________________________________ > Cdk-user mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/cdk-user > > ------------------------------------------------------------------------------ The Palm PDK Hot Apps Program offers developers who use the Plug-In Development Kit to bring their C/C++ apps to Palm for a share of $1 Million in cash or HP Products. Visit us here for more details: http://p.sf.net/sfu/dev2dev-palm _______________________________________________ Cdk-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/cdk-user

