calling the calculator from Java

User e94ae98ec6

06-08-2010 17:54:25

I am trying to call the chemaxon calculator from java


The following code works perfectly:


String[] args = {inputName, "logp"};
chemaxon.marvin.Calculator.main(args);


However i can't find the correct arguments to make it save the output to a file. The following fails:
        String[] args = {"-o "+ outputName, inputName, "logp"};
        chemaxon.marvin.Calculator.main(args);


Although the following shell command works fine:


cxcalc -o results.sdf molecules.sdf logp


Any idea about how to pass the -o argument to the chemaxon.marvin.Calculator.main or at least how can i capture the output of the calculator?


 

User e94ae98ec6

06-08-2010 17:59:40

I forgot to mention that when i try to execute the aforementioned        String[] args = {"-o "+ outputName, inputName, "logp"};
  


I get the following errors:
java.io.FileNotFoundException: -o /Users/path/to/my/output/results.sdf (No such file or directory)


It seams that the class doesn't undestand the -o argument and just treats it as a part of a filename

User e94ae98ec6

10-08-2010 10:43:58

In case anyone else is following the thread without posting, i was able to find the correct arguments:


String[] args = {"-o", outputName, inputName, "logp"};

ChemAxon e08c317633

23-08-2010 10:12:56

Hi,


Sorry, this topic escaped our notice.


FYI: calculator plugins have their own Java API, see e.g. the logP plugin API: http://www.chemaxon.com/marvin/help/developer/beans/api/chemaxon/marvin/calculations/logPPlugin.html


Zsolt