I'm trying to use a Java library called CDK with Mathematica's J/Link.
Needs["JLink`"];
ReinstallJava[ClassPath -> $jar];
LoadJavaClass["org.openscience.cdk.silent.SilentChemObjectBuilder"];
sp = JavaNew["org.openscience.cdk.smiles.SmilesParser",
SilentChemObjectBuilder`getInstance[]];
vabcVolume = JavaNew["org.openscience.cdk.geometry.volume.VABCVolume"];
atom = sp@parseSmiles["C"]
This short code is the Java equivalent to:
SmilesParser sp = new
SmilesParser(SilentChemObjectBuilder.getInstance());
IAtomContainer m = sp.parseSmiles("C");
As you can see, I need to convert the SmilesParser
object to IAtomContainer
object. In Java, the compiler will do it for me. But I guess Mathematica can't do it automatically. Can someone tell me how I can get an IAtomContainer
object (this is an Interface object, not class object) in Mathematica?