File.lastModified() not working in MAC OS

Hi all,
Iam trying to get the lastmodified time of a file using this
        File newFile=new File(uploadFilePath); //uploadFilePath has the path of the file.
        String newFile_Name=newFile.getName();
        long lastmodified=newFile.lastModified(); The above is working in windows but not in MAC. in MAC i get the lastmodified time as 0. I
s there anyother functionality to get this in MAC. or is it the problem with the path?.
For eg. the uploadFilePath in PC will be like this
C:\Documents and Settings\Tanuja\Desktop\File\file_management.txt
where as in MAC file path of a selected file will be like this.
/Users/Tanuja/Desktop/file_management.txt
is this path makes difference or iam i going wrong somewhere?
could not figure out.
Thanks,
Thanuja.

I found where the problem is. Using the file chooser i selected a file and got the file path and my code deals witht the path as below:
String uploadFilePath=/Users/Tanuja/Desktop/file_management.txt
File newFile1=new File(uploadFilePath);
//Check  whether file exists or not
if(newFile1.exists()==true)
            out.println("exists");
        else
            out.println("does not exists");
Result: does not exists
So i tried by passing the absolute path but all in vain. I get the same result.
Absolute path: C:\Users\Tanuja\Desktop\file_management.txt
String uploadFilePath=/Users/Tanuja/Desktop/file_management.txt
File newFile1=new File(uploadFilePath);
String abslolutePath=newFile1.getAbsolutePath();
File newFile=new File(abslolutePath);
if(newFile.exists()==true)
            out.println("exists");
        else
            out.println("does not exists"); why its not detecting the file though the file path it returned is correct?.
since it is not detecting the file i got the lastmodified as 0.
iam using commons upload to upload the file. how commons package is able to detect the file and upload. My upload process is success. but before uploading the file i need to validate it by gettting the lastmodified date. Its not working.
Any suggestions?
Thanks,
Thanuja.

