Javac is not compiling correctly ... Please help
CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3

Thread: Javac is not compiling correctly ... Please help

Hybrid View

  1. #1
    Join Date
    May 2013
    Posts
    4

    Question 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.

  2. #2
    Join Date
    May 2009
    Location
    Surrey, UK
    Posts
    285

    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.

  3. #3
    Join Date
    May 2013
    Posts
    4

    Re: Javac is not compiling correctly ... Please help

    Quote Originally Posted by jcaccia View Post
    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
  •  


Windows Mobile Development Center


Click Here to Expand Forum to Full Width

This is a CodeGuru survey question.


Featured


HTML5 Development Center