Results 1 to 7 of 7
  1. #1
    jhaveri_hiral is offline Member
    Join Date
    Jul 2011
    Posts
    1
    Rep Power
    0

    Lightbulb Java File name with white space

    Hello,

    I have created a Java file which has white spaces in its name.

    Now, if I create public class in this file, the class name must match with the file name. But class name can't have white spaces...

    So wat is the way out??

    Thank you in advance..

  2. #2
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,755
    Rep Power
    7

    Default

    Simple. Don't use whitespace in file names. At the least use underscores instead.

  3. #3
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,305
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by jhaveri_hiral View Post
    Hello,

    I have created a Java file which has white spaces in its name.

    Now, if I create public class in this file, the class name must match with the file name. But class name can't have white spaces...

    So wat is the way out??

    Thank you in advance..
    Why on earth do you want to do that? Is it a silly exercise from a book?

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  4. #4
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,755
    Rep Power
    7

    Default

    I blame M$.

  5. #5
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,305
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by Junky View Post
    I blame M$.
    I don't know; I see a lot of silly questions lately with silly constraints: sorting stuff without using arrays, getting characters from a String without using String methods etc. This is one of those silly questions. Someone must be making those questions up for some diabolical reason ...

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

  6. #6
    Junky's Avatar
    Junky is offline Grand Poobah
    Join Date
    Jan 2011
    Location
    Dystopia
    Posts
    3,755
    Rep Power
    7

    Default

    I was actually referring to the ability of having spaces in file names. I remember waaaaay back at uni when using unix some students using the mkdir command to create a directory called My Files and wondered why it didn't work.

  7. #7
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    13,305
    Blog Entries
    7
    Rep Power
    20

    Default

    Quote Originally Posted by Junky View Post
    I was actually referring to the ability of having spaces in file names. I remember waaaaay back at uni when using unix some students using the mkdir command to create a directory called My Files and wondered why it didn't work.
    Ah, yes, I understand; it's one of Microsoft's 'inventions' without any thoughts behind them; also with their silly \r\n line ending sequence (instead of \n); all that code running all over the world, just to fix that ... and all their bloody 'void main( ...)' functions in C/C++ code; they should nail their heads to the floor.

    kind regards,

    Jos
    cenosillicaphobia: the fear for an empty beer glass

Similar Threads

  1. Replies: 2
    Last Post: 06-29-2011, 09:08 AM
  2. Reading a File and Ignoring White Space
    By Tabula Rasa in forum New To Java
    Replies: 3
    Last Post: 04-21-2011, 08:09 AM
  3. JSTL and HTML White space
    By newakdev in forum JavaServer Pages (JSP) and JSTL
    Replies: 4
    Last Post: 02-24-2010, 05:54 PM
  4. [SOLVED] remove all white space from text file
    By loki in forum New To Java
    Replies: 10
    Last Post: 04-26-2009, 11:52 AM
  5. White Space Issue
    By sibythoma1984 in forum JavaServer Pages (JSP) and JSTL
    Replies: 0
    Last Post: 04-22-2008, 12:05 PM

Tags for this Thread

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •