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

J V M exposed ?

 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
hi frens ...
i m a novice in java.. just beginning on a java tour. i hav learnt tht java is platform independent .Thus once i write a program i shd b able to run it on ny machine(irrespective of the OS )nd get the same output . This is made possible thr JVM -java virtual machine .
wat i need to know is IS JVM PLATFORM INDEPENDENT ?if nt then is it guranteed tht diff JVM's will give the same output on running the same bytecode ?
thanx in advance 4 nyone who could help me answer the above Qs ..
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi, Tom, welcome to the ranch! You'll get a lot better results around here with full English instead of, um, whatever phone messaging shorthand that was.

Are JVM's guaranteed to give the same results? Like "or your money back"? They certainly strive to give you the same results for portable code and a vendor might even promise it in advertising but "guarantee" is a very strong word.

There are platform-specific differences like how they mark newlines in text files, whether you use drive letters, forward slashes and back slashes. It is definitely possible to write code that will not port between Windows, Unix, Apple and your phone. But it is largely possible to write code that ports pretty darned well.
 
Ranch Hand
Posts: 5093
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Also, some of these differences are more obscure than coding system specific paths and filenames into your application.
There are for example differences in the way platforms handle multithreaded applications which MAY lead to your application behaving differently on different platforms. Usually this isn't a problem if you just remember some rules (with multithreading basically the rule is that nothing is guaranteed about the order in which threads are run for example) but things like that can bite you if you're not careful.

The JVM itself can do little about most of those things, they're down to the OS and hardware it runs on.

Of course there's always the possibility for bugs in a particular JVM causing inconsistent output, but that's of course out of the scope of a discussion like this.
 
I found a beautiful pie. And a tiny ad:
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic