Nullpointerexception error

Asked

Viewed 62 times

1

I have a program that does biometric authentication in two versions:

1) User selects binary file via javax.swing as follows:

public class Busca extends javax.swing.JFrame {
   ...
   java.io.FileInputStream fis = null; fis = new            
   Java.io.FileInputStream(fs_at.getSelectedFile()); nLoadLen = fis.read(loadData); 
   int retornoexp = exportEngine.ImportFIR(loadData, nLoadLen, nMinType, hLoadFIR);

2) In the other version, I run the program via command line and the file is passed as parameter, thus:

public int autentic_python(String arquivo) { 
   ..... 
   fis = new java.io.FileInputStream(arquivo); 
   nLoadLen = fis.read(loadData); 
   int retornoexp = exportEngine.ImportFIR(loadData, nLoadLen, nMinType, hLoadFIR);

The problem is that in the second version gives the error Java.lang.NullPointerException in charge exportEngine.

What am I doing wrong?

  • Checked whether nLoadLen is greater than zero? It may not have anything to read in loadData

  • 2

    Fernando, welcome to [pt.so]! Check that the file is in the correct path. Try to use absolute path if you are using relative. Also check that my command parameter is actually being passed to the method. Anyway, only with this information is difficult to say the problem, so try to debug and complete the question with more information, editing it, so we can help you better. Hug!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.