alaa56mm Posted June 28, 2007 Share Posted June 28, 2007 Dear all... when i have a .jasper file , and i don't have its source, how can i decompile this jasper file to its source.. Regards Link to comment Share on other sites More sharing options...
singhipst Posted June 28, 2007 Share Posted June 28, 2007 use following code Code:import net.sf.jasperreports.engine.JRException;import net.sf.jasperreports.engine.JasperReport;import net.sf.jasperreports.engine.design.JasperDesign;import net.sf.jasperreports.engine.util.JRLoader;import net.sf.jasperreports.engine.xml.JRXmlWriter;class JasperToJrxmlConverter{ public static String sourcePath,outputPath; public static JasperDesign jd = new JasperDesign(); public static void main(String [] args) { Long executionStartTime=new Long(0); Long executionStopTime=new Long(0); // File Paths sourcePath = "D:\JasperTest\Template3.jasper"; outputPath = "D:\JasperTest\Template3.jrxml"; try { executionStartTime=System.currentTimeMillis(); //JasperDesign jd=(JasperDesign)JRXmlLoader.load(sourcePath); //JRXmlWriter.writeReport(jd, outputPath); JasperReport jd = (JasperReport) JRLoader.loadObject(sourcePath); JRXmlWriter.writeReport(jd, outputPath, "UTF-8"«»); executionStopTime=System.currentTimeMillis(); System.out.println("Successfully Decompiled Jsaper File Into JRXML File : n"«»); System.out.println("Total Time Taken Is : "+(executionStopTime-executionStartTime)+" msn"«»); System.out.println(" JRXML File Name And Location Are :n"«»); System.out.println(outputPath+"n"«»); } catch(JRException e) { e.printStackTrace(); } }} Link to comment Share on other sites More sharing options...
alaa56mm Posted June 28, 2007 Author Share Posted June 28, 2007 thank yo man...B) Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now