Results 1 to 6 of 6
  1. #1
    h8alfred is offline Member
    Join Date
    Mar 2009
    Posts
    4
    Rep Power
    0

    Default Java’s “Compile Once Run Anywhere”, where does it fail?

    Java’s “Compile Once Run Anywhere”, where does it fail?

  2. #2
    h8alfred is offline Member
    Join Date
    Mar 2009
    Posts
    4
    Rep Power
    0

    Default

    It's actually an interview question that was asked. Just want anyone's experience or opinion on this.

    Thanks.

  3. #3
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

  4. #4
    h8alfred is offline Member
    Join Date
    Mar 2009
    Posts
    4
    Rep Power
    0

    Default

    Thanks. But assuming JVM for each machine architecture is installed and has no bugs, what else would cause your compiled bytecode to fail?

  5. #5
    toadaly is offline Senior Member
    Join Date
    Jan 2009
    Posts
    671
    Rep Power
    6

    Default

    Many classes in the API have machine specific behavior. Threads are a classic example. It is possible to inadvertently write code that depends on the the behavior of a particular scheduler, that will simply flat out fail on other platforms.

    Another common gotcha is IO. Java is always big endian, but most machines these days are now little endian. If you write code to read binary data on a big endian machine and are not careful, it will fail on little endian machines.

    These are probably the two most common issues, but they are not the only ones. Java is really "write once, test everywhere".

  6. #6
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    19

Similar Threads

  1. jsessionid imbedded in link causes it to fail
    By dkirvan in forum JavaServer Pages (JSP) and JSTL
    Replies: 1
    Last Post: 11-10-2008, 09:25 PM
  2. Replies: 5
    Last Post: 10-25-2008, 08:42 AM
  3. My Java program will not compile and run?
    By sabrown311313 in forum Java Applets
    Replies: 1
    Last Post: 09-23-2008, 09:38 AM
  4. Help with Java Compile File
    By baltimore in forum New To Java
    Replies: 1
    Last Post: 08-06-2007, 07:48 AM

Posting Permissions

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