The problem is more than just the library.
I have noticed any library I add will not work through the import statement. For example:
My code looks like the following:
import net.sf.jasperreports.engine;
private void jButton1MouseClicked(java.awt.event.MouseEvent evt) {
// TODO add your handling code here:
try {
String reportName = "mystuff.jasper";
InputStream fis = this.getClass().getClassLoader().getResourceAsStream(reportName);
JasperPrint print = JasperFillManager.fillReport(fis, new HashMap(), new JREmptyDataSource());
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
The Netbeans 6.1 IDE tells me on the import line that net.sf.jasperreports does not exist. However, if I comment out the import line and fully qualify the reference to the libarary it compiles. For example:
try {
String reportName = "myreport.jasper";
InputStream fis = this.getClass().getClassLoader().getResourceAsStream(reportName);
net.sf.jasperreports.engine.JasperPrint print = net.sf.jasperreports.engine.JasperFillManager.fillReport(fis, new java.util.HashMap(), new net.sf.jasperreports.engine.JREmptyDataSource());
}
catch (Exception ex)
{
ex.printStackTrace();
}
}
This is all after I have gone to the properties of the project and added the JasperReport Library.
I think it is a bug in the IDE. Netbeans, any comments?
[Message sent by forum member 'srmcatee' (srmcatee)]
http://forums.java.net/jive/thread.jspa?messageID=286286