Java Code in Intel Mac

Discussion in 'Mac Programming' started by mrpersonality98, May 24, 2007.

  1. mrpersonality98 macrumors newbie

    Joined:
    May 24, 2007
    #1
    Hi,

    I am in deep deep **** (apologies for the language)

    If anyone can please help.
    I want a code in Java which can work in Intel Mac.
    The code should check for the existence of anything in the predefined location.

    For eg. If I click on a button, it should check whether a.txt exists in C:\JAVA - if yes - it should prompt "File Exist" - if no it should prompt "File Does not Exist"

    I want this today. I would really appeciate if you could help me out in this.
    You can send me the code at my gmail address - the username is vkmittal or you can send it through here

    Remember it should be in Java which runs in Intel Mac

    I would really owe a big time to you.
     
  2. hsvmoon macrumors newbie

    Joined:
    Jul 31, 2006
    Location:
    Huntsville Al
    #2
    basic code

    Below is the basic code idea you need to use. You just need to add the IO stuff.

    Code:
    File file = new File("C:\JAVA\a.txt");
    if(file.exists())
    {
    //display a.txt exists
    }
    else
    {
    //display a.txt does not exist
    }
    
    This sounds like homework?
     
  3. fishkorp macrumors 68020

    fishkorp

    Joined:
    Apr 10, 2006
    Location:
    Ellicott City, MD
    #3
    if you're running it from OS X you'll never get a 'true' value for something with a full Windows Path since no C:\ exists.

    there is absolutely nothing in what you're asking that would be specific to an intel mac over any other java capable computer out there other than you'd need the correct JRE to run and JDK to build.

    why not just Google for Java File IO and i'm sure an example will pop up. it's not complicated stuff.
     
  4. kiang macrumors regular

    kiang

    Joined:
    Apr 8, 2007
    #4
    Why do you think the Java API exists?
    file.exists() is a standard function in the class File, so if you just went to the API you would have found the answer in like 2 seconds....
     
  5. mrpersonality98 thread starter macrumors newbie

    Joined:
    May 24, 2007
    #5
    Thanx guyz - I think it has helped :)
    Would know the result in next week
     

Share This Page