Help:Can not find the file in jar!
Hello everyone:
I build a project using Netbeans 5.0 and make a jar file with it...
The code in the project as follows will throw an exception described that it can not find the file named datasource-config.xml
String dataFilePath = getClass().getResource(dataFile).getPath();
//System.out.println("filepath:"+dataFilePath);
InputStream input = new FileInputStream(dataFilePath);
when I run the project with the main() function as an entry it works perfectly and output:
filepath:/C:/projects/java_project/search/build/classes/com/cn/wxjt/lucene/config/datasource-config.xml
But when I compressed the project with jar and run it , it will show:
filepath:file:/C:/projects/java_project/search/dist/search.jar!/com/cn/wxjt/lucene/config/datasource-config.xml
there is a (!) between search.jar and /com/cn/wxjt...
I dont know why I generate a ! symbol in the file path... Is it cause the exception->
java.io.FileNotFoundException: file:\C:\projects\java_project\search\dist\search.jar!\com\cn\wxjt\lucene\config\datasource-config.xml
If you have any idea, plz tell me.
Thank you and best wishes to you !
:)
If the file you want to read is in your jar file, use
getClass ().getResourceAsStream
(relative_path_file_name)Hope that help,
Jackhey jack i want to open the file as new File
i m using this.getClass().getResource("resource/backend.xml");
the resource is the directory inside the jar file.
when i prints the url it shows:
the jar file is in the WORK directory
URL : jar:file:/home/neeraj/WORK/show.jar!/resource/backend.xml
now when i creates new File using the url.getFile() method the file does not exist.
although the same programs runs well when i uses the InputStream
so plz tell me cant I create a new File from the above method????
thanks in advance
with regards
neeraj
Similar Messages
-
when I enter a word in the search window (the one with the curved arrow at the end), I get this message:
Firefox can't find the file at jar:file:///C:/Program Files (x86)/Mozilla Firefox/omni.jar!/chrome/en-US/locale/browser-region/region.propertiesproblems.Try the Firefox SafeMode to see how it works there. <br />
''A troubleshooting mode, which disables most Add-ons.'' <br />
''(If you're not using it, switch to the Default Theme.)''
* You can open the Firefox 4/5/6/7 SafeMode by holding the '''Shft''' key when you use the Firefox desktop or Start menu shortcut.
* Or use the Help menu item, click on '''Restart with Add-ons Disabled...''' while Firefox is running. <br />
''Don't select anything right now, just use "Continue in SafeMode."''
''To exit the Firefox Safe Mode, just close Firefox and wait a few seconds before using the Firefox shortcut (without the Shft key) to open it again.''
If it is good in the Firefox SafeMode, your problem is probably caused by an extension, and you need to figure out which one. <br />
http://support.mozilla.com/en-US/kb/troubleshooting+extensions+and+themes -
I get the following message when trying to open an .avi downloaded from my video cam, need help, can not find the codec, thank you. This is for Quicktime Player.
"The document “IMAG0026.AVI” could not be opened. A required codec isn't available."Try Perian.
http://perian.org/ -
I have transferred a load of files from my PC to my iMac using the migration assistant. The message on both machines say that the process was successful but I can not find the files on the mac. Any ideas?
When you use Migration Assitant it creates another user account and puts your files there. Please log out of your normal account and log into the new account. Had you use Setup Assistant when it asked if you were migrating that would not have occured. You have a couple of options, combine the two accounts (not recommended) or start over, use Setup Assistant and have everything in one user account. Here is a link to Pondin's guide for Lion Setup Assistant tips however if you want to combine the two accounts he has addressed that in
http://pondini.org/OSX/Transfer.html -
my itunes are on windows 97. just got windows 7 laptop. when i load new software on my new laptop it shows all my windows 97 music/audiobooks but can not find the files. how do I link them
iDevices are not and have never been backup devices.
Authorizing a computer does not cause media to magically appear.
Media is only where the user puts it.
Copy the ENTIRE iTunes folder from the old computer to the new computer. -
Question
firefox 4, when I make a browser search I get a second page:"Firefox can't find the file at jar:file:///D:/Program Files/Mozilla Firefox/omni.jar!/chrome/browser/content/browser/<url></url>", how can I solve the problem.Start Firefox in [[Safe Mode]] to check if one of the add-ons is causing the problem (switch to the DEFAULT theme: Tools > Add-ons > Appearance/Themes).
* Don't make any changes on the Safe mode start window.
See:
* [[Troubleshooting extensions and themes]] -
This is what it says on my screen when I open Firefox:
Firefox can't find the file at jar:file:///C:/Program Files (x86)/Mozilla Firefox/omni.jar!/browserconfig.properties.Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
*Don't make any changes on the Safe mode start window.
*https://support.mozilla.org/kb/Safe+Mode
*https://support.mozilla.org/kb/Troubleshooting+extensions+and+themes -
When I try and re-download some of them from the ITUNES store...I get an error that the file already exists on the computer. However, when I open Itunes. The file can not be found. This problem just started about 1 1/2 ago...prior to that did not have any problems...Help? direction?
You can move the folder to where iTunes expects to find it and that will work.
Or you can attempt to fix one broken track by looking for it when prompted when you use Get Info or attempt to play. This often works if everything is in the standard layout.
Or you can repair things with my FindTracks script.
tt2 -
I get this message
Such behavior can be an indication that you are infected.<br />
In such a case you can use another computer to download the program and save the file to an USB stick.<br />
Be sure to download the latest databases.
You can try an online anti-virus scanner.
* http://www.google.com/search?q=Online%20Antivirus%20Scanner
* http://housecall.trendmicro.com/ HouseCall - Free Online Virus Scan - Trend Micro USA
* http://vms.drweb.com/online/?lng=en Dr.Web - innovation IT-security solutions. Complex protection against Internet threats.
* http://www.eset.com/onlinescan/ - Free ESET Online Antivirus Scanner -
Since moving to a new computer (iMac G5 10.6.8), and transferring data over, Firefox did not work - I have repeatedly uninstalled and reinstalled - now Version 8 (is that the wrong version for my operating system perhaps). I was successful a week ago, but when I went to open it up yesterday, I got the above message, so again threw it out in the trash (which admittedly is probably different than truly uninstalling) and reinstalled Firefox (free download on internet). Again, I get this message. Any ideas? Thank you for your time, attention and help.
Try:
*http://kb.mozillazine.org/Resetting_preferences
*https://support.mozilla.com/kb/Resetting+preferences
Start Firefox in <u>[[Safe Mode]]</u> to check if one of the extensions or if hardware acceleration is causing the problem (switch to the DEFAULT theme: Firefox (Tools) > Add-ons > Appearance/Themes).
*Don't make any changes on the Safe mode start window.
*https://support.mozilla.com/kb/Safe+Mode -
When this occurs the browser tends to hang for a few seconds and no other tabs can be selected. I have tried uninstalling firefox and reinstalling. I have the latest version of firefox (3.6.3)
== URL of affected sites ==
http:// - all sitesIn FF4, Lovefx4 has posted another solution here: [https://support.mozilla.com/en-US/questions/801219 https://support.mozilla.com/en-US/questions/801219].
# In the address bar, type "about:config", without the quotes
# Press the enter key
# In the filter window, type "Keyword.url", without the quotes
# Double click on the "Value" field, and type in "http://www.google.com/search?q=", without the quotes
Done! -
HELP!
I found a possible solution...sort of. When I googled this problem most solutions said that it's the Ask.com toolbar that got snuck on people's systems from other installations that is causing the problem. They were told to uninstall it and to delete Asksearch.js in the components folder in their firefox directory. For those people that solved the problem. I didn't have Asksearch.js and I've installed Ask.com a long time ago.
So after disabling all my extensions and then enabling them one by one I discovered that the Leechblock extension was the one causing the problem for me. Hope this helps someone. -
Report is stored in eclipse project directory, when function sets window.location.href='report.html' getting above error. this is for a project very near deadline! any help would be great ,cheers
btw , program been ran is a firefox add-on
-
I believe I set it up to search from the address bar - so I just typed in a search term 'delta'
Type "about:config" in the address bar.
Scroll down to "keyword.URL"
Right-click and choose "Reset" -
Why? Firefox can't find the file at ....
== Issue
==
Firefox is crashing or closing unexpectedly
== Description
==
Why do I get this message all day long? I never did before. Firefox can't find the file at jar:file:///C:/Program Files/Mozilla Firefox/chrome/en-US.jar!/locale/browser-region/region.propertiessz0069.ev.mail.comcast.net.
== Firefox version
==
3.6.3
== Operating system
==
Windows XP
== User Agent
==
Mozilla/5.0 (Windows; U; Windows NT 5.1; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3 (.NET CLR 3.5.30729)
== Plugins installed
==
*-np-mswmp
*Adobe Shockwave for Director Netscape plug-in, version 10.3
*The QuickTime Plugin allows you to view a wide variety of multimedia content in Web pages. For more information, visit the QuickTime Web site.
*6.0.12.732
*RealPlayer(tm) LiveConnect-Enabled Plug-In
*RealJukebox Netscape Plugin
*Adobe PDF Plug-In For Firefox and Netscape 8.2.2
*Default Plug-in
*Shockwave Flash 10.0 r45
*iTunes Detector Plug-in
*Windows Presentation Foundation (WPF) plug-in for Mozilla browsers
*RealPlayer(tm) HTML5VideoShim Plug-In
*Rhapsody Player Engine Plugin
*Java Plug-in 1.5.0_02 for Netscape Navigator (DLL Helper)The jar: issue can be caused by the Ask.com toolbar or the "ZoneAlarm Spy Blocker Toolbar" or the [http://foxit.ourtoolbar.com/ Fox-it toolbar] (Tools > Add-ons > Extensions).
See http://forums.mozillazine.org/viewtopic.php?f=38&t=934345
Maybe you are looking for
-
Full Page Background in Internet Explorer 8 and Below
I am currently trying to achieve a full page background image using the method found here: http://cookbooks.adobe.com/post_Scale_Background_image_to_browser_size-17590.html Everything works fine in FF, Chrome, and Safari, but when I preview the page
-
Gross invoice amount and net invoice amount
Hi Experts, Can anybody tell me which is the gross invoice amount and net invoice amount field. From which table can I get them? I need to fetch Gross invoice amount and net invoice amount for both PObased invoice and non-PO based invoice against a c
-
Trouble upgrading to 10.6.1
Hi all, I'm having trouble upgrading to iTunes 10.6.1. Earlier today, I opened iTunes, and received an error message that "iTunes Library.itl cannot be read because it was created by a newer version of iTunes." Still not sure why this happened. I f
-
just updated mpd and i keep getting a connection refused message when trying to start ncmpcpp. anyone else see this?
-
It will not let me re-install.
My MG6220 printer keeps giving me an error that my Printer is currently in use. It is not I have unistalled it and will not let me re-install the software.