Similar Messages

  • New File() is not working on MAC

    Hi,
    I don't know exactly what is the problem,since i search in forums.
    but in my code
    File f = new File("/Users/sky/Desktop/dist/test.txt");
    is not working on Mac os.
    Please help !

    skymania wrote:
    On window it will give output : success
    On Mac it will give nothing.
    On window and mac both file is not exist (physically). Bull.
    Simply doing new File(...) does NOT create a file on disk, no matter what the OS.
    On Windows, before running the Java code:
    C:\>dir C:\CONFIG.SYS
    02/05/2008  01:06 PM                 0 CONFIG.SYS
    C:\>dir C:\zzzzz
    File Not FoundThen I run this Java:
    package scratch;
    import java.io.File;
    * Copyright (c) 2009 Tone Software Corporation
    * @author Jeff Verdegan
    public class NewFileDoesNotCreateAFileOnDisk {
      public static void main (String[] args) throws Exception{
        File f1 = new File("C:/CONFIG.SYS");
        File f2 = new File("C:/zzzzz");
        System.out.println(f1.getCanonicalPath () + ".exists() is " + f1.exists ());
        System.out.println(f2.getCanonicalPath () + ".exists() is " + f2.exists ());
    }and I get this result:
    C:\CONFIG.SYS.exists() is true
    C:\zzzzz.exists() is falseAnd then I do the dir again, and I get the same results.
    Thus proving that new File does NOT create a file on the disk.
    If you would bother to read the docs for the File class like I suggested, you'll see a way that you can create a file on disk.
    And if you read my other comments, you'll see how to create a file as you write to it.

  • File upload not working on Mac OSX

    I've tried several of the Flex file upload components, in all
    cases they don't work correctly when used on a Mac. I've tested
    both flash player 9 and the latest 10 release. The file uploads to
    the server, but the progress bar doesn't update and the upload
    complete event never fires. To the end user, it looks like the app
    isn't doing anything at all!
    Any advice on how to get this working? If you know of any
    file upload components that are already tested and working on the
    Mac version of flash - that would be a great help as well!
    Thanks!

    If you Google it you will find that this is a known issue, it surprised me since I spent days looking at my code.
    I found possible solutions here, but none worked for me it seems that it worked for many other people.
    http://www.abdulqabiz.com/blog/archives/2006/06/09/workaround-filereference-oncomplete-is- not-fired-on-mac-os/
    Hope Mac and Adobe will have lunch one day and figure it out.
    Ben

  • Bookmark Open File Action not working on MAC OSX

    We are getting the following error when trying to open different files that start find in Finder:
    could not find an application to open the file 'xxxxx'
    We tried a simple MAC OS Application.app file, a terminal app script and in both cases we get the above error.  These same files start up without issue on a click in Finder.
    The Open File action "DOES" work on an Microsoft Office File... but does not work for a Mac Application.App file or a AppleScript script file.
    Can anyone share how to get Open File to work with some type of script file or application file on the MAC OS with Adobe Reader 11 ?

    We ended up having to create an App on the MAC OS with an "associated" file type and then use the Bookmark Open File Action on files of that type.  This followed what worked for opening Office files on the MAC from the Bookmark Open File Action.
    My question was ... on Windows we could use the Bookmark Open File Action to open up "applications" or "bat scripts" directly... but this does not appear to be supported on the MAC.  We could not "start" an app or a script directly from the Bookmark Open File Action.  We had to set the action to open a file and then handle that file in the associated application we created for that filetype on the MAC.
    Thank you for your question,
    James

  • File.lastModified() not working properly.

    Hi,
    I need to check if the file is modified or not.So Iam using the following code.
    public void testLastModified() {
              for(int i =1 ;i < 10 ;i++){
              String filePath = "C:" + File.separator + "test1.rtf";
              File test1 = new File(filePath);
              if (test1.exists()) {
                   System.out.println("File exits");
                   if (test1.canRead()) {
                        System.out.println("Can read file");
                        if (test1.canWrite()) {
                             System.out.println("can write file");
                             long time = test1.lastModified();
                             System.out.println("last modified:" + time);
                             try {
                                  this.sleep(1000);
                             } catch (InterruptedException e) {
                                  // TODO Auto-generated catch block
                                  e.printStackTrace();
                             System.out.println("wait completed");
                             System.out.println("last modified:" + test1.lastModified());
    while the thread is in sleep state for 1000 ms iam openning and modifying the file.But not saving it.
    The code prints the same modified time as that of the intial modified time.
    So can't we determine last modified time without saving the file.
    Thanks in advance.

    The question doesn't make any sense at all. If you haven't saved the modifications yet, the file hasn't been modified yet, so how could the last-modified date & time change? Why should it change?
    Having said that, some platforms don't modify this attribute until the file is closed.

  • Dreamweaver CS5.5 File Compare not working on Mac

    It's not working at all, and I have TextWrangler as the application for this feature.  Can somebody help?  I've asked this question before and nobody has been able to help.  Should I reinstall it?  FYI, I'm new to a Mac.

    exactly the same here. Also I posted to a similar, slightly older thread already: http://forums.adobe.com/message/4116260

  • Cloud Files Sync not working on Mac - Folder is archived

    The sync of files in my cloud is not working at all. I wanted to try this feature out for the first time and this is what I always get as a screen:
    It appears again and again.
    I do see an adobe cloud folder but it has (archived) written behind it.
    Please can someone tell me what is wrong?

    File Sync Links that may help
    -https://forums.adobe.com/community/creative_cloud/host_sync
    -http://helpx.adobe.com/creative-cloud/kb/arent-my-files-syncing.html
    -http://helpx.adobe.com/creative-cloud/kb/cannot-share-certain-types-files.html
    -Size Limits https://forums.adobe.com/thread/1488242

  • Android File Transfer not working with MAC OSX 10.9.5

    I have a Kurio Extreme for my child, and I have downloaded and used Android File Transfer in the past. Recently two things have changed. My OS, and the Kurio tablet. I attempted to use it today, and the device is not recognized.
    I reached out to the Kurio Helpdesk and they state that the issue is either with the OS software or AFT. I have removed AFT, rebooted the computer, downloaded it again, all to no avail.
    Any ideas on how to fix this issue?

    This problem could arise if you have installed Kies. What it does is, it installs drivers which is not compatible with android file transfer app.
    Now the solution for this problem is properly uninstall kids from your mac, to do this follow the steps:
    1. Check the security and privacy settings in your system preference whether the settings for "Allow apps download from" to "Anywhere" (to set this first click the lock button on the left of your screen by entering your password, this will enable the option to be changed)
    2. After you are done with the first step open the kies installation file (file that is used to install kies, if you have deleted the file, download it again) open the file there you will find an option "uninstall". Click and follow the instruction.
    3. When you have successfully deleted the app, restart your mac.
    4. Install Android file transfer app if you haven't done it yet.
    5. Connect your android device
    6. BANG! It will work just fine. Hope it helps!!

  • File sharing not working 10.6

    file sharing not working on 10.6

    Rather more information is needed!
    With what are (not) sharing?
    Other computers on a network? (if so, are they all Macs or some Windows?)
    Other Users on the same Mac?

  • JNLP is not working with MAC OS 10.8.2 Java 7U9, any help ?

    I am running Firefox on MAC OS 10.8.2
    Java 7U9 nac osx x 64
    JNLP files are not working fine. I used to run by double click but now asking me Open with and I can not find any app to link it with Java.
    I searched the internet and found a number of people has the same issue.
    any help will be highly appreciated to link the JNLP files to Java by double clicking and helping me doing my business utilizing that application.

    Java for OS X 2012-006: How to re-enable the Apple-provided Java SE 6 applet plug-in and Web Start functionality

  • File collaboration not working

    This is still an issue for me and has been for over a week. Latest Safari and the latest Chrome, different emails, they all produce the same result for me.
    Sounds like the same issue that @Quaetapo reported.
    Mac OS X 10.10.3

    I have forked the discussion (from Library collaboration not working to a new forum thread and updated the topic to File collaboration not working.
    Two things to try:
    Clear the browser cache and cookies and see if the error goes away.
    Open the browser's Developer Tools and go to the Network tab. Do you see any 4xx or 5xx errors (usually the call will be colored red).

  • Multiple Image Upload not working on macs

    Hello everybody,
    I have searched everywhere for an answer to this issue and I'm not sure if there is a solution yet.
    I am hoping someone reads this and tells me if either I need to use another product or post a fix for this to work.
    I am developing a website for a photographer who needs to upload the pictures he takes for his clients to review on his website.
    So on the backend I have created an application where he logs in and creates a new client and then uploads multiple images to that client's folder.
    I am of course developing the site in ADDT version 1.0.1. in Dreamweaver CS4.
    Everything works as expected except for the image upload part, where he is unable to upload even a single image.
    He is using Mac OS X and Safari 3 to access his site.
    I use a PC and can upload images perfectly, but the whole purpose of the website is for him to be able to upload images without me.
    I read somewhere that ADDT's Multiple Image upload did not work on Macs because of the way that the OS handles image uploads to the server via HTTP. I also know that Flash v.10 had an issue with this behaviour in the past, but that it's been fixed with ADDT's v. 1.0.1, which is true since as I said I am able to upload images from my PC using that Flash version.
    There is a product called MultiPowUpload from Element-IT (http://www.element-it.com/MultiPowUpload.aspx) that seems to do the exact same thing as ADDT's Multiple Image Upload, and I have tested the Demo version both on Mac and PC and works perfectly well.
    I really would like my ADDT behaviour to work, first because I already have the whole site developed in it, plus I am used to the software already, and also because Element-IT's product is a bit pricey for a multiple server license (which I would need for other sites I plan to develop for Mac users).
    Any thoughts or pointers you might have will be greatly appreciated.
    Thank you in advance.
    Luis Herrero.

    Thanks a lot for your replies and helpful ideas.
    It turns out that for some strange reason the problem was with the hosting provider.
    I have moved another site which was not working with Macs either to a new provider and everything works now as it should be, without changing any files at all.
    I have in fact v.1.0.1 in both those sites (those were the first things I checked before posting here) and Flash Player v. 10 both on the Mac and PC, so it will remain a mystery as to why the server behavior did not work with that particular host on Macs.
    Thanks again.
    Best regards.

  • SWF Files do not work in Firefox. My sites work fine in Explore & Safari? Why is this? I have updated all my plugins, reinstalled yet still nothing?

    SWF Files do not work in Firefox. My sites work fine in Explore & Safari? Why is this? I have updated all my plugins, reinstalled yet still nothing?

    Can you post a link?
    Does that only happen on that website or do you have that problem with all Flash content?
    Reload web page(s) and bypass the cache.
    * Press and hold Shift and left-click the Reload button.
    * Press "Ctrl + F5" or press "Ctrl + Shift + R" (Windows,Linux)
    * Press "Cmd + Shift + R" (MAC)
    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

  • Apple id not work for mac app store, what happen? It is available for others such as iTunes, my iPhone and iPad

    apple id not work for mac app store, what happen? It is available for others such as iTunes, my iPhone and iPad

    Try deleting the cache associated with the App Store..
    Quit the App Store if it's open.
    Open the Finder. From the Finder menu bar click Go > Go to Folder
    Type this exactly as you see it here:
    ~/Library/Caches/com.apple.appstore/Cache.db
    Click Go
    Move the Cache.db file to the Trash.
    Relaunch the App Store. See if that made a difference.

  • .jar file is not working properly :developed in NETBEANS

    Hi Gurus,
    i am using NETBEANS IDE 7.2.
    i am developing a project that interacts with databases 10g and COM ports of machine , these all processes are performed by .bat file which i am trying to run from jFramform , code works perfectly .bat file is also called perfectly when i run the project using F6 from the NETBEANS, for testing i placed some dialogue boxes on the form to test it ,
    but when i run executable .jar  file , form run successfully and dialogue box works perfectly but .bat file is not called by executable .jar file.
    this is how i call the .bat file...
      String filePath = "D:/pms/Libraries/portlib.bat";  
            try { 
              Process p = Runtime.getRuntime().exec(filePath); 
            } catch (Exception e) { 
                e.printStackTrace(); 
    and below is the contents of portlib.bat file
    java -jar "D:\SMS\SMS\dist\SMS.jar" 
    you must probably ask why i am calling a .jar file using .bat file .
    reason is that this .jar project sends message using GSM mobile , System.exit(); is compulsory to complete a job and then do the next one ,
    if i use the same file to execute this job it makes exit to entire the application (hope you can understand my logic).
    that's why i use extra .jar file in .bat file , when single job is completed .bat exits itself and new command is given.
    Problem is that code is working perfectly in NETBEANS when i run the project but when i run .jar then .bat file is not working  ,
    thanks.

    Thanks Sir ,
    You need to first test an example that works like the one in the article.
    There are plenty of other examples on the web - find one you like:
    http://javapapers.com/core-java/os-processes-using-java-processbuilder/
    I tried this one.
      try {
                ProcessBuilder dirProcess = new ProcessBuilder("D:/SMS/SMS/Send_message.bat");
                 File commands = new File("D:/SMS/SMS/Send_message.bat");
                 File dirOut = new File("C:/process/out.txt");
                 File dirErr = new File("C:/process/err.txt");
               dirProcess.redirectInput(commands);
                 dirProcess.redirectOutput(dirOut);
               dirProcess.redirectError(dirErr);
                 dirProcess.start();
            } catch (IOException ex) {
                Logger.getLogger(mainform.class.getName()).log(Level.SEVERE, null, ex);
    as instructed in the article i compiled  both the projects at same version or sources and libraries which is 1.7
    here is my version details
    C:\>javac -version
    javac 1.7.0_07
    C:\>java -version
    java version "1.7.0_07"
    Java(TM) SE Runtime Environment (build 1.7.0_07-b11)
    Java HotSpot(TM) Client VM (build 23.3-b01, mixed mode, sharing)
    inside the NETBEANS IDE c:\process\err.txt  remains empty and code works perfectly , but when I run executable .jar file( by double clicking on that file in dist directry) then c:\process\err.txt becomes full with this error text and there is no response from calling D:\SMS\SMS\send_message.bat
    here is the error text
    java.lang.UnsupportedClassVersionError: sms/SMSMAIN (Unsupported major.minor version 51.0)
      at java.lang.ClassLoader.defineClass0(Native Method)
      at java.lang.ClassLoader.defineClass(Unknown Source)
      at java.security.SecureClassLoader.defineClass(Unknown Source)
      at java.net.URLClassLoader.defineClass(Unknown Source)
      at java.net.URLClassLoader.access$100(Unknown Source)
      at java.net.URLClassLoader$1.run(Unknown Source)
      at java.security.AccessController.doPrivileged(Native Method)
      at java.net.URLClassLoader.findClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
      at java.lang.ClassLoader.loadClass(Unknown Source)
      at java.lang.ClassLoader.loadClassInternal(Unknown Source)
    Exception in thread "main"
    here is /SMS/SMS
    unknown source ?

Maybe you are looking for

  • Scrolling Row Text Color in JScrollPane

    Hi, I've implemented a JTable that overrides the prepareRenderer method so that if certain criteria are met, the text of the associated row are set to a certain color.           // Create JTable and override prepareRenderer method           centertab

  • Positional flat file schemas for input and output files to be generated with the required usecases

    Hello all, I need one help regarding the positional flat file schema which contains multiple headers, body and trailers. I have attached the sample input file below. This is a batched input and we have to generate the output which I have given below:

  • FCP7 viewer (motion tab) vs FCPX inspector ??

    I'm a FC express 4 (almost similar to FCP7) user, I want to change to FCPX. I'm running a trial version, there are reasonable good changes, but there is 1 important thing missing. The viewer window is missing, in the viewer you could find the tabs vi

  • Satellite C870-12E - BIOS settings greyed out

    I recently noticed that i cannot change settings in BIOS anymore, almost all settings are greyed out. I'm not sure when this happened, maybe after updating to BIOS version 1.6 but it could also happened after upgrading to Windows 8. I'm just not sure

  • Datasource for Planned Order information in PLAF table

    I am looking for a extractor to extract Planned order information from R3 'PLAF' table into BW. If anybody knows information on this, please let me know. Thanks for your help