User ca08ca7ecf
21-07-2008 09:02:01
Hey All,
I'm trying to run a new MSketchPane() in a Web Applet. Unfortuneatly I'm getting an error:
[Mon Jul 21 10:50:48 2008] [error] [client 131.220.136.192] File does not exist: /var/www/localhost/martin/chemaxon/marvin/dict.class
I've found a Dict.class in jogl.jar, but this may not be the class the browser is looking for. Any help is very welcome
thanks in advance
martin
ChemAxon 7c2d26e5cf
22-07-2008 13:38:39
chemaxon/marvin/dict.class does not exist in Marvin but
chemaxon/marvin/dict.properties exists.
When Java search the proper resources for the current localization (resource bundle), attempts to load several file (both dict.class).
In normal case, missing dict.class should not cause any error, just jump to the next file to load in.
You can read more about the file loader policy of resource bundle in this document:
Java Internatioanization: Localization with ResourceBundles
MSketchPane is designed to integrate it into desktop application not into web applets. Probably, it cause the problem.
If you need an applet, please use the JMSketch class in the Marvin Applets package.
Actually, Marvin loads chemaxon/marvin/dict.properties that is located in the MarvinBeans.jar file by beans or in jmarvin.jar by applets.
User ca08ca7ecf
23-07-2008 17:07:58
hey Tamas,
thanks for your kind help!
Maybe you can show me how to access JMSketch()? This would be very nice!
thanks in advance
martin
User ca08ca7ecf
23-07-2008 17:20:17
yes I've been trough the tutorials, but not very familiar with JavaScript....
I would like to write an Applet in Java.
So where is the starting point?
thanks
martin
ChemAxon 7c2d26e5cf
23-07-2008 21:15:40
There are tons of
descriptions about applets on the web.
A good starting point can be the Sun's tutorial:
Lesson: Applets (The Java Tutorials > Deployment)
You can find also a lot of good
JavaScript tutorial on the web. Google gives a lot of hits for
JavaScript tutorial.
After the first view, this tutorial seems to be good:
JavaScript Tutorial
Some HTML knowledge is also useful if you works with applets.
If you start to deploy applets, I suggest you to install a web server.
The web server is required to be able to access the applet's page via HTTP protocol from your browser.
I do not recommend to the users to run applets via FILE protocol (e.g. from appletviewer), since applet behave differently via FILE than via HTTP protocol.
Furthermore, appletviewer has a couple of disadvantages:
- appletviewer can not evaluate JavaScript
- appletviewer launches applets like quasi local applications, not like real applets (whose resources are downloaded from the server at runtime).
If you already have some knowledge in the above subjects, I suggest to see Marvin applets examples. They can help a lot to write your own applet examples and learn how to integrate Marvin applets into web sites.
User ca08ca7ecf
24-07-2008 07:10:55
Hey Tamas,
thanks for your response!
Yes I'm running a webserver already, in my case it's the apache.
I'm able to put an applet on my page as well. But whenever I try to put marvinSketch on it, there are problems.
First of all the applet must be called Test01, every other name seems to fail...
I've done so and the Marvin Sketch Application seems to work.
But I've got to alter the functions, in order to get some specific informations about the compound just drawen on the sketch pane.
So, let's try applets then:
as you said I should use JMSketch, but there seems to be an invalid signer informaton, tough:
java.lang.SecurityException: class "JMSketch"'s signer information does not match signer information of other classes in the same package
what shall I do now?
here is my coding, so far:
Code: |
public void init(){
JMSketch sketch = new JMSketch();
sketch.getContentPane().setLayout(new BorderLayout());
sketch.getContentPane().add(sketch, BorderLayout.CENTER);
sketch.setVisible(true);
sketch.requestFocus();
}
public void start(){
System.out.println("Applet starting.");
}
public void stop(){
System.out.println("Applet stopping.");
}
public void destroy(){
System.out.println("Destroy method called.");
}
|
yes nothing new I guess, but I should start somewhere...
thanks
martin
User ca08ca7ecf
24-07-2008 07:57:30
okay the first obstacle is taken:
so where up to now?
the application way:
Code: |
MSketchPane msPane = new MSketchPane();
msPane.setPreferredSize(new Dimension(530, 400));
setLayout(new BorderLayout());
add(msPane, BorderLayout.NORTH);
|
this should be the applet way:
Code: |
JMSketch jmSketch = new JMSketch();
jmSketch.setPreferredSize(new Dimension(530, 400));
setLayout(new BorderLayout());
add(jmSketch, BorderLayout.CENTER);
|
but it's wrong!
how do I access JMSketch and initialize it properly?
thanks in advance
martin
ChemAxon 909aee4527
24-07-2008 09:30:13
User ca08ca7ecf
24-07-2008 10:29:16
Hi Judith
nice idea, let's use java script!
Code: |
function getSumme() {
if(document.MSketch != null) {
var sum = document.MSketch.getMol().getFormula();
sum = unix2local(sum); // Convert "\n" to local line separator
document.MolForm.MolTxt.value = sum;
} else {
alert("empty");
}
}
|
won't work :(
Code: |
function getMasse() {
if(document.MSketch != null) {
var mass = document.MSketch.getMol().getMass();
mass = unix2local(mass);
document.MolForm.MolTxt.value = mass;
} else {
alert("can't get Mass!");
}
}
|
won't work either :(
how to obtain mass, formula, Iupac Name and the image of a molecule?
thanks in advance
martin
User ca08ca7ecf
24-07-2008 10:41:38
here is another function with an elementAnalyser.
it doesn't work tough:
Code: |
function getMasse() {
if(document.MSketch != null) {
var mol = document.MSketch.getMol();
var elemanal = new ElementalAnalyser();
elemanal.setMolecule(mol);
var mass = mol.getMass();
document.MolForm.MolTxt.value = mass;
} else {
alert("can't get Mass!");
}
} |
ChemAxon 7c2d26e5cf
24-07-2008 18:43:09
The Java API is limitedly accessible from JavaScript. JavaScript can not handle most of Java objects (since it is a weakly typed language).
The Marvin Applets API includes only MarvinSketch and MarvinView applet classes.
Please consult with the
Marvin Applets API documentation to check which methods are available from the applet package.
User ca08ca7ecf
25-07-2008 07:53:43
Hey Tamas
thanks for the informative replys!
I'm getting better! :)
Mass, Forumla, and Smiles are ready
Iupac won't work and so for now I'm wrestling with the getImageShowURL() function.
Is it still experimental?
How to use it anyway?
thank you
martin
ChemAxon 7c2d26e5cf
28-07-2008 12:24:25
Yes, it is an experimental method.
What would you like to do exactly?