• 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

Is Java Platform independent?

 
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Could any tell me whether JAVA is platform independent or not.Because as i know different JVM is required for different OS.Please answer me and justify.
 
Sheriff
Posts: 67747
173
Mac Mac OS X IntelliJ IDE jQuery TypeScript Java iOS
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Please be sure to use bold sparingly and for emphasis only -- not for entire posts.
 
Bartender
Posts: 2911
150
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well you are right,

let me put it in critic's words:

As long as a JVM is available for a platform X, Java will work on it.



There are JVMs for different platforms, but they do the same thing, they execute the same compiled program.
you dont compile your programs for every platform. The jvm is just the runner/executer/machine in which the compiled code executes independent of the platform.

In fact you should hear microsoft's defination of 'cross platform' meaning it works on any windows machine

I do believe that Java is platform independant. You dont write seperate code for Windows/Linux/Macintosh (unless you are using native API in which case, may God help you).
These are not the only platforms in which java is running. Think twice before touching your television set-top box/television remote/mobile phone and a ton of other stuff that you use in your daily life that runs on this language.
 
Umesh Vajpai
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

salvin francis wrote:Well you are right,

let me put it in critic's words:

As long as a JVM is available for a platform X, Java will work on it.



There are JVMs for different platforms, but they do the same thing, they execute the same compiled program.
you dont compile your programs for every platform. The jvm is just the runner/executer/machine in which the compiled code executes independent of the platform.

In fact you should hear microsoft's defination of 'cross platform' meaning it works on any windows machine

I do believe that Java is platform independant. You dont write seperate code for Windows/Linux/Macintosh (unless you are using native API in which case, may God help you).
These are not the only platforms in which java is running. Think twice before touching your television set-top box/television remote/mobile phone and a ton of other stuff that you use in your daily life that runs on this language.




Thanks salvin francis for your justification.
I am agreed with you totally.But what i meant for, If different JVM is required then how it could be platform independency.As far as i know Platform independent term is not for only byte code ,it is for whole java.
 
salvin francis
Bartender
Posts: 2911
150
Google Web Toolkit Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Umesh Vajpai wrote:As far as i know Platform independent term is not for only byte code ,it is for whole java.


Why do you believe that ?

Words from the Renowned book: Java, complete reference:

Somewhat surprisingly, the original impetus for Java was not the Internet! Instead, the primary; motivation was the need for a platform-independent (that is, architecture-neutral) language that could be used to create software to be embedded in various consumer electronic devices, such as microwave ovens and remote controls. As can probably guess, many different types of CPUs are used as controllers. The trouble with C and C++ (and most other languages) is designed to be compiling for a specific target. Although it is possible to compile a C++ program for just about any type of CPU, to do so requires a full C++ compiler targeted for that CPU. The problem is that compilers are expensive and time-consuming to create. An easier – and more cost-efficient-solution were needed. In an attempt to find such a solution, Gosling and others began work on a portable, platform-independent language that could be used to produce code that would run on variety of CPUs under differing environments. This effort ultimately led to the creation of Java.

 
Umesh Vajpai
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

salvin francis wrote:

Umesh Vajpai wrote:As far as i know Platform independent term is not for only byte code ,it is for whole java.


Why do you believe that ?

Words from the Renowned book: Java, complete reference:

Somewhat surprisingly, the original impetus for Java was not the Internet! Instead, the primary; motivation was the need for a platform-independent (that is, architecture-neutral) language that could be used to create software to be embedded in various consumer electronic devices, such as microwave ovens and remote controls. As can probably guess, many different types of CPUs are used as controllers. The trouble with C and C++ (and most other languages) is designed to be compiling for a specific target. Although it is possible to compile a C++ program for just about any type of CPU, to do so requires a full C++ compiler targeted for that CPU. The problem is that compilers are expensive and time-consuming to create. An easier – and more cost-efficient-solution were needed. In an attempt to find such a solution, Gosling and others began work on a portable, platform-independent language that could be used to produce code that would run on variety of CPUs under differing environments. This effort ultimately led to the creation of Java.









Hi Salvin Francis,

Please focus on these lines"Although it is possible to compile a C++ program for just about any type of CPU, to do so requires a full C++ compiler targeted for that CPU".As such we need full JVM for other OS also.I am not getting .Please clear it.
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Umesh Vajpai wrote:If different JVM is required then how it could be platform independency.As far as i know Platform independent term is not for only byte code ,it is for whole java.


"Platform independent" in the way that you mean here is impossible. Different operating systems work differently. It's not possible to write one JVM that works on any operating system.

The point with Java being platform independent is with programs that you write yourself in Java: you don't need to change them or even recompile them to make them work on other operating systems. The JVM is the thing that provides platform independency for your own Java programs.
 
Umesh Vajpai
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks Jesper Young.
 
lowercase baba
Posts: 13089
67
Chrome Java Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
This topic has been debated here before. Before you can decide if java is 'platform independent' or not, you have to define EXACTLY what you mean by "platform independent". Otherwise, any debate is pointless.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic