• 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
  • Paul Clapham
  • Tim Cooke
  • Jeanne Boyarsky
  • Liutauras Vilda
Sheriffs:
  • Frank Carver
  • Henry Wong
  • Ron McLeod
Saloon Keepers:
  • Tim Moores
  • Frits Walraven
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Himai Minh

java platform independent ?

 
Greenhorn
Posts: 27
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
is java is platform inde. ? for all OS or only for whose which information is in its JVM.
 
author
Posts: 4323
39
jQuery Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
The software is written and compiled for a JVM that takes its own platform independent bitcode, so there's nothing that intrinsically ties a particular class file to a particular machine.

That said, the software used to create the JVM is platform dependent. It handles the conversion from the JVM to the actual machine. Therefore, java is platform independent assuming someone has implemented JVM software for every platform, and on most platforms this is true.
 
High Plains Drifter
Posts: 7289
Netbeans IDE VI Editor
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You're asking about several aspects at the same time.

The language spec itself is in fact platform-independent. That is, there is no aspect of the language itself which relies on, or ties the model to, any machine platform. Consider for example the use of a sizeof operator in C/C++, which shows that in order to compile the program code itself must know certain properties of the CPU. The core Java language has no dependencies of this sort, and the bytecode produced will run, with some notable exceptions, on any platform.

Any platform, that is, that has a JVM available. In this respect, Java isn't radically different from any other language that requires a platform-dependent interpreter (ksh, Perl, Python, etc.). It is different from C/C++, though, in which code that is compiled to run on one platform will not run on another. You have to compile C/C++ on a per-platform basis. Since the compiler creates an executable object that knows how to run on the platform at hand, a separate interpreter is unnecessary.
 
Ranch Hand
Posts: 18944
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
One can even generate the on-the-JVM-executable-byte_code manually without using any compiler. It is the JVM on that platform (OS AND Processor-CPU) actually, that transforms it to the hardware level.
So JYM is sort of an emulator, which is written for that platform (OS + CPU).
 
Ranch Hand
Posts: 3640
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
In short, Java will run on all platforms that have JVM.

Do we have JVM for any version of DOS?
[ December 27, 2005: Message edited by: Chetan Parekh ]
 
Ranch Hand
Posts: 47
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To put it bluntly. Java IS the platform.

Your Java programs will only work if they're written for the platforms they're written for.
 
Won't you please? Please won't you be my neighbor? - Fred Rogers. Tiny ad:
the value of filler advertising in 2021
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic