File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Why can't Netbeans find the class Eclipse can? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Why can Watch "Why can New topic

Why can't Netbeans find the class Eclipse can?

Marcos Silvestri
Ranch Hand

Joined: Dec 06, 2009
Posts: 62

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 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.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!

DJ aspirant, Engineering undergraduate, Tokusatsus addicted, fond of English language and Asia's, Buddhist, blogger, etc. I'll need to insert all these attributes in a Java class and manage to create methods for handling my overwhelming life
Wouter Oet
Saloon Keeper

Joined: Oct 25, 2008
Posts: 2700

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?

"Any fool can write code that a computer can understand. Good programmers write code that humans can understand." --- Martin Fowler
Please correct my English.
Marcos Silvestri
Ranch Hand

Joined: Dec 06, 2009
Posts: 62

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!
I agree. Here's the link:
subject: Why can't Netbeans find the class Eclipse can?
It's not a secret anymore!