Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

jblagden

macrumors 65816
Original poster
Aug 16, 2013
1,162
641
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?
 
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.
 
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.
Awesome! Thanks!
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.