Jump to content
We've recently updated our Privacy Statement, available here ×

Unable to compile the java program which is importing net.sf.jasperreports.engine.jasperCompileManager


visingh

Recommended Posts

I am attaching java program below. Which I am compiling through command line. I am setting the classpath through command line. I have copied jasperReport.5.1.0.jar file in classpath. But stil I am getting

"Package net.sf.jasperReports.engine does not exist" Error. I have used the jar file from jaspersoft community version. I have also copied few other dependent jar files. Nothing is working.

I have jdk1.7 and JRE1.7 and JRE 7.0 in my machine. I do not have JasperReport server in my machine I am having only jaspersoft studio in my machine.

Can somebody help me on this.

import java.sql.Connection;
import java.sql.DriverManager;
import java.util.HashMap;

import net.sf.jasperreports.engine.JasperCompileManager;
import net.sf.jasperreports.engine.JasperExportManager;
//import net.sf.jasperreports.engine.JasperFillManager;
//import net.sf.jasperreports.engine.JasperPrint;

public class AQM_Test {
 public static void main(String[] args) {
  HashMap hm = null;
  System.out.println("Usage: ReportGenerator ....");

  try {
   System.out.println("Start ....");
   // Get jasper report
   String jrxmlFileName = "C:/reports/C1_report.jrxml";
   String jasperFileName = "C:/reports/C1_report.jasper";
   String pdfFileName = "C:/reports/C1_report.pdf";  
  
  } catch (Exception e) {
   System.out.print("Exceptiion" + e);
  }
 }
}

Link to comment
Share on other sites

  • 2 weeks later...
  • Replies 3
  • Created
  • Last Reply

Top Posters In This Topic

Hi, 
it's not clear to me if you tried to create and compile this file from inside Jaspersoft Studio. Moreover which version are you using? Plug-in or stand-alone?
You should be able to see JR packages when creating Java files from inside JSS.

Your project must have the "JasperReports Library" in Build Path. Plus if you are using the standalone version you should be sure to enable "Java Development" capabilities. This can be done via Window > Preferences > General > Capabilities.

Best regards,
Massimo.

Link to comment
Share on other sites

  • 2 weeks later...

I have resolved this problem.

I have added JasperReports-5.1.0.jar file name in classpath by below command

SET CLASSPATH=C:ABCJasperReports-5.1.0.jar;C:ABC

WHERE C:ABC  is the path where my java program file resides. 

Then I compiled the program by below command

javac C:ABCJavaProgram.java

Hope it will help you

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...