User d68ef9d5a9
27-09-2006 15:13:21
Hi,
I like to start a new topic here about the molecular image process. This topic might be related to the to topic I posted before (Improvement is needed for structure image), but I believe we are dealing with a problem not necessary belong ChemAxon. However, I would like to introduce this topic for discussion, with the hope of either ChemAxon experts or sophisticated users can provide a solution to our problem.
What I need is to develop a servlet to provide molecular image. Following is the code I copied from the other post. This is basically I try to do, and it works well in Window environment, but not in Unix or Linux environment.
The problem is Headless exception. According to definition, this exception is throw when code that is dependent on a keyboard, display, or mouse is called in an environment that does not support a keyboard, display, or mouse. However Unix and Linux servers are frequently used to support web server, and they do not normally have display device at all. I have searched internet for solution, and tried a few of them. None of them solve my problem.
So I wonder if any of you seen this before can provide some clues for me to try. Thanks.
Ben Li
// create a sketcher and put it into a frame
JFrame frame = new JFrame();
MSketchPane sketchpanel = MSketchPane();
frame.getContentPane().add(sketchpanel);
// set the layout for image export
sketchpanel.setRendering("wireframe");
sketchpanel.setMolbg(new Color(0xffffff));
sketchpanel.setWireThickness(0.084);
sketchpanel.setMol(mol);
// arange components inside the frame but do not display it
frame.pack();
// get the image
java.awt.Image img = sketchpanel.getImage(new Dimension(300,300));
I like to start a new topic here about the molecular image process. This topic might be related to the to topic I posted before (Improvement is needed for structure image), but I believe we are dealing with a problem not necessary belong ChemAxon. However, I would like to introduce this topic for discussion, with the hope of either ChemAxon experts or sophisticated users can provide a solution to our problem.
What I need is to develop a servlet to provide molecular image. Following is the code I copied from the other post. This is basically I try to do, and it works well in Window environment, but not in Unix or Linux environment.
The problem is Headless exception. According to definition, this exception is throw when code that is dependent on a keyboard, display, or mouse is called in an environment that does not support a keyboard, display, or mouse. However Unix and Linux servers are frequently used to support web server, and they do not normally have display device at all. I have searched internet for solution, and tried a few of them. None of them solve my problem.
So I wonder if any of you seen this before can provide some clues for me to try. Thanks.
Ben Li
// create a sketcher and put it into a frame
JFrame frame = new JFrame();
MSketchPane sketchpanel = MSketchPane();
frame.getContentPane().add(sketchpanel);
// set the layout for image export
sketchpanel.setRendering("wireframe");
sketchpanel.setMolbg(new Color(0xffffff));
sketchpanel.setWireThickness(0.084);
sketchpanel.setMol(mol);
// arange components inside the frame but do not display it
frame.pack();
// get the image
java.awt.Image img = sketchpanel.getImage(new Dimension(300,300));