This week's book giveaway is in the Servlets forum.
We're giving away four copies of Murach's Java Servlets and JSP and have Joel Murach on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Platform independent Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Platform independent" Watch "Platform independent" New topic
Author

Platform independent

Prash Singh
Ranch Hand

Joined: Aug 23, 2009
Posts: 103

Dear all,
please tell me what is the difference betweem portability and platform independecy.


Thanks in advance
Janeice DelVecchio
Saloon Keeper

Joined: Sep 14, 2009
Posts: 1659
    
  11

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


When you do things right, people won't be sure you've done anything at all.
Prash Singh
Ranch Hand

Joined: Aug 23, 2009
Posts: 103

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

Joined: Sep 14, 2009
Posts: 1659
    
  11

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

Joined: Aug 23, 2009
Posts: 103

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

Joined: Sep 14, 2009
Posts: 1659
    
  11

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

Joined: Aug 23, 2009
Posts: 103

Thanks Janeice


I got it.
s.palanivel rajan
Ranch Hand

Joined: Sep 22, 2009
Posts: 40
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..


With Regards,
S.Palanivel Rajan B.E.
Rahul P Kumar
Ranch Hand

Joined: Sep 26, 2009
Posts: 188
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

Joined: Sep 18, 2009
Posts: 15
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.


Check out my blog on software development: http://www.turnleafdesign.com
 
wood burning stoves
 
subject: Platform independent
 
Similar Threads
File Seprator
What's the pixel size of SMALL Font?
Help with a program
swing
How to log System.out.println in iplanet ?