1. Computer problem? Tech Support Guy is completely free -- paid for by advertisers and donations. Click here to join today! If you're new to Tech Support Guy, we highly recommend that you visit our Guide for New Members.

Java code can be executed on any major platform?

Discussion in 'Software Development' started by ImDatingJava, Jul 30, 2012.

Thread Status:
Not open for further replies.
Advertisement
  1. ImDatingJava

    ImDatingJava Banned Thread Starter

    Joined:
    Jul 30, 2012
    Messages:
    17
    For example, say writing Java code from a Java IDE on Ubuntu, will it work?

    I'm installing Ubuntu, and I know C++ can be compiled and run on its API, text-based or graphical, but Java is different.
     
  2. Ent

    Ent Josiah Trusted Advisor

    Joined:
    Apr 11, 2009
    Messages:
    5,408
    Java runs in what is called a virtual machine. That means that you'll install Java onto your computer, and Java then executes the code in the java program you want to run. If you have the appropriate version of the virtual machine on your computer, you can run a Java program irrespective of what platform you're using or platform it was compiled on.
    If you don't have the virtual machine, or if you have an older version, you cannot run a Java program.

    So the answer to your question is yes, but only if you have the right version of the VM installed.
     
  3. ruchiwebsol

    ruchiwebsol

    Joined:
    Aug 2, 2012
    Messages:
    2
    An edition of the Java platform is the name for a bundle of related programs from Sun that allow for developing and running programs written in the Java programming language. The platform is not specific to any one processor or operating system, but rather an execution engine (called a virtual machine) and a compiler with a set of libraries that are implemented for various hardware and operating systems so that Java programs can run identically on all of them.
     
  4. ruchiwebsol

    ruchiwebsol

    Joined:
    Aug 2, 2012
    Messages:
    2
    The heart of the Java platform is the concept of a "virtual machine" that executes Java bytecode programs. This bytecode is the same no matter what hardware or operating system the program is running under. There is a JIT(Just In Time) compiler within the Java Virtual Machine, or JVM. The JIT compiler translates the Java bytecode into native processor instructions at run-time and caches the native code in memory during execution.
    The use of bytecode as an intermediate language permits Java programs to run on any platform that has a virtual machine available. The use of a JIT compiler means that Java applications, after a short delay during loading and once they have "warmed up" by being all or mostly JIT-compiled, tend to run about as fast as native programs.[citation needed] Since JRE version 1.2, Sun's JVM implementation has included a just-in-time compiler instead of an interpreter.
    Although Java programs are cross-platform or platform independent, the code of the Java Virtual Machines (JVM) that execute these programs is not. Every supported operating platform has its own JVM
     
  5. ImDatingJava

    ImDatingJava Banned Thread Starter

    Joined:
    Jul 30, 2012
    Messages:
    17
    Yeah, thanks everyone.

    I am learning Java now and I know about its JIT compiler and the Java Virtual Machine pretty well.

    Thanks again.
     
  6. Sponsor

As Seen On
As Seen On...

Welcome to Tech Support Guy!

Are you looking for the solution to your computer problem? Join our site today to ask your question. This site is completely free -- paid for by advertisers and donations.

If you're not already familiar with forums, watch our Welcome Guide to get started.

Join over 733,556 other people just like you!

Loading...
Thread Status:
Not open for further replies.

Short URL to this thread: https://techguy.org/1063182