Results 1 to 10 of 10
  1. #1
    satish kumar is offline Member
    Join Date
    Aug 2008
    Posts
    7
    Rep Power
    0

    Unhappy JAVA compilation error in UNIX

    i have the java prog(abc.java) in 'sample' folder. when i compile using javac.....it gives the 2 errors as shown below...
    this is the java prog...
    public class abc {
    public static void main(String aa[]) {
    System.out.println("hello" );
    }
    }
    ------------------------------------------------------
    /u/up11/sample:>ls
    a.java abc.java first.java

    /u/up11/sample:>javac abc.java

    abc.java:1: '' expected
    public class abc {
    ^
    abc.java:6: ';' expected
    ^
    2 errors
    ---------------------------------------------------------
    what is the reason for this :(
    pls let me know if anyone knows a solution to this...
    Thanks,

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,564
    Rep Power
    23

    Default

    Are there unprintable characters in the file? Did you copy it from a windows system without converting the lineends?

  3. #3
    mtv134 is offline Member
    Join Date
    Aug 2008
    Posts
    22
    Rep Power
    0

    Default

    what is the character encoding of the file?
    visit http://www.thejavacode.com
    Muhammad Safwat

  4. #4
    satish kumar is offline Member
    Join Date
    Aug 2008
    Posts
    7
    Rep Power
    0

    Default

    I typed the code by using 'oedit' in UNIX and did not copy from Windows.

  5. #5
    satish kumar is offline Member
    Join Date
    Aug 2008
    Posts
    7
    Rep Power
    0

    Default

    Quote Originally Posted by mtv134 View Post
    what is the character encoding of the file?
    hi,
    it says the default encoding type set is "C" , when i type the 'locale' cmd.
    Last edited by satish kumar; 08-07-2008 at 09:31 AM.

  6. #6
    mtv134 is offline Member
    Join Date
    Aug 2008
    Posts
    22
    Rep Power
    0

    Default

    I searched for the Java compilation character set and look what I found in sun website
    this is an option for the Javac command

    -encoding encoding
    Set the source file encoding name, such as EUCJIS/SJIS. If -encoding is not specified, the platform default converter is used.
    visit http://www.thejavacode.com
    Muhammad Safwat

  7. #7
    satish kumar is offline Member
    Join Date
    Aug 2008
    Posts
    7
    Rep Power
    0

    Default

    i feel that the locale variable LC_ALL has to be changed to something like LC_ALL=En_US.IBM-1047,

    pls refer these websites and see if some solution can be found

    1)
    publib.boulder.ibm.com/infocenter/wasinfo/v4r0/index.jsp?topic=/com.ibm.support.waszos40.doc/html/WebSphere_Application_Server_for_z_OS/swg1PQ63575.html]Help]Help
    2)mail-archive.com/ibm-main@bama.ua.edu/msg62365.html]Re:

  8. #8
    serjant's Avatar
    serjant is offline Senior Member
    Join Date
    Jun 2008
    Location
    Ukraine,Zaporozhye
    Posts
    487
    Rep Power
    6

    Default

    public static void main(String[] args) a

    and not as you typed:

    public static void main(String aa[])


    The second thing also can be that javac is not found,try to find javac in your file system and in console type the path to it and the argument,on my Linix system it looks like:
    /usr/local/jdk6/javac d.java
    Last edited by serjant; 08-07-2008 at 11:28 PM.

  9. #9
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    16,564
    Rep Power
    23

    Default

    Are there other programs that you can use to read and display the contents of the source file? Do all of them show the source correctly?

  10. #10
    satish kumar is offline Member
    Join Date
    Aug 2008
    Posts
    7
    Rep Power
    0

    Default

    Hi all,

    The problem was 'locale' in UNIX server. I had to change my locale to Da_DK.IBM-1142 using export LC_ALL command.

    This resolved my problem and i am able to compile. :-)

Similar Threads

  1. compilation error(version problem?)
    By Ms.Ranjan in forum New To Java
    Replies: 3
    Last Post: 07-11-2008, 04:31 PM
  2. Accessing unix system using java
    By abhishek.sinha in forum AWT / Swing
    Replies: 3
    Last Post: 06-19-2008, 08:05 AM
  3. how to run java app on windows in a cron like on unix
    By rockie12 in forum Advanced Java
    Replies: 7
    Last Post: 05-23-2008, 01:39 PM
  4. using java to login to unix
    By dowell in forum Advanced Java
    Replies: 4
    Last Post: 05-23-2008, 07:26 AM
  5. compilation error with Jcreator
    By Heather in forum JCreator
    Replies: 2
    Last Post: 06-30-2007, 04:12 PM

Posting Permissions

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