Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

Class compiler

Hi,

I tried installing Java today and have been trying to fix this problem for hours. I installed Java, and when I run

javac C:\MyJava\Hello.java, I get errors. MyJava is obviously where my java file is stored, and I want to compile it to a class file.

The script I have is:

public class Hello
{
public static void main (String[] args)
{
System.out.printIn("Hello World");
}
}

When I run the compiler for this, the error I receive is:

C:\MyJava\Hello.java:5: cannot find symbol
symbol : method printIn(java.lang.String)
location: class java.io.PrintStream
System.out.printIn("Hello World");
^
1 error

If anyone can help me, I'll be very grateful as this has been a problem for hours.
[814 byte] By [MetallicIce] at [2007-11-11 10:05:41]
# 1 Re: Class compiler
Have you imported the java.io.* methods?

put

import java.util.*;
import java.io.*;

at the top of your hello.java file ... then re-compile.

If you have already included those lines, then your CLASSPATH does not include the directory where the JDK has installed the API library files.
nspils at 2007-11-11 22:31:59 >
# 2 Re: Class compiler
Forget about what I wrote about needing to import API files ...

I just compiled your code ... you were getting an error because you mistyped the name of the method which displays the string argument to the console and ends with a "new line/ carriage return". The method is "print line" and is written "println" - you have a uppercase "I" where you should have a lowercase "L"
nspils at 2007-11-11 22:33:04 >