Hi Oliver, Looks like a class path error. How are you linking the library?
Also you should use the silent builder - it is much faster. Bit confusing but the default is only useful if you need event listeners on molecules (which you normally don't). J Sent from my iPhone On 3 Jan 2013, at 16:13, Oliver Karch <[email protected]> wrote: > Hello cdk gurus, > > all the best and a happy new year! > > I am currently trying to use cdk's smiles parser. Unfortunately I cannot > get it working. The code at the very bottom prints: > > Create Smiles parser... > Exception in thread "main" java.lang.NoSuchMethodError: > org.openscience.cdk.DefaultChemObjectBuilder.getInstance()Lorg/openscience/cdk/DefaultChemObjectBuilder; > at com.emd.chemical.TestSmiles.main(Unknown Source) > > If I am using the DebugChemObjectBuilder instead, it seems to work... > What did I wrong? > Any hints are warmly appreciated. > Many thanks. > > Oliver > > p.s. my environment > java version "1.7.0_02" > Java(TM) SE Runtime Environment (build 1.7.0_02-b13) > Java HotSpot(TM) 64-Bit Server VM (build 22.0-b10, mixed mode) > Linux cuba 2.6.37.6-24-desktop #1 SMP PREEMPT 2012-10-18 22:36:08 +0200 > x86_64 x86_64 x86_64 GNU/Linux > > Output using DebugChemObjectBuilder > > Create Smiles parser... > OK. > Parsing smiles... > Molecule: Molecule(576464345, AtomContainer(576464345, #A:6, > Atom(599974635, S:C, H:1, AtomType(599974635, N:C.sp2, FC:0, H:SP2, > NC:3, EV:4, Isotope(599974635, Element(599974635, S:C, AN:6)))), > Atom(958113357, S:C, H:1, AtomType(958113357, N:C.sp2, FC:0, H:SP2, > NC:3, EV:4, Isotope(958113357, Element(958113357, S:C, AN:6)))), > Atom(388841694, S:C, H:1, AtomType(388841694, N:C.sp2, FC:0, H:SP2, > NC:3, EV:4, Isotope(388841694, Element(388841694, S:C, AN:6)))), > Atom(469613237, S:C, H:1, AtomType(469613237, N:C.sp2, FC:0, H:SP2, > NC:3, EV:4, Isotope(469613237, Element(469613237, S:C, AN:6)))), > Atom(787271534, S:C, H:1, AtomType(787271534, N:C.sp2, FC:0, H:SP2, > NC:3, EV:4, Isotope(787271534, Element(787271534, S:C, AN:6)))), > Atom(1025922771, S:C, H:1, AtomType(1025922771, N:C.sp2, FC:0, H:SP2, > NC:3, EV:4, Isotope(1025922771, Element(1025922771, S:C, AN:6)))), #B:6, > Bond(2049480620, #O:SINGLE, #S:NONE, #A:2, Atom(958113357, S:C, H:1, > AtomType(958113357, N:C.sp2, FC:0, H:SP2, NC:3, EV:4, Isotope(958113357, > Element(958113357, S:C, AN:6)))), Atom(599974635, S:C, H:1, > AtomType(599974635, N:C.sp2, FC:0, H:SP2, NC:3, EV:4, Isotope(599974635, > Element(599974635, S:C, AN:6)))), ElectronContainer(2049480620EC:0)), > Bond(1282230271, #O:SINGLE, #S:NONE, #A:2, Atom(388841694, S:C, H:1, > AtomType(388841694, N:C.sp2, FC:0, H:SP2, NC:3, EV:4, Isotope(388841694, > Element(388841694, S:C, AN:6)))), Atom(958113357, S:C, H:1, > AtomType(958113357, N:C.sp2, FC:0, H:SP2, NC:3, EV:4, Isotope(958113357, > Element(958113357, S:C, AN:6)))), ElectronContainer(1282230271EC:0)), > Bond(1583882228, #O:SINGLE, #S:NONE, #A:2, Atom(469613237, S:C, H:1, > AtomType(469613237, N:C.sp2, FC:0, H:SP2, NC:3, EV:4, Isotope(469613237, > Element(469613237, S:C, AN:6)))), Atom(388841694, S:C, H:1, > AtomType(388841694, N:C.sp2, FC:0, H:SP2, NC:3, EV:4, Isotope(388841694, > Element(388841694, S:C, AN:6)))), ElectronContainer(1583882228EC:0)), > Bond(101317784, #O:SINGLE, #S:NONE, #A:2, Atom(787271534, S:C, H:1, > AtomType(787271534, N:C.sp2, FC:0, H:SP2, NC:3, EV:4, Isotope(787271534, > Element(787271534, S:C, AN:6)))), Atom(469613237, S:C, H:1, > AtomType(469613237, N:C.sp2, FC:0, H:SP2, NC:3, EV:4, Isotope(469613237, > Element(469613237, S:C, AN:6)))), ElectronContainer(101317784EC:0)), > Bond(445767052, #O:SINGLE, #S:NONE, #A:2, Atom(1025922771, S:C, H:1, > AtomType(1025922771, N:C.sp2, FC:0, H:SP2, NC:3, EV:4, > Isotope(1025922771, Element(1025922771, S:C, AN:6)))), Atom(787271534, > S:C, H:1, AtomType(787271534, N:C.sp2, FC:0, H:SP2, NC:3, EV:4, > Isotope(787271534, Element(787271534, S:C, AN:6)))), > ElectronContainer(445767052EC:0)), Bond(2130566107, #O:SINGLE, #S:NONE, > #A:2, Atom(1025922771, S:C, H:1, AtomType(1025922771, N:C.sp2, FC:0, > H:SP2, NC:3, EV:4, Isotope(1025922771, Element(1025922771, S:C, > AN:6)))), Atom(599974635, S:C, H:1, AtomType(599974635, N:C.sp2, FC:0, > H:SP2, NC:3, EV:4, Isotope(599974635, Element(599974635, S:C, AN:6)))), > ElectronContainer(2130566107EC:0)))) > > The code: > > import org.openscience.cdk.DefaultChemObjectBuilder; > import org.openscience.cdk.debug.DebugChemObjectBuilder; > import org.openscience.cdk.exception.InvalidSmilesException; > > import org.openscience.cdk.interfaces.IMolecule; > import org.openscience.cdk.smiles.SmilesParser; > > public class TestSmiles { > > public static void main( String[] argv ) { > try { > System.out.println( "Create Smiles parser..."); > SmilesParser sp = new > SmilesParser(DefaultChemObjectBuilder.getInstance()); > // SmilesParser sp = new > SmilesParser(DebugChemObjectBuilder.getInstance()); > System.out.println( "OK." ); > System.out.println( "Parsing smiles..."); > IMolecule m = sp.parseSmiles("c1ccccc1"); > System.out.println( "Molecule: "+m ); > } catch (InvalidSmilesException ise) { > ise.printStackTrace(); > } > } > } > > This message and any attachment are confidential and may be privileged or > otherwise protected from disclosure. If you are not the intended recipient, > you must not copy this message or attachment or disclose the contents to any > other person. If you have received this transmission in error, please notify > the sender immediately and delete the message and any attachment from your > system. Merck KGaA, Darmstadt, Germany and any of its subsidiaries do not > accept liability for any omissions or errors in this message which may arise > as a result of E-Mail-transmission or for damages resulting from any > unauthorized changes of the content of this message and any attachment > thereto. Merck KGaA, Darmstadt, Germany and any of its subsidiaries do not > guarantee that this message is free of viruses and does not accept liability > for any damages caused by any virus transmitted therewith. > > Click http://www.merckgroup.com/disclaimer to access the German, French, > Spanish and Portuguese versions of this disclaimer. > > > ------------------------------------------------------------------------------ > Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS, > MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current > with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft > MVPs and experts. ON SALE this month only -- learn more at: > http://p.sf.net/sfu/learnmore_122712 > _______________________________________________ > Cdk-user mailing list > [email protected] > https://lists.sourceforge.net/lists/listinfo/cdk-user ------------------------------------------------------------------------------ Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and much more. Get web development skills now with LearnDevNow - 350+ hours of step-by-step video tutorials by Microsoft MVPs and experts. SALE $99.99 this month only -- learn more at: http://p.sf.net/sfu/learnmore_122812 _______________________________________________ Cdk-user mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/cdk-user

