Results 1 to 5 of 5
  1. #1
    Drew345 is offline Member
    Join Date
    May 2015
    Posts
    31
    Rep Power
    0

    Default Java Portability Questions

    I have a fundamental question about Java and understanding its importance. One of the key benefits of Java is that java programs are portable and platform independent.

    I understand that it is difficult to run C++ on various platforms because a compiler would need to be developed for each Platform (CPU).
    Java overcomes this problem by using a JVM (Java virtual machine). The Java compiler outputs bytecode,
    and the Bytecode is run by the JVM (Java virtual machine).

    My questions are:
    Doesn’t that mean that a JVM has to be developed for every type of platform?
    Does that mean that developing a JVM for every platform is significantly easier that developing a compiler for each platform (as would have to be done for C++)? Any brief explanation why?

    Thanks
    Drew

  2. #2
    Artemia is offline Member
    Join Date
    May 2015
    Location
    Netherlands
    Posts
    39
    Rep Power
    0

    Default Re: Java Portability Questions

    I'm not exactly an expert on jvm, I'm actually pretty much still a noob with the java langauge xD
    BUT having a virtual machine like java is probably something that is incorporated in the entire java system not something you can simply add to a language to make it much useful on multiple OS's

    though I'm pretty sure that yes, they did have to develop a JVM for every platform but they only have to do that once and then every java application works

  3. #3
    JosAH's Avatar
    JosAH is offline Moderator
    Join Date
    Sep 2008
    Location
    Voorschoten, the Netherlands
    Posts
    14,422
    Blog Entries
    7
    Rep Power
    28

    Default Re: Java Portability Questions

    Also, don't forget that quite a big portion of the JVM itself is written in Java so there's no need to port that part to all the different architectures. The tools (javac, jar etc.) are also written in Java.

    kind regards,

    Jos
    Build a wall around Donald Trump; I'll pay for it.

  4. #4
    Drew345 is offline Member
    Join Date
    May 2015
    Posts
    31
    Rep Power
    0

    Default Re: Java Portability Questions

    I am just curious because the Oracle Java intro material makes a point that with Java you don't have to have a compiler with each platform (like you would with C++), you just need a JVM for each platform. So I wonder, why is that easier? More secure, certainly, but why easier? It's more a question of Computer science theory I guess, but still curious.

    Thanks!

  5. #5
    jim829 is offline Senior Member
    Join Date
    Jan 2013
    Location
    Northern Virginia, United States
    Posts
    6,226
    Rep Power
    14

    Default Re: Java Portability Questions

    Quote Originally Posted by Drew345 View Post
    I am just curious because the Oracle Java intro material makes a point that with Java you don't have to have a compiler with each platform (like you would with C++), you just need a JVM for each platform. So I wonder, why is that easier? More secure, certainly, but why easier? It's more a question of Computer science theory I guess, but still curious.

    Thanks!
    Let's assume you have a program written in C++. And now you find a bug. And that program runs on Windows, Linux, Unix, IBM machines, etc. So each time you fix a bug, you need to provide a binary version that runs on each of those architectures. If you wrote the program in Java, you just need to maintain a single "binary." The one that is compiled to Java byte code and runs on the JVM. So it is much easier to maintain and support a single program among multiple different architectures.

    Regards,
    Jim
    The JavaTM Tutorials | SSCCE | Java Naming Conventions
    Poor planning on your part does not constitute an emergency on my part

Similar Threads

  1. Need help with Java questions
    By jganer in forum New To Java
    Replies: 1
    Last Post: 11-27-2013, 08:39 PM
  2. Replies: 2
    Last Post: 06-12-2013, 01:54 PM
  3. New to Java, Few Questions
    By Unorthadox in forum New To Java
    Replies: 9
    Last Post: 08-06-2012, 10:31 PM
  4. Some Java questions
    By vegetable69 in forum New To Java
    Replies: 1
    Last Post: 11-29-2010, 12:47 PM
  5. Pls i need help with these 2 Java Questions
    By jyde in forum New To Java
    Replies: 23
    Last Post: 11-11-2008, 05:23 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •