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.

Similar Messages

  • 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.

  • Why var file:File = new File(); is not working in Background Worker?

    Hi All,
    While working on Background Workers for Air for Desktop platform. I am facing a problem.
    I want to unzip a file in the background, which contains 14126 files in it because not using the worker is hanging my system.
    When I am using "new File()" or "File.desktopDirectory.nativePath;" I am getting following error:
    SecurityError: file
    at UnzipWorker/onMainToBack()[C:\Users\red5\Adobe Flash Builder 4.7\Downloader_air\src\UnzipWorker.as:45]
    at flash.system::MessageChannel/internalAddEventListener()
    at flash.system::MessageChannel/addEventListener()
    at UnzipWorker()[C:\Users\red5\Adobe Flash Builder 4.7\Downloader_air\src\UnzipWorker.as:33]
    I am not sure why I am getting above error.
    Someone please help me in this.

    Brijesh,
    Aloha.
    I implemented:
    var worker:Worker = WorkerDomain.current.createWorker( new ThreadByteClass(), true ) ;
    However, my background thread is still running with its Security.sandboxType set to remote, even though my primordial thread is running with Security.sandboxType set to localTrusted.
    Do you know how to resolve this?
    Have a great day.
    Take care,
    Darwin

  • 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

  • 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

  • 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

  • Define a new window size not working on Macs, is there a workaround?

    Hi everyone,
    I've currently got some thumbnails that open a new browser
    window. Here's the code I'm using in my movie:
    Launch_mc.onRelease = function() {
    getURL("javascript:var
    windowHnd=window.open('Print/Kaiju1.html','Kaiju','width=1024,height=663');");
    Unfortunately it doesn't work for macs. Does anyone know the
    workaround?

    I have been having similar problems... here's the error msg
    that I get with java script... The script is in the text below...
    Any thoughts???
    Safari can’t use JavaScript for this action.
    Safari can’t run the script “window.open('
    http://www.deepfreedom.org','Title','top=0,left=0,width=
    200,
    height=200,menubar=no,toolbar=no,statusbar=no,resizable=yes,scrollbars=yes');
    void(0);” because Safari doesn’t allow JavaScript to be
    used in this way.

  • 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!!

  • I upgraded Safari in my Mac (10.6.8 Leopard) but the new version does not work with my system so that I now have not a working browser. How can I solve the problem and/or install back my previous Safari version?

    I have upgraded Safari in my Mac, but the new Safari does not work with my system. So I find myself without any working browser. How can I solve this problem and/or install my previous Safari version?

    Reinstall Safari 5.1.10 for OS X 10.6.8: http://support.apple.com/kb/dl1569. Might do the trick.
    But, frankly, I don't think that simply reinstalling the old Safari will work because of all the peripheral, under the hood changes that happen when you upgrade from one version of Safari to another. Reinstalling 5.1.10 may be insufficient to turn back the clock. (This is the moment where a Time Machine or another form of full backup would save your bacon.)
    While you're getting a copy of Safari 5.1.10, get a copy of Firefox (https://www.mozilla.org/en-US/firefox/desktop/), too, so that you have an alternate browser to use as you're sorting matters.

  • Why is my powerpoint not working 10.9? i can't play my existing file and new files that i work..? how to fix that one..? pls help..!

    why is my powerpoint not working 10.9? i can't play my existing file and new files that i work..? how to fix that one..? pls help..!

    R Cubss,
    You might want to read down this thread. There are a lot of tips-n-tricks, and maybe one will be right for you.
    http://www.adobeforums.com/webx/.59b6565c/43
    Good luck,
    Hunt

  • New Itunes is not working because my imac is 10.6.8 need help ?

    New Itunes is not working because my imac is 10.6.8 need help ....

    Because you require Lion to run it. You should not have installed it.
    Upgrading to Lion
    If your computer does not meet the requirements to install Mavericks, it may still meet the requirements to install Lion.
    You can purchase Lion at the Online Apple Store. The cost is $19.99 (as it was before) plus tax.  It's a download. You will get an email containing a redemption code that you then use at the Mac App Store to download Lion. Save a copy of that installer to your Downloads folder because the installer deletes itself at the end of the installation.
         Lion System Requirements
           1. Mac computer with an Intel Core 2 Duo, Core i3, Core i5, Core i7,
               or Xeon processor
           2. 2GB of memory
           3. OS X v10.6.6 or later (v10.6.8 recommended)
           4. 7GB of available space
           5. Some features require an Apple ID; terms apply.
    Upgrading to Mountain Lion
    To upgrade to Mountain Lion you must have Snow Leopard 10.6.8 or Lion installed. Purchase a redemption code at the Online Apple Store: OS X Mountain Lion. Mountain Lion is $19.99 plus tax. Use the code to redeem a download of Mountain Lion from the App Store. The file is quite large, over 4 GBs, so allow some time to download. It would be preferable to use Ethernet because it is nearly four times faster than wireless.
         OS X Mountain Lion - System Requirements
           Macs that can be upgraded to OS X Mountain Lion
             1. iMac (Mid 2007 or newer) - Model Identifier 7,1 or later.
             2. MacBook (Late 2008 Aluminum, or Early 2009 or newer) - Model
                 Identifier 5,1 or later.
             3. MacBook Pro (Mid/Late 2007 or newer) - Model Identifier 3,1 or later.
             4. MacBook Air (Late 2008 or newer) - Model Identifier 2,1 or later.
             5. Mac mini (Early 2009 or newer) - Model Identifier 3,1 or later.
             6. Mac Pro (Early 2008 or newer) - Model Identifier 3,1 or later.
             7. Xserve (Early 2009) - Model Identifier 3,1 or later.
    To find the model identifier open System Profiler in the Utilities folder. It's displayed in the panel on the right.
         Are my applications compatible?
             See App Compatibility Table - RoaringApps.
    Upgrading to Yosemite
    You can upgrade to Yosemite from Lion or directly from Snow Leopard. Yosemite can be downloaded from the Mac App Store for FREE.
    Upgrading to Yosemite
    To upgrade to Yosemite you must have Snow Leopard 10.6.8 or Lion installed. Download Yosemite from the App Store. Sign in using your Apple ID. Yosemite is free. The file is quite large, over 5 GBs, so allow some time to download. It would be preferable to use Ethernet because it is nearly four times faster than wireless.
        OS X Mavericks/Yosemite- System Requirements
          Macs that can be upgraded to OS X Yosemite
             1. iMac (Mid 2007 or newer) - Model Identifier 7,1 or later
             2. MacBook (Late 2008 Aluminum, or Early 2009 or newer) - Model Identifier 5,1 or later
             3. MacBook Pro (Mid/Late 2007 or newer) - Model Identifier 3,1 or later
             4. MacBook Air (Late 2008 or newer) - Model Identifier 2,1 or later
             5. Mac mini (Early 2009 or newer) - Model Identifier 3,1 or later
             6. Mac Pro (Early 2008 or newer) - Model Identifier 3,1 or later
             7. Xserve (Early 2009) - Model Identifier 3,1 or later
    To find the model identifier open System Profiler in the Utilities folder. It's displayed in the panel on the right.
         Are my applications compatible?
             See App Compatibility Table - RoaringApps.

  • 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.

  • .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

  • Unable to access iOmega external hard drive

    Hope I am posting in the correct location. I have had two externals, an iOmega and a Seagate, connected to my iMac for a year or so. Have always been able to access their contents from most any program. Mostly I use Photoshop Elements and Final Cut E

  • Gateway Migration from H.323 to SIP

    Hi All, Currently all my Cisco Gateways registered with CUCM using H.323 protocol, for now i would like to migrate all these gateways registered protocol to SIP, simply i would like to Migrate all my H.323 gateways to SIP. Can anyone have any best pr

  • Diff between EDI and ALE

    Cand any one of you tell me exact difference between EDI and ALE

  • Deletion Icon in Goods Movement screen of CO13

    Hi experts In the goods movement screen of CO13, the deletion icon provided is de-activated by default. Is it possible to activate it? If possible - how? I want to remove the materials from the CO13 transaction, and cancel the confirmation qty only Y

  • Lync RSG Hunt Group not working as expected, not getting calls on lync clients

    I have created an Hunt Group in Lync. When i dial the number i do get the welcome message but after that it does not get forwarded to the test user which is configured in the Group. (Created a Queue and selected the group here and assigned this to th