Mysterious File

Hello,
I'm writing a simple servlet which should read a file.
In the servlet constructor I call readFileBytes() method. The problem is that the file created with new File("corejava.zip") is shown to be empty while when created with new File("C:\\Tomcat 4.1\\corejava.zip") is of the length it is. When constructor is called Tomcat console prints
file.exists() = true
file.length() = 0
file.getAbsolutePath() = C:\Tomcat 4.1\corejava.zip
file.canRead() = true
file.canWrite() = true
myFile.exists() = true
myFile.length() = 1661964
myFile.getAbsolutePath() = C:\Tomcat 4.1\corejava.zip
myFile.canRead() = true
myFile.canWrite() = true
    public void readFileBytes() {
        try {
            fileByteArray = getBytesFromFile(new File("corejava.zip"));
        } catch (IOException e) {
            e.printStackTrace();  //todo catch
    public static byte[] getBytesFromFile(File file) throws IOException {
        System.out.println("file.exists() = " + file.exists());
        System.out.println("file.length() = " + file.length());
        System.out.println("file.getAbsolutePath() = " + file.getAbsolutePath());
        System.out.println("file.canRead() = "+file.canRead());
        System.out.println("file.canWrite() = "+file.canWrite());
        // create file with path constructor
        System.out.println("----------------------");
        File myFile = new File("C:\\Tomcat 4.1\\corejava.zip");
        System.out.println("myFile.exists() = " + myFile.exists());
        System.out.println("myFile.length() = " + myFile.length());
        System.out.println("myFile.getAbsolutePath() = " + myFile.getAbsolutePath());
        System.out.println("myFile.canRead() = "+myFile.canRead());
        System.out.println("myFile.canWrite() = "+myFile.canWrite());In my Tomcat server user.dir is default C:\Tomcat 4.1, corejava.zip is absolutely normal file.

Thanks for the link. I will have to use different technic to read my file, but anyway I don't understand what is the difference between the File objects in my code.
File workDirFile = new File(".");
        System.out.println("workDirFile.getAbsolutePath() = "+workDirFile.getAbsolutePath());prints workDirFile.getAbsolutePath() = C:\Tomcat 4.1\.
Seems to be OK.
The strangest thing is that both File objects exist and have the save path, but one has 0 length.

Similar Messages

  • Mysterious files being created in pages. Unable to unlock or delete them.

    Mysterious files being created in pages. Unable to unlock or delete.

    It turns out that you cannot update or delete a Syndication Map that is currently assigned to a Port in the Repository.  You must remove the map from the Port in the Repository and then you can change and/or delete them. 
    1) bring up the MDM Console
    2) Unload the repository
    3) drill into Admin ~ Port
    4) Remove or change the map associated to the port
    5) Load the repository
    6) Then you go into Syndicator and either Update the Map or Delete it
    It had nothing to do with security.
    Thank you for your help.

  • Mystery files with double extensions

    I have been coming across mystery files on my Mac. For example, if I have a file named "word file.doc" I might have a second file named "word file.doc.PkE" or something like that. The file is empty, so far as I can tell. The second extension is meaningless and seems to be random. I can delete the mystery file without harm.
    What is creating those files and how do I get it to stop?

    That may be an attempt to send you a virus as a Word document. Delete those files. Unless you know the source of the file which comes as an attachment, there is no reason for them to exist. If they are found in your Microsoft Office folder, ignore them as they may be temporary files that office creates for autosave purposes. The only .doc files you should worry about are ones you save to your desktop or home folder or folders you create yourself.

  • Mysterious File in Trash after emptied.

    After I empty my trash there is a mysterious file that appears. I try to move it and it disappears, I try to Copy and paste and it asks for my password then disappears. Two separate file names show up at different times. L2QQU6rVMLLrm6 and ntDu9OqOifdnlP .
    Also, after I add one item to trash and empty (secure or regular) it shows its emptying 6 items.
    hmmm. this is a new issue and Im freaked. am I being hacked?

    element619 wrote:
    Thanks, But I dont have bootcamp installed...no windows. I restarted and it doesnt seem to be happening at the moment. do you think someone could have been on my computer?
    no, I do not think that. do you have any external drives attached? those files might be from an external and you need to empy trash with that drive attached to get rid of them. also start disk utility and verify your hard drive. if it reports any damage, reboot from the leopard install DVD, start disk utility from the Utilities menu and repair the drive.

  • Mysterious file in trash containing null chars

    in my trash appears a mysterious file. ive made some screenshots of it:
    http://home.arcor.de/matthiascando/images/finderError1.png
    http://home.arcor.de/matthiascando/images/finderError2.png
    it resists any attempts to empty the trash. when i click on it, it disappers only to show up some seconds later again.
    i did a rm -rf ~/.Trash - no result. with ls -al ~/.Trash/ it doesnt appear in the terminal.
    i tried to create a new account but after a while (a day or so) the file is there again.
    has anybody an idea what to do or some experience?

    Do you happen to have "show hidden files" enabled? I once had the same problem- a file continually appeared on my desktop and right after deleting it, it would reappear. I then remembered that I had used Onyx to show me hidden files during the installation of some software, and I had never hid them again. That may be one of those hidden files.

  • Mystery File in Trash and Locked Disks

    Hi all,
    Have some weirdness going on with my system. First, I have a mystery file appearing in my trash that can not be identified. It appeared about the same time as I started having problems with three of my external drives that I can not access anymore.
    The file is named ␀␀␀÷␀␀.÷␀ . It says that it is an alias as type. If you try to get info, it disappears. It will not trash or secure trash. It can not be removed from the Trash folder.
    At the same time I have had three external drives start malfunctioning. The files first became unaccessible, could not be copies or delete. The drives would not allow new files to be added. The drive will not unmount and indicates that the drive is engage with an application. Then, the file completely vanish from view. The disk show zero items, but the disk size still indicates the files are still on the drive.
    I've use DiskWarrior and DriveGenius to try and repair one of the drives with no success. Even booting from the CD/DVD disk, the drives will not unmount.
    I hope this is not some kind of virus or trojan horse.
    Let me know if there is something I can do.
    Thanks

    Take a look at this topic: NUL file in Trash won't go away.
    You'll almost certainly find this file is in the Trash on a Windows volume, and you'll need to use Windows to get rid of it.

  • Mystery file in trash at startup

    Hi!
    I have this mysterious file in the trash every time I turned the iMac. It has been going on for a while now and I can't get rid of it. Even secure empty trash did not work. When I click on get info, instead of giving me information about the file like all other files do, this one blinks and then disappears and the trash gets emptied. This is the filename  ␀␀␀õ␀␀.␀␀ I hope you can read the filename. I even copied the file to pages and made it bigger but this is how it came out when pasting. Under the kind column it says alias. I cannot find this file anywhere in the computer. I have also ran disk utility. Does anyone know what kind of file this is and how to get it rid of it permanently. Thanks.

    You might try starting up from your Mac OS X installation disc; at the first Installer screen, go up to the menu bar. Under Utilities, select to run Disk Utility. In the sidebar, select the internal drive; select the drive, not the volume indented under the drive. Go to the +First Aid+ tab and run +Repair Disk+. If there is some minor data corruption causing this problem, +Repair Disk+ may fix it.
    If you decide to start using another user account, I would probably use the Shared folder (in the Users folder). Turn ON +fast user switching+ so that I can easily go back and forth between accounts. Then move the files and folders I wanted to move from the old account to the Shared folder. Then switch to the new account and move those files and folders to the equivalent locations in the new account home folder. Do this one user home folder sub-folder at a time.
    Note: Dragging files and folders to and from the Shared folder is a move, not a copy. That is, the files will appear at the new location and disappear from the previous location.
    If you use Time Machine, you can probably use Migration Assistant while logged in to the new account and migrate from the Time Machine archive. I've never done that myself, but migrating from Time Machine is one of the options.

  • Huge mystery file?

    I just noticed a huge file in my iTunes Library. It has a song title, but I know it isn't a song. It shows up as being 789:57:13 minutes? long. I have no idea what this is. Any ideas?

    Actually when I went looking for this file I found 10 tracks with the same 789:57:13 time. Command +R shows 11 tracks on some of these ranging from 20kb to 4.5mb. On some of the othersit shows 512 tracks. Most of the tracks are mpeg4 audio, but there are also mp3 audio, wave audio, and a few "documents". iTunes total shows 6170 items, 346 days, 22.75GB I have ripped a lot of CD's, but the total used to say about "7 days". iTunes seems to be performing normally. I'm mainly concerned that I'm using up a lot of wasted hard drive space with these large mystery files.

  • Mysterious file appearing after login

    Hi all,
    I recently bought my parents a 2nd hand iMac (Duo Core 2 1.83ghz). After setting up a user account and removing the preference files (which caused a few hiccups), I now have a file that appears when I open the hard drive.
    It has no name and is 1.4MB in size. Opening it in TextEdit shows lots and lots of characters (non-English or anything for that matter).
    Does anyone have an idea why this file would be appearing and how to fix it? I've never seen anything like this before. Sometimes the trash has a "Recovered Files" folder when I have done nothing.
    I've run permissions repairs and verified the disk (which said it didn't need repairing) but I will look at it tomorrow to see if I can find a solution.

    Jonathon, kguy is right that you should do a secure erase and then a clean install of everything on a second-hand machine regardless of whether or not you clear up the problem with the mystery file first. I would load only the applications I want on the machine (just in case the current configuration has apps and other things left over from the prior owner) and then you can rest easy.

  • Mystery files clogging up my boot drive!

    I just got a message that my startup disk is nearly full. That was a surprise. When I did a "get info" on the four folders on the drive, Applications, Users, System and Library, the amount of space used adds up to about 75 GB. But when I do a "get info" on the boot drive that houses those folders, it says 115 GB are used. The boot drive is a 120 GB Mercury Elite, and I store the majority of my pictures, data and music on another internal drive.
    How do I figure out where these "mystery files" are that are clogging up my boot drive?

    Surely you can shrink and create a 160GB partition and you have in the past done both? Or use the partition you have. I like to have "current" or working image, a backup from pre-10.8.3, an image from 10.6.8 etc
    use CCC or Disk Utility to make a clone or sparse disk image.
    Restore image with ERASE and RESTORE.
    In future use Disk Utility and it will see that TRIM is present and DU repair disk will perform a trim operation - you will see output on screen at the end of a repair.
    Head to the developer home page for TE.
    Hibernation on Bing:
    mac os x hibernation
    Sure you understand cloning - and my sprained finger I try to ignore or use OMNI for disksweeper
    Using Cloning as a Backup Strategy
    http://www.macupdate.com/app/mac/7032/carbon-copy-cloner 
    http://www.bombich.com/software/updates/ccc-3.5.html
    OS X Lion Install to Different Drive
    How to create an OS X Lion installation disc MacFixIt
    Migration Assistant Update for Mac OS X Snow Leopard
    http://www.apple.com/support/lion/installrecovery/
    Create an OS X Lion Install disc
    http://reviews.cnet.com/8301-13727_7-20080989-263/how-to-create-an-os-x-lion-ins tallation-disc
    How to clone your system:
    http://macperformanceguide.com/Mac-HowToClone-backup.html
    http://macperformanceguide.com/Mac-HowToClone.html
    http://www.macupdate.com/app/mac/7032/carbon-copy-cloner
    http://www.macperformanceguide.com/blog/2012/20120711_2-MacPro-internal-clone-ba ckup.html
    OmniDiskSweeper
    https://www.omnigroup.com/products/omnidisksweeper/

  • A mysterious file

    Hi, I have just found a mysterious file reside in /etc/, which has the name of dhclient.conf.
    I don't remember I have set this up and I have no idea about the host names defined in it.
    And there is no such interface called ep0 here.
    What does it do?
    send host-name "andare.fugue.com";
    send dhcp-client-identifier 1:0:a0:24:ab:fb:9c;
    send dhcp-lease-time 3600;
    supersede domain-name "fugue.com home.vix.com";
    prepend domain-name-servers 127.0.0.1;
    request subnet-mask, broadcast-address, time-offset, routers,
            domain-name, domain-name-servers, host-name;
    require subnet-mask, domain-name-servers;
    timeout 60;
    retry 60;
    reboot 10;
    select-timeout 5;
    initial-interval 2;
    script "/sbin/dhclient-script";
    media "-link0 -link1 -link2", "link0 link1";
    reject 192.33.137.209;
    alias {
      interface "ep0";
      fixed-address 192.5.5.213;
      option subnet-mask 255.255.255.255;
    lease {
      interface "ep0";
      fixed-address 192.33.137.200;
      medium "link0 link1";
      option host-name "andare.swiftmedia.com";
      option subnet-mask 255.255.255.0;
      option broadcast-address 192.33.137.255;
      option routers 192.33.137.250;
      option domain-name-servers 127.0.0.1;
      renew 2 2000/1/12 00:00:01;
      rebind 2 2000/1/12 00:00:01;
      expire 2 2000/1/12 00:00:01;

    dhclient.conf holds settings for dhclient, which is used to get dhcp settings for an ethernet interface.
    I believe arch uses dhcpcd though, so I am not sure why you have it. Check to see if you have a dhclient binary somewhere
    updatedb; locate dhclient

  • Mysterious file in home folder

    This may not be a problem, but it would be good to make sure. There is a strange file in my home folder called "Opera 7 preferences.new". Does anyone know what the function of a file with that extension ".new" is? I'd appreciate any feedback, thank you.
    iMac G5   Mac OS X (10.3.5)  

    Hi,
    I did a quick search on Google, and it seems that it might be related to installing software, like perhaps the Flash Player 8. Opera is a browser, and it seems that some software companies are licensing it for their online help systems...
    charlie

  • Acrobat-Reader printing creates mystery file.

    I am having an issue with Reader and Acrobat on our Enterprise desktop image. Using the same installation source (transformed msi using Adobe tuner) on the Citrix server environments do not have the same issue. (only Reader on Citrix)
    Image=
    Windows XP SP3
    Internet Explorer 6
    Reader and Acrobat 9.x (testing with multiple versions of 9.x show it is not version specific)
    Here is what you do to recreate the issue.
    open any pdf in Reader or Acrobat.
    print the file.
    The directory the pdf you printed now has a new file. The name of the file differs based on the printer you print to.
    Example of file names using 2 seperate printers=
    USB brother hl-1440 connected directly to the laptop via usb. "USB001" 0 bytes
    Network attached Ricoh printer via Windows 2008 print server. "IP_10.46.152.250" 0 bytes
    I used Process Monitor to see what is actually creating the file thinking it might be the print driver.
    I am attaching a screen shot. I hope it is readable. The process creating the file is AcroRd32.exe
    Date & Time: 3/11/2010 5:04:52 PM
    Event Class: File System
    Operation: CreateFile
    Result: NAME NOT FOUND
    Path: D:\documents and settings\son2f\Desktop\IP_10.46.152.250
    TID: 5132
    Duration: 0.0005615
    Desired Access: Generic Read
    Disposition: Open
    Options: Synchronous IO Non-Alert, Non-Directory File
    Attributes: N
    ShareMode: None
    AllocationSize: n/a
    Description: Adobe Reader 9.1
    Company: Adobe Systems Incorporated
    Name: AcroRd32.exe
    Version: 9.1.0.163
    Path: C:\Program Files\Adobe\Reader 9.0\Reader\AcroRd32.exe
    Command Line: "C:\Program Files\Adobe\Reader 9.0\Reader\AcroRd32.exe"  "D:\Documents and Settings\son2f\Desktop\lifeIns.pdf"
    PID: 2128
    Parent PID: 3544
    Session ID: 0
    User: MAST_HODC\son2f
    Auth ID: 00000000:000186f5
    Architecture: 32-bit
    Virtualized: n/a
    Integrity: n/a
    Started: 3/11/2010 4:50:51 PM
    Ended: (Running)
    Modules: ( I have this info. Dont think it is much help. THere is a lot.)

    I have seen this issue often in the large company I work. I don’t have a 100% fix. It seems to be related to users who created and using local IP port printers and not print servers. Because users have no rights to the system32\spool folder to write the temp file, it dumps this junk file on their desktop. Try correctly installing the printers using printservers and not creating local IP ports. An ugly work-around is to make the users system files hidden or create that file extension type (they usually use just one or two printers so the file type is the last 3 characters of the printer. What happens if their desktop gets filled up with the OS max junk limit, I don’t know because it hasn’t happened yet.

  • Mysterious file in Applications stack?

    So, if I open my Applications folder from my dock (is stack the right word?) I can see a file named "isolinux.cfg" but and I am unable to "poof" it out of the folder. If I go to my Applications folder in finder it is not there at all. I also tried to find it by searching it, including system files and searching by content as well as file name. I have already searched for it in Terminal as well using "ls -a" and "sudo ls"... I can't find this file anywhere, and I can't get rid of it!
    The only lead I have on what this file is or where it came from is that I know that when I create a bootable USB using the application "unetbootin" one of the files it creates on the target USB is named the same (isolinux.cfg) but that still doesn't explain how such a file ended up where it is.. Also, when I create a bootable USB that way, there are other files created as well which I don't see. Finally, when I create these files I can still remove them/edit them/whatever I feel like and that is the real problem I have with this file.. I can't get rid of it.
    So with all the backstory out there, how do I get rid of this file?
    For bonus points I would like to know what it is/why it's there/how it got there, but the other question is the more important one.

    Thanks for the response, and I will try out the Find Any File program and report back I have downloaded and searched every reasonable variation on "isolinux.cfg" that I could come up with and I only got one, unrelated, result... The name would suggest that it is a linux config file, and when I have created bootable USB's it has always been some distro of linux, but I have created multiple such USB's in the past and only recently has this file appeared. Also, I have never booted such a USB onto my mac, I have only made them using this machine so I don't know what to take from this part: "If the bootable USB is for a linux then odds are when you find and delete that file, it will probably be recreated if you boot from that USB again." Do you have experience with this kind of thing?

  • Mystery file in trash

    Hello,
    A few days ago, after i emptied the trash, I noticed it still had "paper" in it. When I clicked on it, on the bottom it said there was "1 item" but I didn't see any files in the trash. It's not a pressing matter, but I would just like to know how to delete it.

    Do you know if the file is on your HD or an external one?
    Have done search of discussions, have a look & see if helps.
    http://discussions.apple.com/search.jspa?threadID=&q=deletefile+fromtrash&objID=&dateRange=last90days&userID=&numResults=15&rankBy=10001

  • Mystery files

    I'm an HTML/Javascript newbie.  I've tried adding a Javascript script to open a new window with specific dimensions and no toolbars, but every time I view the document, it gives me error messages that refer to a URL for a file that doesn't exist, e.g."rlt441.htm."
    Does anybody know what this is about?
    Thanks!

    Hi there
    Files beginning with rlt are usually Tempoary files created when you preview the topic. Sometimes they are orphaned and hang around on the system when RoboHelp should have deleted them.
    Sounds like your JavaScript may need some tweaking.
    Cheers... Rick
    Helpful and Handy Links
    RoboHelp Wish Form/Bug Reporting Form
    Begin learning RoboHelp HTML 7 or 8 within the day - $24.95!
    Adobe Certified RoboHelp HTML Training
    SorcerStone Blog
    RoboHelp eBooks

Maybe you are looking for

  • Blackberry desktop manager error code

    Hey every body can write here that blackberry desktop manager 4.7 error code and problems..and why? cause- results -..... Message Edited by melihlevent on 07-16-2009 04:21 PM best regard Blackberry support teams in linkedin ...join http://www.linkedi

  • How to set default channel colors

    channel colors can be changed after acquisition took place. How can I change the default used each time a new task is started? When entering the life data panel before acqiring there are no traces to change in the properties menu. Sincerely H.P. Bert

  • Access the detailed navigation link using webdynpro

    Hi, I have a requirement where we have two different DC's of which one is a standard DC and the other one is custom DC with one application in each of them.My requirement is to navigate to the other application in the second DC directly on clik of a

  • HT4623 What do I do when my iOS and iTunes both need to be updated?

    Computer doesn't recognize iPad because has old iTunes version.  And can't update iOS on ipad thru computer.  Hat do I do?

  • Bug when viewing tables?

    There seems to be a bug when viewing tables with identical names in different schemas in SQL Developer. When I view table information in one schema and then go to a table with identical name in another schema the view isn't updated, it still shows th