• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Platform independent

 
Prash Singh
Ranch Hand
Posts: 103
jQuery Netbeans IDE Notepad
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear all,
please tell me what is the difference betweem portability and platform independecy.


Thanks in advance
 
Janeice DelVecchio
Saloon Keeper
Posts: 1809
12
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Do you know the meaning of each of these terms?

Portable

Platform

......

If you know what a platform is, then I could tell you that being platform independent implies (on some level) portability.... that is a similarity.

Am I helping?

Janeice

 
Prash Singh
Ranch Hand
Posts: 103
jQuery Netbeans IDE Notepad
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Janeice DelVecchio,

Thanks for your reply.
I am really not sure about it.
Please explain me these terms.

and please answer this also,

Is C is paltform independent or portable??

Thanks is Advance
 
Janeice DelVecchio
Saloon Keeper
Posts: 1809
12
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Portable - to be able to take something with you
Platform - the machine or OS a program is run on -- like a PC or a MAC..... you could even consider a video game console a platform (XBox, Wii, etc)

Java is considered platform independent because the applications can be compiled on any platform (PC, MAC, Linux, etc) and run on any other platform... you see the Java Virtual Machine is like an interpreter that translates Java code for whatever platform it's installed on. Other examples of platform-independent languages are web languages like JavaScript.... the browser becomes the interpreter for the code (and unlike Java it has no need for compiling).

The point of the situation is, just because something is portable, doesn't mean it's platform independent. You can take your C or C++ code with you, but unless you bring it somewhere where you're on the same platform it was compiled on, you have no way to run it.

Janeice
 
Prash Singh
Ranch Hand
Posts: 103
jQuery Netbeans IDE Notepad
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Dear Janeice DelVecchio

Thanks for clearing my doubt.
Now i really understood it.

But still there is something.
Does by machine you mean which processor is being used?


Thanks in Advance.
 
Janeice DelVecchio
Saloon Keeper
Posts: 1809
12
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Prash Singh wrote:
But still there is something.
Does by machine you mean which processor is being used?


Thanks in Advance.


Ahhhh..... I have always (in theory) taken "machine" to be a little of both. PC and Linux are 2 separate platforms, but they can be run on the same physical hardware. PC or MAC have different languages, but if you run a "Virtual machine" you can run the other's platform on the same hardware.

I think the real life application of platform is the Operating System.

I think the real life application of machine is the hardware.

A "virtual machine" is an interpreter for the platform so it can understand languages from other platforms/hardware. In essence, it's software that does what hardware and/or the platform can't (or might not be able to).

--Janeice
 
Prash Singh
Ranch Hand
Posts: 103
jQuery Netbeans IDE Notepad
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks Janeice


I got it.
 
s.palanivel rajan
Ranch Hand
Posts: 41
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
its simple ya...

portability is nothing but we can create our java program and compile it in any operaring system..
and by using that class file which was created we can run it in any operating system..
this is done by the magic of java virtual machine..
 
Rahul P Kumar
Ranch Hand
Posts: 188
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
s.palanivel rajan wrote:its simple ya...

portability is nothing but we can create our java program and compile it in any operaring system..


you do not take your java program around and compile each time on machine of your choice. That is against the spirit of platform independence. You compile a java file on a machine. That generates a byte code (class file). Now that byte code can be taken around and to run on any machine it needs machine dependent runtime environment. (yeah , you saw it write, machine dependent JRE). Independency comes in terms of leveraging once compiled byte code.

 
Billy Korando
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Java is considered a portable/platform independent language because of the Java virtual machine. Many languages interact directly with the OS. Since not all OSs are developed in the same way a program must be recompiled and occasionally reworked to work properly with each OS (for example Windows may have certain functions a Linux distro may not have a vice versa). To make development easier Sun developed the JVM which is a layer that sits on top of the OS layer with which Java programs interact. So Java developers develop programs to run against the specs and capabilities of the JVM they are planning to run their program on, not the OS. To put it another way, the JVM is like a Rosetta stone, it translates what your Java program is trying to do into a language the OS can understand.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic