MSketch using JChem API in C#

User 8b9e7d3dee

11-05-2009 17:52:50

Hi,


I am developing an application to render structures from molfiles.  This is working fine.


I also need to sketch the molecules.  I am passing a molfile string to a C# function in an assembly and I want to open that molecule in MSketch.  When I initialize the sketcher and/or the SketchPanel, I get the following error.


An unhandled exception of type 'java.lang.NoClassDefFoundError' occurred in JChem.dll


Additional information: cb.aloe.swing.tools.DockPane


I'm trying to launch the sketcher from a C# method using the JChem API with IKVM dlls.


Here are the namespaces I've included. 


using System;


using System.IO;


using System.Data;


using System.Drawing;


using System.Text;


using System.Drawing.Imaging;


using System.Collections.Generic;


using System.ComponentModel;


using System.Reflection;


using System.Windows.Forms;


using chemaxon.jchem;


using chemaxon.formats;


using chemaxon.struc;


using chemaxon.marvin;


using chemaxon.marvin.beans;


using chemaxon.marvin.paint;


using ikvm.awt;


Here is the code to initialize the sketcher:


MSketchPanel m_panel=new MSketchPanel();


Molecule mol =MolImporter.importMol(strStruct,"mol");


m_panel.setMol(mol);


MSketch m_sketch=new MSketch m_sketch(m_panel);


Do I need to include another namespace?

ChemAxon 909aee4527

12-05-2009 09:42:02

Hello Charles,


unfortunately the GUIs are not yet supported in the latest version. If the code was corrected to be able to display MarvinSketch, it would still have a lot of problems.


We are currently working heavily on the GUI support, and we can give a beta version for testing very soon.
We can give estimation for the availability of the beta version early next week, after our ongoing acceptance test is finished.


We would be happy if you could test it and give us a feedback.


Kind regards,
Judit

ChemAxon 909aee4527

26-05-2009 15:09:20

Dear Charles,


this version is ready for testing: http://www.chemaxon.com/shared/Marvin.NET/Marvin_dotNET_78080.zip


We have some known issues in this version, here are the major ones:



A sample code that can be used is as follows:


            JFrame frame = new JFrame();
            frame.setTitle("MarvinSketch " + chemaxon.marvin.VersionInfo.MARVIN_VERSION);
            frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);

            MSketchPane m_panel = new MSketchPane();
            Molecule mol = MolImporter.importMol("CCCCCC");
            m_panel.setMol(mol);
            m_panel.setPreferredSize(new Dimension(550, 500));

            frame.getContentPane().setLayout(new BorderLayout());
            frame.getContentPane().add(m_panel, BorderLayout.CENTER);
            frame.pack();
            frame.setLocationRelativeTo(null);
            frame.setVisible(true);
These are the include statements we used here:


using chemaxon.marvin.beans;
using chemaxon.formats;
using chemaxon.struc;
using java.io;
using javax.swing;
using java.awt


Please tell us if you need more information. Feedback is always welcome!


Kind regards,
Judit