Advertisement
If you have a new account but are having problems posting or verifying your account, please email us on hello@boards.ie for help. Thanks :)
Hello all! Please ensure that you are posting a new thread or question in the appropriate forum. The Feedback forum is overwhelmed with questions that are having to be moved elsewhere. If you need help to verify your account contact hello@boards.ie

Making Files

Options
  • 20-03-2005 5:21pm
    #1
    Registered Users Posts: 3,012 ✭✭✭


    Hey, making a servlet to upload files, but cant get it to write to a new file cause it cant create a new file to write info into.
    trying to use the File.mkFile(File URL, Type) method, but my compiler can't find the method in the Java.io.File class. what should I do?


Comments

  • Closed Accounts Posts: 17,208 ✭✭✭✭aidan_walsh


    Use a method that exists, perhaps? Maybe even consult the documentation?

    java.io.File has mkDir and mkDirs methods, no mkFile.


  • Registered Users Posts: 3,012 ✭✭✭BizzyC


    Every time i run it it says it can't find the specified path, the folders are all there, so I dont understand why i wont write to file.


  • Registered Users Posts: 1,865 ✭✭✭Syth


    Looks like this is running on Windows. Windows uses backslashes. Unix OSs use forward slashes.


  • Closed Accounts Posts: 17,208 ✭✭✭✭aidan_walsh


    True. In future, use File.seperator to get the system correct version.


  • Registered Users Posts: 3,012 ✭✭✭BizzyC


    Syth wrote:
    Looks like this is running on Windows. Windows uses backslashes. Unix OSs use forward slashes.
    Every time I try to use backslashes it causes illegal escape statement errors.
    It compiles as is, just wont run.
    I know that the problem is in the Strings being used as directory paths, but I dont know how to get it to accept a backslash.


  • Advertisement
  • Registered Users Posts: 885 ✭✭✭clearz


    BizzyC wrote:
    Every time I try to use backslashes it causes illegal escape statement errors.
    It compiles as is, just wont run.
    I know that the problem is in the Strings being used as directory paths, but I dont know how to get it to accept a backslash.

    When you are using a back slash you have to use a double one e.g \\


  • Registered Users Posts: 3,012 ✭✭✭BizzyC


    clearz wrote:
    When you are using a back slash you have to use a double one e.g \\
    Thank you! Got it working. It's always the small niggley problems....


  • Closed Accounts Posts: 113 ✭✭Pinhead


    BizzyC wrote:
    It's always the small niggley problems....

    Yeah.. like the most basic programming principals. You're running around programming servlets and have never heard of escape characters? :confused:


  • Registered Users Posts: 3,012 ✭✭✭BizzyC


    Pinhead wrote:
    Yeah.. like the most basic programming principals. You're running around programming servlets and have never heard of escape characters? :confused:
    What's your problem, dude?
    I've never used servlets before, ran into a small problem and asked for some advice.


  • Closed Accounts Posts: 113 ✭✭Pinhead


    I just found it very odd. Wasn't having a dig at you (even though it seemed so).


  • Advertisement
  • Registered Users Posts: 4,003 ✭✭✭rsynnott


    Pinhead wrote:
    Yeah.. like the most basic programming principals. You're running around programming servlets and have never heard of escape characters? :confused:

    That's sorta frightening, really...

    But yep, you'd be better off using the Separator thing; that way it won't break if you ever have to run it on UNIX.


  • Closed Accounts Posts: 324 ✭✭madramor


    BizzyC wrote:
    What's your problem, dude?
    I've never used servlets before, ran into a small problem and asked for some advice.

    these are the errors that you get when you cut and paste code.

    the only skill you have is cutting and pasting,
    you don't even have the basics down.

    the error was nothing to do with servlets,

    because you cut and pasted the code, it was impossible for you to
    track down the simpliest error.

    if this a college project, you are only fooling yourself into to thinking
    that you can use java programming.


  • Closed Accounts Posts: 113 ✭✭Pinhead


    Snap.


  • Moderators, Society & Culture Moderators, Sports Moderators Posts: 12,272 Mod ✭✭✭✭Kingp35


    madramor wrote:
    these are the errors that you get when you cut and paste code.

    the only skill you have is cutting and pasting,
    you don't even have the basics down.

    the error was nothing to do with servlets,

    because you cut and pasted the code, it was impossible for you to
    track down the simpliest error.

    if this a college project, you are only fooling yourself into to thinking
    that you can use java programming.

    thats a bit harsh mate how do you know he copied and pasted the code.

    And in either way I dont think comments like that are gonna make him any better by saying he is rubbish.
    How is that gonna make him better??
    Do everyone a favour and dont bother posting here if your gonna say that sh*te.


  • Registered Users Posts: 3,012 ✭✭✭BizzyC


    madramor wrote:
    these are the errors that you get when you cut and paste code.

    the only skill you have is cutting and pasting,
    you don't even have the basics down.

    the error was nothing to do with servlets,

    because you cut and pasted the code, it was impossible for you to
    track down the simpliest error.

    if this a college project, you are only fooling yourself into to thinking
    that you can use java programming.

    I'm sorry, I didn't realise it was illegal to be learning how to do new things with java.
    I by no means think of myself as a "programmer", I'm learning how.
    You need to take your head out of your ass and get down from your pedestal.
    This is a forum where people can get help if they need it, not where they'll recieve abuse for needing it.

    And no, I wasn't cutting and pasting.


This discussion has been closed.
Advertisement