NullPointerException when using ElemantalAnalyser

User fe5cbe5ff5

05-08-2008 18:01:16

Hi,


I am getting the following exception when I try to create an instance of ElementalAnalyserPlugin or even just ElementalAnalyser:





java.lang.NullPointerException: in is null


at java.util.zip.ZipInputStream.<init>(ZipInputStream.java:56)


at chemaxon.struc.PeriodicSystem.a(Unknown Source)


at chemaxon.struc.PeriodicSystem.<clinit>(Unknown Source)


at chemaxon.calculations.ElementalAnalyser.<clinit>(Unknown Source)


at edu.umich.metworks.lims.GetLogP.main(GetLogP.java:122)


Exception in thread "main" java.lang.ExceptionInInitializerError


at edu.umich.metworks.lims.GetLogP.main(GetLogP.java:122)


Caused by: java.lang.NullPointerException


at chemaxon.struc.PeriodicSystem.getElementCount(Unknown Source)


at chemaxon.calculations.ElementalAnalyser.<clinit>(Unknown Source)


... 1 more








I read topic 3780 and realized that I need the elements.zip file for the PeriodicSystem class, but I don't understand where and how to add this file so that the class can see it. The IDE I am using is Eclipse. Please help!





Thanks in advance,


Anu

ChemAxon e08c317633

06-08-2008 12:49:12

Hi,





The problem is that the elements.zip and isotopes.zip files are not found. There are two solutions for this problem:





1. Use MarvinBeans.jar, it includes these two zip files packaged into jar. It can be downloaded from the Download Marvin for Developers section on our download page.





2. If you use the jmarvin.jar provided with the JChem package, then copy the two zip files to directory named "chemaxon" near the jmarvin.jar you use from Eclipse. The directory structure should look like this:
Code:
jmarvin.jar


chemaxon/elements.zip 


chemaxon/isotopes.zip



Regards,





Zsolt

User fe5cbe5ff5

06-08-2008 15:43:38

I am using jmarvin.jar and my directory structure looks just like you said it should. The jmarvin.jar is in


"C:\Program Files\ChemAxon\JChem\marvin"


and the elements.zip and isotopes.zip is in


"C:\Program Files\ChemAxon\JChem\marvin\chemaxon"





Its still gives me the NullPointerException

ChemAxon 7c2d26e5cf

06-08-2008 16:19:27

Please do not use jmarvin.jar for integrating Marvin API in your application.





jmarvin.jar is the core jar of Marvin Applets package. It is designed for web developers to integrate Marvin applets on web pages.


The Marvin Applets (public) API includes only two classes: JMSketch and JMView. You can use them from JavaScript to help communication between the applet and other elements on the web page.


If you take a look at to the Marvin Applets examples, you can see how to use it.


http://www.chemaxon.com/marvin/examples/index.html





As I see, you need the Marvin Beans API. It provides classes to insert MarvinSketch and MarvinView as components into GUI applications, convert among different molecule formats or do calculations with molecules. In the Marvin Beans package, jar files are located in the "lib" subdirectory of the package.





The JChem API also contains the full Marvin Beans API. The API is located in the jchem.jar that you can find in the "lib" directory of the JChem package.


Other resources in this directory are also required for Marvin/JChem.





So, when you set your Eclipse project, these classes should be also in the CLASSPATH.





If you do not need JChem classes, download Marvin Beans package. If JChem API is important for you, download JChem package.

User fe5cbe5ff5

06-08-2008 18:42:28

Thankyou so much!!! That really helped! I have added the jchem.jar now and removed all the other jars I had added individually.


Thanks once again!





Anu