This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes What doew JVM bring to the table - portability only? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "What doew JVM bring to the table - portability only?" Watch "What doew JVM bring to the table - portability only?" New topic
Author

What doew JVM bring to the table - portability only?

Ganesh Hegde
Greenhorn

Joined: Apr 09, 2008
Posts: 12
Here's what sparked off this question in me: Because the Java VM is available on many different operating systems, the same .class files are capable of running on Microsoft Windows, the Solaris TM Operating System (Solaris OS), Linux, or Mac OS. Some virtual machines, such as the Java HotSpot virtual machine, perform additional steps at runtime to give your application a performance boost. This include various tasks such as finding performance bottlenecks and recompiling (to native code) frequently used sections of code.
-The Java Tutorials

Well, my question is: Is this the sole reason why JVM was created - for making your programs portable? Can't we take the same approach without having a JVM? Why not have different compilers (that compile source code directly to machine code) for different platforms? (Of course, then we would be faced with two situations
1. we need to distribute the source code to the end users; could be a security issue - but we could encrypt the source code or restrict access to the source code except for compiling purpose.

2. the end users would need to recompile the source code - at least initially; this could delay program start up.)

I feel that the creation of the JVM was more a result of taking the 'seperation of concerns' approach than just to address the portability issue. I presume the designers of Java wanted to give the Java programmer a single interface by providing a compiler whose only job would be to compile the source code to an intermediate bytecode. And they encapsulated the task of making sense of the bytecode in the JVM. Shouldn't we also highlight this design strategy being the cause of the JVM apart from portability?
[ April 22, 2008: Message edited by: Gaura Hari ]

You die but your fame lives...
Jan Cumps
Bartender

Joined: Dec 20, 2006
Posts: 2491
    
    8

Well, my question is: Is this the sole reason why JVM was created - for making your programs portable?
Why was Java created?


OCUP UML fundamental and ITIL foundation
youtube channel
Bill Shirley
Ranch Hand

Joined: Nov 08, 2007
Posts: 457
There are many reasons for architecting it in that manner.

One is to provide the ability to securely sandbox code.


Bill Shirley - bshirley - frazerbilt.com
if (Posts < 30) you.read( JavaRanchFAQ);
Garrett Rowe
Ranch Hand

Joined: Jan 17, 2006
Posts: 1296
Besides all the things others have said, the fact that the JVM is essentially independent of the Java language means that any language that can be compiled to JVM bytecode can be run on the JVM.
[ April 22, 2008: Message edited by: Garrett Rowe ]

Some problems are so complex that you have to be highly intelligent and well informed just to be undecided about them. - Laurence J. Peter
Ganesh Hegde
Greenhorn

Joined: Apr 09, 2008
Posts: 12
Hi Ranchers,

Thanks to all of you for spending your time to think along.

Warm regards,

Gaura
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: What doew JVM bring to the table - portability only?
 
Similar Threads
JAVA INTERPRETER
Some Queries
Java Basics
What is byte code?
basic query