Problemas com jar e relatório

4 respostas
Vanilson

Boas pessoal eu estou com dois problemas que estão ligados.
O primeiro é que não consigo executar o jar em minha maquina, mais em outras maquinas funciona normalmente, quando tento executar em minha maquina ele diz que não consegue encontrar a classe principal já pesquisei aqui no forum alguns topicos mais dos que eu encontrei nenhum deles me ajudou a resolver o problema.
O segundo problema está relacionado com a o relatório que não é executado quando executo o jar em outras maquinas, rodei o jar pela linha de comando e obtenho o seguinte erro:

C:\Users\Asus_CFSD\Desktop>java -jar FenixVendas.jar net.sf.jasperreports.engine.JRException: java.io.FileNotFoundException: .\src\re latorio\factura.jasper at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:84 ) at net.sf.jasperreports.engine.JasperFillManager.fillReport(JasperFillMa nager.java:243) at gui.VendaGui.chamaRelatorio(VendaGui.java:177) at gui.VendaGui.inserir(VendaGui.java:233) at gui.VendaGui.jButton1ActionPerformed(VendaGui.java:707) at gui.VendaGui.access$100(VendaGui.java:39) at gui.VendaGui$2.actionPerformed(VendaGui.java:378) at javax.swing.AbstractButton.fireActionPerformed(Unknown Source) at javax.swing.AbstractButton$Handler.actionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.fireActionPerformed(Unknown Source) at javax.swing.DefaultButtonModel.setPressed(Unknown Source) at javax.swing.plaf.basic.BasicButtonListener.mouseReleased(Unknown Sour ce) at java.awt.Component.processMouseEvent(Unknown Source) at javax.swing.JComponent.processMouseEvent(Unknown Source) at java.awt.Component.processEvent(Unknown Source) at java.awt.Container.processEvent(Unknown Source) at java.awt.Component.dispatchEventImpl(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.LightweightDispatcher.retargetMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.processMouseEvent(Unknown Source) at java.awt.LightweightDispatcher.dispatchEvent(Unknown Source) at java.awt.Container.dispatchEventImpl(Unknown Source) at java.awt.Window.dispatchEventImpl(Unknown Source) at java.awt.Component.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$000(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Sour ce) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Sour ce) at java.awt.EventQueue$4.run(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Sour ce) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) Caused by: java.io.FileNotFoundException: .\src\relatorio\factura.jasper ... 43 more

4 Respostas

J

Ele não está encontrando seu arquivo *.jasper

no começo da exceção já diz isso:

net.sf.jasperreports.engine.JRException: java.io.FileNotFoundException: .\src\re latorio\factura.jasper

ou não está nesse caminho ou está com outro nome.

Quanto a não rodar na sua máquina, é exatamente o mesmo jar que você executa e com a mesma versão do java que está nas outras máquinas?

Vanilson

Joaozava, o caminho do relatório está correcto, porque quando rodo a aplicação no netbeans o relatório é chamado normalmente.

Sim

G

Cola ae seu MANIFEST.MF

nele fica definido o main a ser rodado no jar.

vc esta rodando o jar como?

java -jar ?

Vanilson

gods, o manifest está assim:

Manifest-Version: 1.0 Ant-Version: Apache Ant 1.8.2 Created-By: 1.6.0_17-b04 (Sun Microsystems Inc.) Class-Path: lib/mysql-connector-java-5.1.13-bin.jar lib/commons-beanut ils-1.8.0.jar lib/commons-collections-2.1.1.jar lib/commons-digester- 1.7.jar lib/commons-javaflow-20060411.jar lib/commons-logging-1.0.4.j ar lib/groovy-all-1.7.5.jar lib/iText-2.1.7.jar lib/jasperreports-4.0 .0.jar lib/jasperreports-fonts-4.0.0.jar lib/jasperreports-javaflow-4 .0.0.jar lib/jfreechart-1.0.12.jar lib/poi-3.6.jar lib/spring-beans-2 .5.5.jar lib/spring-core-2.5.5.jar X-COMMENT: Main-Class will be added automatically by build Main-Class: gui.PrincipalAdministradorGui

E o jar eu estou a rodar do jeito que vc falou.

Criado 17 de fevereiro de 2012
Ultima resposta 17 de fev. de 2012
Respostas 4
Participantes 3