• Post Reply Bookmark Topic Watch Topic
  • New Topic

Platform Independent

 
Utkarsh Chowdhary
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Why Java is said to be platform independent while C & C++ are not when Java Complier & JVM is different for every OS .?
 
Andy Ceponis
Ranch Hand
Posts: 782
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I think this was already answered in another forum.
 
Thomas Paul
mister krabs
Ranch Hand
Posts: 13974
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Because the program when compiled is platform independent. Do you often make changes to the JVM when running your applications?
 
James Du
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in my opinon,the feature of platform-independency is implemented by platform_DEPENDENT JVMs,when you compile a xxx.java file, you get a xxx.class file which is platform-indenpendent,but you cant run xxx.class without a JVM, in Windows, you must run your xxx.class with a windows version JMV,while in Solaris system, you need a solaris version.so it's up to JVM to accomplish the independency.
complier is platform-dependent too,that's where the different versions of jdk come,but you get identical xxx.class file regardless of the underlying OS.
it's my understanding, if i'm wrong please correct me

[This message has been edited by James Du (edited March 26, 2001).]
 
cameron weirs
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi!
Java achieves platform independency through the use of byte codes
which are as well a instruction for a virtual machine as your machine code is for a particular machine.so, now as there are wide variety of machines in the market place so there machine code instructions also differ thats why u need different compilers for different platforms.Now as java compiler which is again a platform specific compiles youyr source code into byte codes (and not machine code) so this is now a instruction set for any java virtual machine (which is again platform dependent).
so as u see the level where byte code stands it stands platform independent.
i hope this makes some sense..
--cameron
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!