• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Platform Independent

 
Greenhorn
Posts: 6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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 .?
 
Ranch Hand
Posts: 782
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I think this was already answered in another forum.
 
mister krabs
Posts: 13974
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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?
 
Ranch Hand
Posts: 186
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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).]
 
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
reply
    Bookmark Topic Watch Topic
  • New Topic