Click to See Complete Forum and Search --> : ireport problem java.io.FileNotFoundException when use in jar file


natanmdo
10-11-2006, 12:31 PM
Hi... i'm new in java
i had a problem for a long time and i could not solve it.
i work on a project i use netbeans 1.5, and I use iReport 1.2.0 as reporting tool.
the problem is when i try to call the report from a frame by clicking a button:
it works well when I run it in net beanns, but I've made jar file from the
whole project.when I try to run the jar file and
then calling the report it encounters following error:

java.io.FileNotFoundException: src\report\results\JRDuk.Dosen2.jasper
> at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:75
at net.sf.jasperreports.engine.util.JRLoader.loadObject(JRLoader.java:64
>
at ac.id.utama.MenuUtam.jButton18ActionPerformed(MenuUtam.java:2147)
at ac.id.utama.MenuUtam.access$1600(MenuUtam.java:57)
at ac.id.utama.MenuUtam$17.actionPerformed(MenuUtam.java:293)
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.mouseRealeased(Unknown Source)
at.java.awt.EventDispatchThread.pumpEventsForHiesrarchy(Unknown Source)
at.java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at.java.awt.EventDispatchThread.pumpEvents(Unknown Source)
at.java.awt.EventDispatchThread.run(Unknown source)


how should i address the jasper file?! or where should i put the .jasper files? or maybe have another problems?
thanks in advance... I will appreciate any advice....

chazzy
10-11-2006, 07:25 PM
what if you use an absolute path, rather than a relative?

Waylander
10-11-2006, 08:19 PM
Baring some kind of path typo....

I had some similiar problems with layered applications and path contexts...
I was stuck down a wrong directory and needed to use relative movement to get back up a directory before moving down the right path, only the loader I was using didnt have any dynamic capabilities and could only move forward...

System.out.println(new File("").getCanonicalPath());

that should tell you where you are in the context of java at the point of execution...
if your using a non java api class to load then your going to have to look into it further and see what else the class has to offer.

If you can get away with out absoultes especially with jars you should but if you cant get anything to work you might just have to bite the bullet and hard code it, if you can.

Waylandzor.