Only Java Files From Eclipse Compile Properly

Discussion in 'Mac Programming' started by jblagden, Mar 16, 2016.

  1. jblagden macrumors 65816

    jblagden

    Joined:
    Aug 16, 2013
    #1
    I’ve noticed that if I make a Java program in TextEdit or TextWranger and then try to compile it in Terminal, I get faulty criticism like this:
    PiesTest.java:2: error: unclosed string literal
    System.out.println("How many apples do you have?”);

    And yet, if I create a Java program in Eclipse, it’ll compile perfectly in Terminal.

    Why is this Happening? How do I fix this?
     
  2. chown33 macrumors 604

    Joined:
    Aug 9, 2009
    #2
    The code in the error you posted has curly quotes (a.k.a. "Smart Quotes"). Turn them off in TextWrangler and TextEdit. It'll be in each app's Preferences window.

    Eclipse probably doesn't have a smart quotes feature. If it does, it's probably off by default. The other two apps have it on by default.

    There's also a System Preferences pane > Language & Text > Text and look for checkboxes or popups for smart quotes.


    To see the curly/smart quotes, use a very large font:
    System.out.println(
    "How many apples do you have?”);


    Notice the opening quote is neutral (vertical). Then notice the closing quote is slanted right. That means it's a curly/smart quote.

    Obviously, what it looks like will depend on what font you're using. So test TextEdit and TextWrangler with different fonts, on a sample text that contains both neutral and smart quotes.
     
  3. jblagden thread starter macrumors 65816

    jblagden

    Joined:
    Aug 16, 2013
    #3
    Awesome! Thanks!
     

Share This Page