/    Sign up×
Community /Pin to ProfileBookmark

ireport problem java.io.FileNotFoundException when use in jar file

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: srcreportresultsJRDuk.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….

to post a comment
Java

2 Comments(s)

Copy linkTweet thisAlerts:
@chazzyOct 12.2006 — what if you use an absolute path, rather than a relative?
Copy linkTweet thisAlerts:
@WaylanderOct 12.2006 — 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...

[CODE]System.out.println(new File("").getCanonicalPath());[/CODE]

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.
×

Success!

Help @natanmdo spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.17,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...