I tried making a Hello World
program in Java, but am getting a CP1252
error:
import acm.program.*;
public class test extends Program
{
public void run() { println(”Hello world!!!”); }
}
Here's the errors:
C:\>javac -cp acm.jar test.java
test.java:4: error: unmappable character for encoding Cp1252
public void run() { println(ÔÇ?Hello world!!!ÔÇ?);
^
test.java:4: error: unmappable character for encoding Cp1252
public void run() { println(ÔÇ?Hello world!!!ÔÇ?);
^
test.java:4: error: ';' expected
public void run() { println(ÔÇ?Hello world!!!ÔÇ?);
^
test.java:4: error: not a statement
public void run() { println(ÔÇ?Hello world!!!ÔÇ?);
^
test.java:5: error: reached end of file while parsing
}
^
5 errors`
The simple test.java
program is obviously correct and I don't know what the issue is.
How do I resolve the CP1252 encoding error?
The issue is that you're using smart quotes instead of the actual quote character.
Here's a 'fixed' version of your code:
Note the difference between
"
and”
.To fix this (and it depends on your keyboard, I think), you should be using the
"
character that's immediately to the left of yourEnter
key.