Problem opening a zip file within a jar file

Hi,
I have a jar file in a tomcat web server. The jar file includes a zip file which I've been trying to open with the following sentences:
SpellDictionary dict = null;
File f = new File(getClass().getResource*("us_US.zip"*).getFile());
dict = new OpenOfficeSpellDictionary( new ZipFile( f ) );
I'm getting this exception:
2007-09-13 15:31:38 java.util.zip.ZipException: No such file or directory
at java.util.zip.ZipFile.open(Native Method)
at java.util.zip.ZipFile.<init>(ZipFile.java:203)
at java.util.zip.ZipFile.<init>(ZipFile.java:84)
at com.iir.newsAdministration.textEditor.TextEditorSpellChecker.<init>(TextEditorSpellChecker.java:62)
If I run the application with the builded classes instead of the jar file, it works fine.
Any ideas about how can I make it work with the jar file?
Thanks in advance
Natalie

File f = new File(getClass().getResource*("us_US.zip"*).getFile());
This is not going to work.
What you need to do is create a Jar/ZipFile from your jar, then extract the ZipFile, put that in a temporary location, then open that with another ZipFile object

Similar Messages

  • Problems opening documents (zip files, excel) after upgrade to Snow Leopard

    Since upgrading to Snow Leopard I have not been able to open a lot of files. Mainly, zip files and excel documents (which I had no problem opening before the upgrade. It seems that when I save the files down (from my email or whatever) the files go into the "Archive Utility" program, I try to open them from the Finder but they still won't open (or unzip).
    When I go to open an excel document (most likely from a PC user), I get a msg that the file isn't formated for excel. However, before the upgrade to Snow Leopard I had no issue opening this same file in Mac Office-Excel.
    Thanks in advance for your help/advise.
    -Katherine

    Hello Katherine:
    I have not experienced those problems, but I do not receive Excel spreadsheets via E-mail. My Stuffit Expander version is 13.0.2.
    You might want to check your Excel preferences to see if there is a setting that needs to be changed (compatibility?). I use Office 2004 so your version may be different.
    You could also trash preference files to see if something happened during the install.
    Barry

  • Problems opening ePub.zip files in iBooks?

    I write book reviews and recently the publisher I work for has stopped sending press copies and only sends eBook copies in the form of ePub.zip files. They claim the files will work on Nook e-readers and "most other available e-readers". The problem is that I can't get these to open in iBooks. When I tap on the ePub attachment in my email I'm given the option to "Open in iBooks" as well as Dropbox, Evernote and a few others. When I choose iBooks I can see the cover art for the book in iBooks (marked NEW) but it refuses to actually open.. when I tap on the icon it darkens but does nothing else. What am I doing wrong? How can I fix this?  Dropbox and evernote both say the file cannot be displayed... do I need to do some sort of conversion to the file to open it?? HELP I only have 30 days to read and review each book and I've got TWO of them on deck!!

    If it's zipped (e.g. compressed) it would have to be unzipped first. Don't know if there is an unzipping utility available for iOS. Search the App Store. If there is not, you'd need to unzip them on a computer, then transfer them to your iPad.

  • Unable to open a .zip file (Winzip) from the KM Repository

    Hi.... while i am trying to open a .zip file (i.e., Winzip file) placed in the KM Repository.. I am getting an error -
    "Cannot open file : it does not appear to be a valid archieve."
    Is it someting related to the Winzip version ?
    Can somebody plz tell whr the problem could be..
    Thanks in advance!!
    Regards
    Smita

    Change the "Never compressed" value in Visual Admin. Check this thread for details:
    https://www.sdn.sap.com/irj/scn/thread?threadID=1096110&messageID=6409577#6409577

  • Opening a .zip file from Enterprise portal

    Hi all
    I am facing a problem while opening a .zip file from Enterprise portal. It gives the error- "Cannot open file- It doesnt appear to be a valid archieve" for every file.
    Is there any setting to be done in SAP Netweaver or is it the system limitation.
    Please help...
    Regards
    viraj

    hi pankaj
      I have uploaded a  .zip file in Enterprise Portal folder. When i click on the file, it opens with Winzip application. But then it gives the above mentioned error. I have tried another way also- I downloaded the file on computer drive and then tried to open it but same error .
    I hope it will make the picture clear.
    regards
    viraj

  • Can't open the Zipped file

    Hi
    I am making a zip file using GZIPOutputStream. But I am not able to open the zip file that is created using win zip.The size of the zipped file is 81 KB and the input file is 3,245 KB.I have closed all the streams still I am not able to figure out the problem.Any idea where I am going wrong ? Any help would be greatly appreciated.
    Here my code goes:
    import java.util.zip.*;
    import java.io.*;
    public class ZipFile
         public static void main(String[] args) throws FileNotFoundException,IOException
              ZipFile("D:\\Java\\Test\\INPUTXML_bkp_1.xml");
         public static String ZipFile(String fileName) throws FileNotFoundException,IOException
              String name = fileName.substring(fileName.lastIndexOf('\\') +1 ,fileName.lastIndexOf('.'));
              String filePath = fileName.substring(0,fileName.indexOf(name));
              String newFileName = new StringBuffer(name).append(".zip").toString();
              FileOutputStream outputStream = new FileOutputStream(newFileName);
              GZIPOutputStream zipOutputStream = new GZIPOutputStream(outputStream);
              FileInputStream inputStream = new FileInputStream(fileName);
              byte[] temp = new byte[10000000];
              int counter = inputStream.read(temp,0,temp.length);
              zipOutputStream.write(temp,0,counter);
              inputStream.close();
              zipOutputStream.finish();
              zipOutputStream.close();
              return newFileName;
    Thanks
    Ritesh

    Thanks for the reply.
    I changed my code to look like this:
    import java.util.zip.*;
    import java.io.*;
    public class ZipFile
         public static void main(String[] args) throws FileNotFoundException,IOException
              ZipFile("D:\\Java\\Test\\INPUTXML_bkp_1.xml");
         public static String ZipFile(String fileName) throws FileNotFoundException,IOException
              String name = fileName.substring(fileName.lastIndexOf('\\') +1 ,fileName.lastIndexOf('.'));
              String filePath = fileName.substring(0,fileName.indexOf(name));
              String newFileName = new StringBuffer(name).append(".zip").toString();
              FileOutputStream outputStream = new FileOutputStream(newFileName);
              ZipOutputStream zipOutputStream = new ZipOutputStream(outputStream);
              ZipEntry zipEntry = new ZipEntry(fileName);
              zipOutputStream.putNextEntry(zipEntry);
              zipOutputStream.finish();
              zipOutputStream.close();
              return newFileName;
    Now I can atleast open the zip file. But the problem is the size of the file is 0 kb. Probably because, I am not populating the Zip entry. Can u pls let me know how do I do that.
    Thanks
    Ritesh

  • Problems downloading DP4 zip file

    Im having problems downloading the DP4 zip file. When the download ends, i cant open the zip file.
    Any help?
    Txs

    Marco,
    I have not had any similar complaints and have spoken to many customers successfully using DP4. It may have been an issue on our side. Please let me know if it persists.
    Doug

  • Is there a way to open a zip file received via email on the iPad? I tried and a message popped up saying mail cannot open the attachment.

    Is there a way to open a zip file received via email on the iPad? I tried and a message popped up saying mail cannot open the attachment.

    You need a third party app. Take a look at some of these on this Google page.
    Open zip files on iPad

  • How to open a zip-file in Bridge for PC?

    How to open a zip-file in Bridge for PC?

    I think it's built in, just double click on it and it should open with Archive Utility. I dunno, maybe Unrar X might work for you>
    JB

  • Error when opening a zipped file transfred to the FTP via ABAP program

    Hi All,
    I have extracted the files from al11 and have zipped them and moved the zipped file to FTP site.
    But when I open the zipped file in FTP site, it shows the file names, but they dont look like real files(looks as text)...Even when copied the zipped file to the local pc and tried opening it the result was same.
    Note : For testing when the same zipped file is written to al11 and dowloaded from there using CG3y it works fine.
    Also created a zipped folder manualy and copied it to the FTP site and tried opening it.....It opened but displayed there are no records in it (which is incorrect), But when copied the same file back to local PC it displayed correctly.
    Please let me know hoe to resolve this issue. 
    Regards
    Jithu

    Hi Andreas Mann ,
    Thanks for your reply.
    I dont have access to choose tools in Tcode SXDB.
    Error msg: "You are not authorized to use Transaction SXDA_TOOLS"
    So can you pls Elaborate on this would be helpful in resolving the issue.
    Regards
    Jithu

  • Acrobat 9 tries to open all .zip files

    Acrobat 9 tries to open all zip files I attempt to download - not just zipped PDF's. Under folder management, the zip file type is not associated with Acrobat and is not showing with a PDF icon. The zip file will not open in any unzipping program, it just goes to Acrobat.
    When I download any zip file I get a message like this:
    Acrobat could not open "somefilename.zip" because it is either not a supported file type or because the file has been damaged.
    This happens with every zip file - how do I disassociate Acrobat from all zip file types?

    You need to change the file type association in Windows Explorer of the Folders Control Panel.
    The easiest way would to use Windows Explorer to find a file with the ".ZIP" file extension and then use the right mouse click to bring up the context menu. You can then select the "Open With..." option, make sure you check the option to set the 'always associate' (it is the only option) and then find WinZip, PKZip, RAR, or what ever program you use to open the "ZIP" type file.

  • I'm having problems opening my pdf files. I'm running windows XP and have adobe reader XI (11.0.06)

    I'm having problems opening my pdf files. I'm running wiondows Xp and have adobe reader XI(11.0.06) installed.

    What kind of problems? What happens when you try? Any error messages?

  • Safari opening linked .zip files directly from DVD instead of downloading

    Dear all,
    Safari opening linked .zip files directly from DVD (via Windows explorer) instead of downloading it tru browser click - it's working just fine in FF, Chrome IE. Is this a known issue? or something can be done by modifying browser setting/pref.
    Expecting more advise on this.
    Configurations: Windows XP
    Safari: 5.1.7
    Note: ensured there is no space in the file path, just linked the .zip file using href attribute!
    Also tried with .xls, .doc insted of .zip same issue appearing.
    Thanks in advance,
    Thirilog

    Hi
    appzapper & such are pretty flaky at removing things usefully, imo.
    Use the uninstaller for speed download - http://www.yazsoft.com/products/speed-download/faqs/?how-to-un-install-speed-dow nload-properly
    or get a hold of FindAnyFile or easyfind & search for Growl & Speeddownload & yazsoft - but from all I hear, the uninstaller works fine.
    Failing that, Safari's settings plist file isn't in caches
    Home/Library/Preferences/com.apple.safari.plist
    is the place
    & if you're still stuck, test & maybe download another browser using a New User Account.

  • Having problems opening a pdf file with reader 10/11 get error msg cannot open close reader and try again any ideas

    having problems opening a pdf file with reader 10/11 get error msg cannot open close reader and try again any ideas

    Hi George ,
    Is it happening with all the PDF' or any specific one?
    Could you please share the error message so that we can replicate at our end ?
    Try repairing reader  once and see if that fixes the issue.
    Launch Reader>Navigate to Help>Repair Adobe Reader Installation
    Regards
    Sukrit Dhingra

  • Lightroom 1.4 - problem opening up NEF files

    Hi there,
    I've been having problems opening up NEF files in Lightroom 1.4, a message keeps coming up saying that the file is not recognised. I'm using a MacBook Pro and can't get a solution - can someone please advise on the best course of action?
    Thanks!

    >a Nikon D3
    I don't think that one is supported in LR 1.4. The camera was released after LR 1.4 was released. To get support for that camera, either upgrade to LR 2 or convert the NEF files to dng using the free DNG converter that you can download from http://www.adobe.com/products/dng/

Maybe you are looking for

  • I have 1 music library, but 2 iphones; how do i remove songs from 1 and leave them on another?

    i have 2 iphones and 1 music library on my laptop.  i just install ios7 today on one phone and now i'm seeing my entire music library on that when I really just want the playlists.  i unchecked all of the music in the library but it still syncs and s

  • Will not display page that is used often...

    Hi. I use rapidshare.com and my home page is blingo.com. Yesterday all was well. I was downloading files, and searching with my home page. Today when I power on the computer my homepage does not load anymore. Neither will rapidshare.com. I have anoth

  • Error installing dreamweaver in d disk

    When I try to install spanish dreamweaver in d disk, the system says that the cabinet file is damaged, the problem doesn´t occurs en c disk, I need change the drive but with this problem I cant do it

  • Pacman 3 can't download pkg

    Hi, I just downloaded Arch Duke the LinuxTag edition. Did a clean install and so far so good. The problem is I can't install anything using the new pacman 3. I did a pacman -Sy I used the Xfer command to use wget to download the packages. Pacman actu

  • .MTS, .m2t files and ClipWrap?

    Once again I am totally confused! I thought that ClipWrap was an app to convert AVCHD video files to AIC, ProRes etc. However, I cannot get it to work. It asks for .m2t files but the AVCHD files I am experimenting with are .MTS and are completely gre