package br.com.caelum.financas;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.SQLException;
public class ConnectionFactory {
public Connection getConnection() {
try {
return DriverManager.getConnection("jdbc:mysql://localhost/movimentacoes", "root", "admin");
} catch (SQLException e) {
throw new RuntimeException(e);
}
}
}
package br.com.caelum.financas.relatorio;
import java.sql.Connection;
import java.sql.SQLException;
import net.sf.jasperreports.engine.JRException;
import net.sf.jasperreports.engine.JasperCompileManager;
import br.com.caelum.financas.ConnectionFactory;
public class TesteGeraRelatorio {
public static void main(String[] args) throws SQLException, JRException {
Connection conexao = new ConnectionFactory().getConnection();
JasperCompileManager.compileReportToFile("report5.jrxml");
conexao.close();
}
}
O erro é esse.
Exception in thread "main" net.sf.jasperreports.engine.JRException: Error compiling report java source files : C:\Users\Alison\workspace2\movimentacoes\report5_1493828210017_829906.java C:\Users\Alison\workspace2\movimentacoes\report5_CharDataSet_1493828210017_829906.java C:\Users\Alison\workspace2\movimentacoes\report5_CROSSTAB0_1493828210017_829906.java
at net.sf.jasperreports.engine.design.JRJavacCompiler.compileClasses(JRJavacCompiler.java:106)
at net.sf.jasperreports.engine.design.JRAbstractClassCompiler.compileUnits(JRAbstractClassCompiler.java:77)
at net.sf.jasperreports.engine.design.JRAbstractCompiler.compileReport(JRAbstractCompiler.java:201)
at net.sf.jasperreports.engine.JasperCompileManager.compile(JasperCompileManager.java:240)
at net.sf.jasperreports.engine.JasperCompileManager.compileToFile(JasperCompileManager.java:156)
at net.sf.jasperreports.engine.JasperCompileManager.compileToFile(JasperCompileManager.java:115)
at net.sf.jasperreports.engine.JasperCompileManager.compileReportToFile(JasperCompileManager.java:415)
at br.com.caelum.financas.relatorio.TesteGeraRelatorio.main(TesteGeraRelatorio.java:16)
Caused by: java.io.IOException: Cannot run program "javac": CreateProcess error=2, O sistema não pode encontrar o arquivo especificado
at java.lang.ProcessBuilder.start(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at java.lang.Runtime.exec(Unknown Source)
at net.sf.jasperreports.engine.design.JRJavacCompiler.compileClasses(JRJavacCompiler.java:75)
... 7 more
Caused by: java.io.IOException: CreateProcess error=2, O sistema não pode encontrar o arquivo especificado
at java.lang.ProcessImpl.create(Native Method)
at java.lang.ProcessImpl.<init>(Unknown Source)
at java.lang.ProcessImpl.start(Unknown Source)
... 11 more
Tá falando que passei algum caminho errado, mais não passei nada apenas baixei o projeto da alura e modifiquei os detalhes do banco e nome do meu relatório...