• 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
  • Tim Cooke
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

What doew JVM bring to the table - portability only?

 
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Bartender
Posts: 2662
19
Netbeans IDE C++ Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

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

Why was Java created?
 
Ranch Hand
Posts: 457
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are many reasons for architecting it in that manner.

One is to provide the ability to securely sandbox code.
 
Ranch Hand
Posts: 1296
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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 ]
 
Ganesh Hegde
Greenhorn
Posts: 12
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Ranchers,

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

Warm regards,

Gaura
 
Get me the mayor's office! I need to tell her about this tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic