I'm making an application that uses JasperReports, I run the program from my computer and it generates the report well but when I make the .jar and try it from another computer it does not show me anything. My code is as follows
public class Reportes {
private final String hospi = "/Imagenes/Hospital.jpg";
private final String secre = "/Imagenes/Secretaria.jpg";
String path = "/Reporte/newReport.jrxml";
public void ReporteCelulares(int id) throws SQLException, JRException{
Connection a;
a = ConexionSql.getConnection();
Map parametros = new HashMap();
parametros.put("idCompra",id);
parametros.put("Hospital",this.getClass().getResourceAsStream(hospi));
parametros.put("Secretaria",this.getClass().getResourceAsStream(secre));
JasperReport jasper = (JasperReport) JRLoader.loadObject(getClass().getResource(path));
JasperPrint print = JasperFillManager.fillReport(jasper, parametros, a);
JasperViewer ver = new JasperViewer(print,false);
ver.setTitle("Solicitud de compra");
ver.setVisible(true);
}
}
also in a video mention that I must modify the build.xml file because it can not find the libraries because they are out and said that I should enter these lines:
<target name="-post-jar">
<property name="store.jar.name" value="REMA"/>
<property name="store.dir" value="dist"/>
<property name="store.jar" value="${store.dir}/${store.jar.name}.jar"/>
<echo message="Packaging ${application.title} into a single JAR at ${store.jar}"/>
<jar destfile="${store.dir}/temp_final.jar" filesetmanifest="skip">
<zipgroupfileset dir="dist" includes="*.jar"/>
<zipgroupfileset dir="dist/lib" includes="*.jar"/>
<manifest>
<attribute name="Main-Class" value="${main.class}"/>
</manifest>
</jar>
<zip destfile="${store.jar}">
<zipfileset src="${store.dir}/temp_final.jar"
excludes="META-INF/*.SF, META-INF/*.DSA, META-INF/*.RSA"/>
</zip>
<delete file="${store.dir}/temp_final.jar"/>
<delete dir="${store.dir}/lib"/>
<delete file="${store.dir}/README.TXT"/>
</target>
but it does not come out that way either.