Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Why can't Netbeans find the class Eclipse can?

 
Marcos Silvestri
Ranch Hand
Posts: 62
Chrome Java Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello folks,

I've developed a small project under Eclipse and I had no problem at all when it comes to declaring packages and using their classes. More specifically, I'm using Apache POI to handle Excel files, and I use the following line of code:

InputStream input = ExcelPOI.class.getResourceAsStream( "Arquivo Status UBB.xls" );

As I told before, the problem runs smoothly, but when I try to run it under Netbeans, adding exactly the same packages, this IDE does not manage to find the class "ExcelPOI" on the line above. I'm literally copying and pasting my code over to Netbeans, with all the package declarations, and only that class can't be found, though I'm unable to proceed.

My list of imports that works in Eclipse and does not work in Netbeans is:

import java.io.IOException;
import java.io.PrintWriter;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import org.apache.poi.POITextExtractor;
import org.apache.poi.POIDocument;
import java.io.InputStream;
import java.util.Iterator;

import org.apache.poi.poifs.filesystem.POIFSFileSystem;
import org.apache.poi.hssf.usermodel.HSSFCell;
import org.apache.poi.hssf.usermodel.HSSFSheet;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.hssf.usermodel.HSSFRow;

Hovering the mouse over the word ExcelPOI on that line above in Eclipse, it indicates "servlets.ExcelPOI", and that is an import I didn't need in Eclipse and is impossible to perform in Netbeans.

Does anyone have ideas on how to proceed to resolve that? I need to go on with Netbeans...

One possible important thing to mention is that in Eclipse I added the file "Arquivo Status UBB.xls" into the package that contains my servlet. Doing the same thing in Netbeans is of no use at all.

To wrap up, all the Apache POI libs used in Eclipse are already imported into Netbeans (only "poi-3.7-20101029.jar" was necessary in Eclipse), whereas that one and lots more from Apache POI were unable to make "ExcelPOI" available for me in Netbeans.

Thanks and regards!
 
Wouter Oet
Saloon Keeper
Posts: 2700
IntelliJ IDE Opera
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
My question would be: why are you using that class to load that resource? Why not use a class which you do have access to?
 
Marcos Silvestri
Ranch Hand
Posts: 62
Chrome Java Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello Wouter,

The class was working within Eclipse, I did not have to worry about that. I just wanted to replicate my project to Netbeans, and then the problem.

The good news is that I found out the issue, it was a fault of mine, a reference in the web.xml that I had forgotten to check.

Thanks anyway, the issue is resolved!

Cheers from Brazil!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic