• Post Reply Bookmark Topic Watch Topic
  • New Topic

Is Java Platform independent?  RSS feed

 
Umesh Vajpai
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • 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.
 
Bear Bibeault
Author and ninkuma
Marshal
Posts: 66304
152
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Please be sure to use bold sparingly and for emphasis only -- not for entire posts.
 
salvin francis
Bartender
Posts: 1649
37
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • 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
  • 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: 1649
37
Eclipse IDE Google Web Toolkit Java
  • Mark post as helpful
  • send pies
  • 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
  • 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.
 
Jesper de Jong
Java Cowboy
Sheriff
Posts: 16057
88
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Thanks Jesper Young.
 
fred rosenberger
lowercase baba
Bartender
Posts: 12563
49
Chrome Java Linux
  • Mark post as helpful
  • send pies
  • 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.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!