-
May 16th, 2013, 02:53 AM
#1
Javac is not compiling correctly ... Please help
Hi Team,
I have installed jdk1.7.0_21 in my windows xp as well as windows 8 Systems.
When i try to compile a Simple Java program. Im getting the following error.
My code :
public class hello
{
public static void main(string[] args)
{
system.out.println("hello world");
}
}
Error :
C:\Java>javac hello.java
hello.java:5: error: cannot find symbol
public static void main(string[] args)
^
symbol: class string
location: class hello
hello.java:9: error: package system does not exist
system.out.println("hello world");
^
2 errors
I have added the path to environment variable (both Class path and Path). Here is my Path
Class path c:\sybase\ASEP_Win32\3pclass.zip;c:\sybase\ASEP_Win32\monclass.zip;C:\Program Files\Java\jdk1.7.0_21\bin\
C:\Java>path
PATH=c:\sybase\OLEDB;c:\sybase\ODBC;c:\sybase\ASEP_Win32;c:\sybase\OCS-12_5\dll;
c:\sybase\OCS-12_5\lib3p;c:\sybase\OCS-12_5\bin;C:\Program Files\Reflection;C:\W
INDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\system32\nls;C:\W
INDOWS\system32\nls\ENGLISH;C:\Program Files\IFFtools;C:\Program Files\IBM\Direc
tor\bin;C:\Program Files\Microsoft SQL Server\80\Tools\BINN;C:\Program Files\Sym
antec\pcAnywhere\;C:\Program Files\Common Files\Hitachi ID\;C:\Program Files\Jav
a\jdk1.7.0_21\bin\;C:\TCWIN45\BIN;C:\Program Files\Java\jdk1.7.0_21\bin\
Why am i not able to compile my program. Im really confused. please help.
-
May 16th, 2013, 11:05 AM
#2
Re: Javac is not compiling correctly ... Please help
Java is a case sensitive language, so String is not the same as string (also notice it's System, not system).
The convention is to capitalise class names (Hello instead of hello), and use lowercase initials for methods and variables names.
-
May 23rd, 2013, 01:06 AM
#3
Re: Javac is not compiling correctly ... Please help
Originally Posted by jcaccia
Java is a case sensitive language, so String is not the same as string (also notice it's System, not system).
The convention is to capitalise class names (Hello instead of hello), and use lowercase initials for methods and variables names.
Sorry for late Reply, I was out of town. Your solution worked perfectly. Thanks
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|