users@glassfish.java.net

Re: Please help me with integrating javax.persistence into GlassFish

From: <glassfish_at_javadesktop.org>
Date: Sun, 13 Jul 2008 12:43:32 PDT

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