A .txt in jar,and dont kown the jar's absolute path,how to read it

I have help.txt and HelpReader class in a jar,and dont kown the jar's absolute path,how to let
HelpReader class can find help.txt and read it??
thanks

Make sure the jar is in your program's classpath. Then use something likeInputStream help = this.getClass().getResourceAsStream("/help.txt");to read the file. Exactly what you would use depends on where in the jar file the help.txt file is located.

Similar Messages

  • How can i sync my old ipod without knowing my old password and dont have the same email without loosing everything??

    How can I sync my old Ipod without loosing everything? I dont remember my old password and dont have the same email. I have many pics stored on there of many trips we took over the years and songs as well please help...

    What are you wanting to do exactly?  Are you trying to sync this older iPod with a new/different iTunes library from the one you originally set it up with?
    B-rock

  • What can I do? I've forgotten my password and dont remember the answers to my sercurity questions, and no longer have access to the email account i used for backup. How do I get my icloud password reset?

    What can I do? I've forgotten my password and dont remember the answers to my sercurity questions, and no longer have access to the email account i used for backup. How do I get my icloud password reset? Please help. Thanks in advance.

    Please see Kappy's User Tip here:
    https://discussions.apple.com/docs/DOC-4551

  • I was given my ipad mini as a gift and i cant restore it  dont know the previous owners information? how do i fix it

    i was given my ipad mini as a gift and i cant restore it  dont know the previous owners information? how do i fix it? i have tried everything on this wesite , forumas and in i tunes. i have restored it wiped it an di cant get thru set up because of the previous persons email linked to it.

    If the iPad was running iOS 7,  iCloud: Find My iPhone Activation Lock in iOS 7
    http://support.apple.com/kb/HT5818
    How can I unlock my iPad if I forgot the passcode?
    http://www.everymac.com/systems/apple/ipad/ipad-troubleshooting-repair-faq/ipad- how-to-unlock-open-forgot-code-passcode-password-login.html
    iOS: Device disabled after entering wrong passcode
    http://support.apple.com/kb/ht1212
    How can I unlock my iPad if I forgot the passcode?
    http://tinyurl.com/7ndy8tb
    How to Reset a Forgotten Password for an iOS Device
    http://www.wikihow.com/Reset-a-Forgotten-Password-for-an-iOS-Device
    Using iPhone/iPad Recovery Mode
    http://ipod.about.com/od/iphonetroubleshooting/a/Iphone-Recovery-Mode.htm
    Saw this solution on another post about an iPad in a school environment. Might work on your iPad so you won't lose everything.
    ~~~~~~~~~~~~~
    ‘iPad is disabled’ fix without resetting using iTunes
    Today I met my match with an iPad that had a passcode entered too many times, resulting in it displaying the message ‘iPad is disabled – Connect to iTunes’. This was a student iPad and since they use Notability for most of their work there was a chance that her files were not all backed up to the cloud. I really wanted to just re-activate the iPad instead of totally resetting it back to our default image.
    I reached out to my PLN on Twitter and had some help from a few people through retweets and a couple of clarification tweets. I love that so many are willing to help out so quickly. Through this I also learned that I look like Lt. Riker from Star Trek (thanks @FillineMachine).
    Through some trial and error (and a little sheer luck), I was able to reactivate the iPad without loosing any data. Note, this will only work on the computer it last synced with. Here’s how:
    1. Configurator is useless in reactivating a locked iPad. You will only be able to completely reformat the iPad using Configurator. If that’s ok with you, go for it – otherwise don’t waste your time trying to figure it out.
    2. Open iTunes with the iPad disconnected.
    3. Connect the iPad to the computer and wait for it to show up in the devices section in iTunes.
    4. Click on the iPad name when it appears and you will be given the option to restore a backup or setup as a new iPad (since it is locked).
    5. Click ‘Setup as new iPad’ and then click restore.
    6. The iPad will start backing up before it does the full restore and sync. CANCEL THE BACKUP IMMEDIATELY. You do this by clicking the small x in the status window in iTunes.
    7. When the backup cancels, it immediately starts syncing – cancel this as well using the same small x in the iTunes status window.
    8. The first stage in the restore process unlocks the iPad, you are basically just cancelling out the restore process as soon as it reactivates the iPad.
    If done correctly, you will experience no data loss and the result will be a reactivated iPad. I have now tried this with about 5 iPads that were locked identically by students and each time it worked like a charm.
    ~~~~~~~~~~~~~
    Try it and good luck. You have nothing more to lose if it doesn't work for you.
     Cheers, Tom

  • I got a new ipad and went buy music on iTunes and in is telling me that this is a new device on this account and wants me to answer some security questions I dont remember setting thes up and dont know the answers how do i reset the security questions

    i got a new ipad and went buy music on iTunes and in is telling me that this is a new device on this account and wants me to answer some security questions I dont remember setting thes up and dont know the answers how do i reset the security questions

    Click here and search the article for '2 out of 3' without the quotes; this generally involves either a message being sent to your rescue email address or contacting the iTunes Store staff directly.
    (74313)

  • Im locked out of my phone and dont know the passcode. what do i do?

    im lockeed out of my phone and dont know the passcode. What should i do to use my phone?

    Do as the manual instructs and restore it.
    http://manuals.info.apple.com/en_US/iphone_user_guide.pdf

  • I reset my iphone 4 and dont remember the apple id and passward please tell me the solution..

    i reset my iphone 4 and dont remember the previous apple id and passward please allow me to turn on the iphone with my new id..

    If your phone is second hand, you have encountered Activation Lock which prevents thieves from using stolen phones.  You must have the original owner's Apple Id and password in order to use the phone.  Or the original owner must remove the device from his account.  Otherwise the device is useless for you.

  • I bought an apple iphone4 from a friend and they had lost and dont remember the apple id nor password can some tell me how to reset the phone and or both

    I bought an apple iphone4 from a friend and they had lost and dont remember the apple id nor password can some tell me how to reset the phone and or both

    It is not possible. You have hit Activation Lock, an anti theft measure. The last owner is the only one who can unlock it with their Apple ID. Tell them to go here
    https://iforgot.apple.com/
    Cheers
    Pete

  • HT5621 i tryed to reset my phone and dont rember the password to old i cloud account and no longer have the email what do i do

    i tryed to reset my phone and dont rember the password to old i cloud account and no longer have the email what do i do

    What do you mean you no longer have that Email you can still try old Email that was used to set up IPhone
    Go to Apple ID and click forgot password.
    Bsydd Uk

  • I lost my ipodtouch and dont have the findmyipod app what do i do????

    i lost my ipod touch and dont have the findmyipod app what doi do?????

    Sorry nothing can be done. Report to the police, maybe someone found it and left it there.
    Chances of getting it back is zero. Change your passwords to iTunes Store and e-mail.
    http://support.apple.com/kb/HT2526

  • HT4061 I have lost my iphone and dont have the box, how can I get the IMEI number?

    I have lost my iphone and dont have the box. Can I get its IMEI number? From itunes, icloud or any other way? Please help!

    http://support.apple.com/kb/ht4061

  • My iphone is in icloud lock and dont know the pasword and id help me .

    my iphone is in icloud lock and dont know the pasword and id help me .

    There is no solution for Activation Lock if you don't know the Apple ID/Password that was used to originally activate the phone.
    Without that info, you won't be able to re-activate the phone or use it, & Apple can't/won't help you. You can try recovering the ID here:
    https://iforgot.apple.com/appleid

  • Browse files and dirs in the JAR-file

    Hi! I'm stuck with a problem concerning browsing a JAR file to find all images, fonts and sound clips. I think this is a pretty straight-forward task, except when I consider that the file I want to browse, is the same file the browser is stored in and running from. I have searched for hours on the internet now, and I still haven't figured out a way to be able to browse my JAR file.
    Here is the code I use when I'm not running my project in a JAR-file:
         * Load and cache all files (*.ttf, *.png and *.wav) from the resource-directory
        public void loadResources() throws FileNotFoundException {
            // log available VRAM
            log.println("Available VRAM before loading resources: " + graphicsDevice.getAvailableAcceleratedMemory() + " bytes", Log.INIT);
            // determine whether or not we are dealing with the contents of a jar-file
            jar = getClass().getResource("").getProtocol().startsWith("jar");
            // browse all directories
            long start, end;
            int loadTime = -1;
            start = System.nanoTime();
            browseDirectory(".." + separator + "resources");
            end = System.nanoTime();
            loadTime = Math.abs((int)(end - start) / 1000000);
            resourcesLoaded = true;
            // log
            log.println("Resources loaded in " + loadTime + " ms", Log.INIT);
            // log available VRAM
            log.println("Available VRAM after loading resources: " + graphicsDevice.getAvailableAcceleratedMemory() + " bytes", Log.INIT);
         * Browse a directory and load and cache all it's files
         * @param path The directory to browse
        private void browseDirectory(String path) {
            // log
            log.println("Browsing directory: " + path.replaceFirst("\\W*", ""), Log.INIT);
            try {
                if (jar) {
                    // TODO: enable JAR-browsing by getting the input stream from the JAR-file, then browse through all entries
                    throw new RuntimeException("Cannot browse JAR-files yet!");
                else {
                    File dir = new File(getClass().getResource(path).toURI());
                    // browse through the directory
                    String[] files = dir.list();
                    File file;
                    for (String name: files) {
                        file = new File(dir.getAbsolutePath() + separator + name);
                        // if this is a new sub-directory, browse it
                        if (file.isDirectory()) browseDirectory(path + separator + file.getName());
                        // otherwise, add the file
                        else addFile(path, name);
            catch (Exception e) { e.printStackTrace(); }
        } But, as you may see, I need a similar code to browse the JAR-file....please help me!
    lhk

    I worked it out by trying and failing:
          * Browse the JAR-file and load all it's relevant files
         private void browseJar() {
              try {
                   // convert the resource directory path to a JAR-compatible path
                   String jarDir = dir.replaceAll("\\" + separator, String.valueOf(jarSeparator));
                   // get the jar-file and it's entries
                   Enumeration<JarEntry> entries = new JarFile(new File(getClass().getProtectionDomain().getCodeSource().getLocation().toURI())).entries();
                   // browse the contents of the file
                   JarEntry entry;
                   int nameIndex;
                   String name = null;
                   String path = null;
                   while (entries.hasMoreElements()) {
                        // get the entry
                        entry = entries.nextElement();
                        // we only process relevant entries
                        if (entry.getName().startsWith(jarDir)) {
                             nameIndex = entry.getName().lastIndexOf(jarSeparator);
                             name = entry.getName().substring(nameIndex + 1);
                             // if we find a new directory, we get it's path
                             if (entry.isDirectory()) {
                                  path = entry.getName().substring(jarDir.length(), nameIndex);
                                  if (path.startsWith(String.valueOf(jarSeparator))) path = path.substring(1) + jarSeparator;
                                  // log (the system-compatible path)
                                  log.println("Browsing directory: " + dir + separator + path.replaceAll(String.valueOf(jarSeparator), "\\" + separator), Log.INIT);
                             // otherwise, we add the resource
                             else addFile(path, name);
              catch (Exception e) { e.printStackTrace(); }
         }As may be seen in the code, I discovered that the regular file separator could not be used in jar paths, which I found strange. I tried a lot to make the regular separator work, but couldn't manage it. Anyway, this code works for me.

  • Somebody stole my ipod touch 4G and i dont have the apps "found my ipod" how can i know where is my ipod? :(

    Somebody stole my ipod touch 4G and i dont have the apps "found my ipod" how can i know where is my ipod? :( please help!

    You do not need any app.
    - If you previously turned on FIndMyiPod on the iPod in Settings>iCloud and wifi is on and connected go to iCloud: Find My iPhone, sign in and go to FIndMyiPhone. If the iPod has been restored it will never show up.
    - You can also wipe/erase the iPod and have to iPod play a sound via iCloud.
    - Change the passwords for all accounts used on the iPod and report to police
    - There is no way to prevent someone from restoring the iPod (it erases it) using it.
    - Apple will do nothing
    Reporting a lost or stolen Apple product
    - iOS: How to find the serial number, IMEI, MEID, CDN, and ICCID number

  • Not getting com.ibm.mq.jar and com.ibm.mqjms.jar files

    Hi Sudhir,
    Thank you very much for your guidance.
    But I am not getting com.ibm.mq.jar, and com.ibm.mqjms.jar files. what do I have to do to get this file?
    And do I require both these files in getting initial context for JNDI.
    Thanks in advance.
    Have a nice day

    Hay,
    theres also a zip file from IBM titled MA88 that contain the jar files needed for supporting JMS programs in a Java env (these files are included there) and they're also included in WBI v5.2 and higher.

Maybe you are looking for

  • MY IPHONE 4 MMS DOESN'T WORK! HELP!!!!

    Hey! This forum looks like the people in it know what they are talking about, so I thought I would give it a shot!  I have the iPhone 4 and for the past god knows how long, my MMS just won't send at all. Through 3g or WiFi! Every time I try to send a

  • Software update, and now I can't get Safari to open.

    I have a 15", late 2007 Macbook Pro. I'm running 10.6.8, and I believe the update was to Safari 5.1.1. Last month, the same thing happened. Luckily, I was staying near an Apple store. They had to reinstall the OS. I haven't tried that yet, because I

  • HT4623 IOS7.0.2 update slows the keypad with quite some delay very frustrating

    Iphone IOS 7.0.2 has damaged the keyboard with exeptionally slow responses. How can this be fixed?

  • The FAQ & help don't help. NEED help!

    I've got a csv file with 125 addresses. I'm trying to import them into my address book. I jump through all the hoops, fix the headings. Then, when I import 'em, they're all empty, all no name. Or else address book tries to plant them in existing adre

  • Numa Organ and Digital Performer

    I just got a Studiologic Numa Organ, and I am very pleased with it. My Sequencer is Digital Performer 8,1 on Snow Leopard My Audio to Midi Setup sees the Numa ONLY if I connect it directly through the USB port to The Mac Audio to Midi Setup will also