Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Platform Independent , Reality or Myth  RSS feed

 
Rohan Kayan
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does Java is Platform independent in reality ??

Or in reality Java is a combination of Platform Independent Complier with Platform Dependent Interpreter !!!
 
Roger Chung-Wee
Ranch Hand
Posts: 1683
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Platform independence is largely true. I have frequently developed and built on Windows and then deployed on Unix.

However, garbage collection and threading are not platform independent.
 
Niki Nono
Ranch Hand
Posts: 256
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
java is platform dependent because of the JVMs installed on different platforms.
JVM translates the java class into the platform understandable code.
and so jvms become platform dependent.

right???
 
Rohan Kayan
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi I am totaly agree with Niki , but then why Java always comes with the feature "Platform Independent" ???
 
Jeroen Wenting
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java APPLICATIONS are (largely, you can go out of your way to create something that's not) platform independent.
JVMs are not, for the obvious reason that you can't have something access hardware and core OS functions in an independent way.
The same is true for all platform independent languages, there's always a stub, interpreter, runtime, or whatever that has to be written specifically for each platform on which you want to use it.

I've deployed the same classfiles on Windows, AIX, SCO, Linux, HP-Ux, and OS/2 over the years. Sounds pretty platform independent to me.
 
Rohan Kayan
Ranch Hand
Posts: 123
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Jeroen Wenting:
Java APPLICATIONS are (largely, you can go out of your way to create something that's not) platform independent.
JVMs are not, for the obvious reason that you can't have something access hardware and core OS functions in an independent way.
The same is true for all platform independent languages, there's always a stub, interpreter, runtime, or whatever that has to be written specifically for each platform on which you want to use it.

I've deployed the same classfiles on Windows, AIX, SCO, Linux, HP-Ux, and OS/2 over the years. Sounds pretty platform independent to me.


Is it only reason that if a program can only run on different platform then it is platform independent ? In my view the output must be same then only we will call it platform independent , but as the GC and Threading depends on the system ,how can we say that it is platform independent??
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It's a marketing phrase that means you can write programs in Java that run on any platform you can get a Java VM for. Not more, not less.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12542
48
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The commonly used interpretation of "Platform Independance" is "write once, deploy anywhere".

In other words, i write the code, compile it, and send that same output from that one compile to ANY machine i want (that has a JVM), and it will run. I don't have to write it, compile it on 12 different machines using 12 different compilers, and send the proper executable to each machine.

Also, if somebody invents a brand new machine 5 years after i write my code, as long as a JVM is created for it, i can send it THE SAME OUTPUT FROM MY INITIAL COMPILE. my code will run on a machine that didn't even exist when i wrote the code - all i have to do is ship it.

Try doing THAT with C/C++.

If you want to re-define "Platform Independance" to mean "The output must be the same", that's your right, but nobody else will know what you're talking about.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!