dcsimg
www.webdeveloper.com
Results 1 to 7 of 7

Thread: beginner in java need help

  1. #1
    Join Date
    Nov 2011
    Posts
    35

    Exclamation beginner in java need help

    hi istart learn java and ihave problem with helloworld file

    C:\Documents and Settings\RTKWAR> cd\mywork

    C:\mywork>dir
    Volume in drive C is DRV1_VOL1
    Volume Serial Number is 3563-BF60

    Directory of C:\mywork

    02/12/2012 12:27 PM <DIR> .
    02/12/2012 12:27 PM <DIR> ..
    02/12/2012 12:45 PM 244 HelloJavaWorld.java
    1 File(s) 244 bytes
    2 Dir(s) 21,850,640,384 bytes free

    C:\mywork> set path=%path%;c:\program files\java\jdk1.7.0_01\bin



    C:\mywork> javac HelloJavaWorld.java

    But Iget This Error

    HelloJavaWorld.java:1: error: illegal character: \0
    *■p u b l i c c l a s s H e l l o J a v a W o r l d
    ^
    HelloJavaWorld.java:1: error: illegal character: \0
    *■p u b l i c c l a s s H e l l o J a v a W o r l d
    ^
    HelloJavaWorld.java:2: error: illegal character: \0

    ^
    HelloJavaWorld.java:3: error: illegal character: \0
    {
    ^
    HelloJavaWorld.java:3: error: illegal character: \0
    {
    ^
    HelloJavaWorld.java:4: error: illegal character: \0

    ^
    HelloJavaWorld.java:5: error: illegal character: \0
    p u b l i c s t a t i c v o i d m a i n ( S t r i n g a r g s [
    ] )
    ^
    HelloJavaWorld.java:5: error: illegal character: \0
    p u b l i c s t a t i c v o i d m a i n ( S t r i n g a r g s [
    ] )
    ^
    HelloJavaWorld.java:5: error: illegal character: \0
    p u b l i c s t a t i c v o i d m a i n ( S t r i n g a r g s [
    ] )
    ^
    HelloJavaWorld.java:5: error: illegal character: \0
    p u b l i c s t a t i c v o i d m a i n ( S t r i n g a r g s [
    ] )
    ^
    HelloJavaWorld.java:5: error: illegal character: \0
    p u b l i c s t a t i c v o i d m a i n ( S t r i n g a r g s [
    ] )
    ^
    HelloJavaWorld.java:5: error: illegal character: \0
    p u b l i c s t a t i c v o i d m a i n ( S t r i n g a r g s [
    ] )
    ^
    HelloJavaWorld.java:5: error: illegal character: \0
    p u b l i c s t a t i c v o i d m a i n ( S t r i n g a r g s [
    ] )
    ^
    HelloJavaWorld.java:5: error: illegal character: \0
    p u b l i c s t a t i c v o i d m a i n ( S t r i n g a r g s [
    ] )
    ^
    HelloJavaWorld.java:5: error: illegal character: \0
    p u b l i c s t a t i c v o i d m a i n ( S t r i n g a r g s [
    ] )
    ^
    HelloJavaWorld.java:5: error: illegal character: \0
    p u b l i c s t a t i c v o i d m a i n ( S t r i n g a r g s [
    ] )
    ^
    HelloJavaWorld.java:5: error: illegal character: \0
    p u b l i c s t a t i c v o i d m a i n ( S t r i n g a r g s [
    ] )

    ^
    HelloJavaWorld.java:5: error: illegal character: \0
    p u b l i c s t a t i c v o i d m a i n ( S t r i n g a r g s [
    ] )

    ^
    HelloJavaWorld.java:5: error: illegal character: \0
    p u b l i c s t a t i c v o i d m a i n ( S t r i n g a r g s [
    ] )

    ^
    HelloJavaWorld.java:6: error: illegal character: \0

    ^
    HelloJavaWorld.java:7: error: illegal character: \0
    {
    ^
    HelloJavaWorld.java:7: error: illegal character: \0
    {
    ^
    HelloJavaWorld.java:7: error: illegal character: \0
    {
    ^
    HelloJavaWorld.java:7: error: illegal character: \0
    {
    ^
    HelloJavaWorld.java:7: error: illegal character: \0
    {
    ^
    HelloJavaWorld.java:7: error: illegal character: \0
    {
    ^
    HelloJavaWorld.java:8: error: illegal character: \0

    ^
    HelloJavaWorld.java:9: error: illegal character: \0
    S y s t e m . o u t . p r i n t l n ( " H e l l o J a v a W
    o r l d " ) ;
    ^
    HelloJavaWorld.java:9: error: illegal character: \0
    S y s t e m . o u t . p r i n t l n ( " H e l l o J a v a W
    o r l d " ) ;
    ^
    HelloJavaWorld.java:9: error: illegal character: \0
    S y s t e m . o u t . p r i n t l n ( " H e l l o J a v a W
    o r l d " ) ;
    ^
    HelloJavaWorld.java:9: error: illegal character: \0
    S y s t e m . o u t . p r i n t l n ( " H e l l o J a v a W
    o r l d " ) ;
    ^
    HelloJavaWorld.java:9: error: illegal character: \0
    S y s t e m . o u t . p r i n t l n ( " H e l l o J a v a W
    o r l d " ) ;
    ^
    HelloJavaWorld.java:9: error: illegal character: \0
    S y s t e m . o u t . p r i n t l n ( " H e l l o J a v a W
    o r l d " ) ;
    ^
    HelloJavaWorld.java:9: error: illegal character: \0
    S y s t e m . o u t . p r i n t l n ( " H e l l o J a v a W
    o r l d " ) ;
    ^
    HelloJavaWorld.java:9: error: illegal character: \0
    S y s t e m . o u t . p r i n t l n ( " H e l l o J a v a W
    o r l d " ) ;
    ^
    HelloJavaWorld.java:9: error: illegal character: \0
    S y s t e m . o u t . p r i n t l n ( " H e l l o J a v a W
    o r l d " ) ;
    ^
    HelloJavaWorld.java:9: error: illegal character: \0
    S y s t e m . o u t . p r i n t l n ( " H e l l o J a v a W
    o r l d " ) ;
    ^
    HelloJavaWorld.java:9: error: illegal character: \0
    S y s t e m . o u t . p r i n t l n ( " H e l l o J a v a W
    o r l d " ) ;
    ^
    HelloJavaWorld.java:9: error: illegal character: \0
    S y s t e m . o u t . p r i n t l n ( " H e l l o J a v a W
    o r l d " ) ;
    ^
    HelloJavaWorld.java:9: error: illegal character: \0
    S y s t e m . o u t . p r i n t l n ( " H e l l o J a v a W
    o r l d " ) ;

    ^
    HelloJavaWorld.java:9: error: illegal character: \0
    S y s t e m . o u t . p r i n t l n ( " H e l l o J a v a W
    o r l d " ) ;

    ^
    HelloJavaWorld.java:9: error: illegal character: \0
    S y s t e m . o u t . p r i n t l n ( " H e l l o J a v a W
    o r l d " ) ;

    ^
    HelloJavaWorld.java:10: error: illegal character: \0

    ^
    HelloJavaWorld.java:11: error: illegal character: \0
    }
    ^
    HelloJavaWorld.java:11: error: illegal character: \0
    }
    ^
    HelloJavaWorld.java:11: error: illegal character: \0
    }
    ^
    HelloJavaWorld.java:11: error: illegal character: \0
    }
    ^
    HelloJavaWorld.java:11: error: illegal character: \0
    }
    ^
    HelloJavaWorld.java:11: error: illegal character: \0
    }
    ^
    HelloJavaWorld.java:12: error: illegal character: \0

    ^
    HelloJavaWorld.java:13: error: illegal character: \0
    }
    ^
    HelloJavaWorld.java:13: error: illegal character: \0
    }
    ^
    52 errors

    C:\mywork>
    any 1 can tell me whats problem?

    thats HelloJavaWorld.java

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

  2. #2
    Join Date
    Oct 2005
    Posts
    843
    Hey,

    You can read more about it here: http://stackoverflow.com/questions/1...pile-java-code

    But basically, it has to do with how the HelloJavaWorld.java was encoded (Text-Wise), what did you utilize to make the java file?

    I'd recommend you an IDE or a text-editor like Notepad++ and ensure the encoding is either "UTF without BOM" or "ANSI"

  3. #3
    Join Date
    Nov 2011
    Posts
    35

    Thumbs up Thank You

    iwrite java file with notepad itry change encoding to UTF-8 but iget 2 error
    but ichange encoding to ANSI its work good now ,thank you

  4. #4
    Join Date
    Oct 2005
    Posts
    843
    Quote Originally Posted by rtkwar View Post
    iwrite java file with notepad itry change encoding to UTF-8 but iget 2 error
    but ichange encoding to ANSI its work good now ,thank you
    I'm glad that helped, Straight UTF-8 would not of worked (I believe), it would of need to be "UTF without BOM"

  5. #5
    Join Date
    Nov 2012
    Posts
    5
    I am also learning Java. A very typical example. Thanks for the link. It's useful.

  6. #6
    Keep learning Java. I am also very intereated in Java.

  7. #7
    Join Date
    Dec 2012
    Posts
    1
    Hello,
    I have visited this forum. I am also beginner in java.this section is very beneficial for me and it gives me lots of information about programming that will be very useful to me in the future and i am also giving you this expert link for your queries.
    thanks.
    -------------------
    ATI RADEON HD 5670 SERIES GRAPHICS CARDS FROM AMD

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center



Recent Articles