Search code examples
javacompilationplatform-agnostic

Are there any cases where java "platform agnosticism" may fail?


I have been using java for long time but this question came to my mind recently and has been troubling me since.

I am aware about some conditions where platform agnosticism may be affected in java world via.

  1. code for interaction with file system
  2. using platform dependent libraries in the code.
  3. Also floating point numbers

Are there any more cases where java platform agnosticism may fail? Say a case where my file compiled on Solaris may fail to run on RedHat Linux.

Any help on the topic is appreciated.


Solution

  • Platform specific methods such as

    • Runtime.exec() is platform specific.
    • Anything under sun.* or com.sun.* may or may not be there, or do the same thing.
    • Some system properties are supposed to differ based on the system. e.g. There was one application which expected certain vendors which failed when the VM Vendor changed to Oracle. ;)
    • Anything which depends on System.getenv()
    • using native libraries