Computer Science
Java Virtual Machine
Java Virtual Machine (JVM) is a software that provides a runtime environment for Java programs to run on any platform. It interprets the compiled Java code and executes it on the host machine. JVM also manages memory, garbage collection, and security for Java applications.
Written by Perlego with AI-assistance
Related key terms
1 of 5
11 Key excerpts on "Java Virtual Machine"
- No longer available |Learn more
Introduction to Programming
Learn to program in Java with data structures, algorithms, and logic
- Nick Samoylov(Author)
- 2018(Publication Date)
- Packt Publishing(Publisher)
class loader ) bytecodes, transforms the instructions into binary code (instructions in a format a particular computer microprocessor, where JVM is running, understands), and passes the result to the CPU, a microprocessor that executes it.A class is a file (with the extension .class) produced by the Java compiler (from the source code in a file with the same name and the extension .java). There are more than a dozen JVM implementations, created by different companies, but we will be focusing on Oracle JVM's implementation, which is called HotSpot . In Chapter 11 , JVM Processes and Garbage Collection , we will look more closely at JVM's functionality, architecture, and processes.On the same page as the Java Language Specification (https://docs.oracle.com/javase/specs ), you can find the Java Virtual Machine Specification. We recommend that you use it as a source of references for the terminology and for the understanding of JVM functionality.JDK is a collection of software tools and supporting libraries that allow for the creation and execution of Java language programs.Since Java 9, applets (components that can be executed in a browser) are not supported anymore, so we will not talk much about them. An application is a Java program that can be (after compilation) executed on a computer where JVM is installed. So, JDK includes at minimum a compiler, JVM, and Java Class Library (JCL)—a collection of ready-to-use procedures that can be called by an application. But in reality, it has many other tools and utilities that can help you to compile, execute, and monitor a Java application. The subset of JDK that includes JVM, JCL, class loader, and supporting files allows the execution (running) of bytecode. Such a combination is called the Java Runtime Environment (JRE - No longer available |Learn more
- Vincent van der Leun(Author)
- 2017(Publication Date)
- Packt Publishing(Publisher)
Java Virtual Machine
Java Virtual Machine (JVM ) is a modern platform on which you can develop and deploy software. As the name implies, it was originally created to power applications written in the Java language. However, it didn't take language designers long to realize that they could not only run their languages on JVM, but also take advantage of its features and extensive class library.Sun Microsystems released Java and the first JVM implementation in 1995. With its focus on Internet applications, Java quickly became popular. It was also designed from the ground up to run anywhere. Its initial goal was to run on set-top boxes, but when Sun Microsystems found out the market was not ready at that time yet, they decided to bring the platform to desktop computers as well. To make all those use cases possible, Sun invented their own binary executable format and called it Java bytecode. To run programs compiled to Java bytecode, a JVM implementation must be installed on the system.This book will help you get started with five most popular languages that target JVM. By learning the language fundamentals and writing code yourself, you will be able to find the language that best suits you, your team, and your projects.Before we dive into the Java Development Kit (JDK ) and Java Class Library in the next chapter, we will look at some practical points first. With so many competing programming languages and platforms available today, it makes sense to first take a detailed look at what JVM has to offer to developers. Therefore, we will cover the following topics:- Reasons for developing on JVM
- Popular use cases of JVM
- I ntroducing JVM concepts
- Java editions
- Other languages on JVM
Passage contains an image
JVM implementations
It's important to note that this book focuses on JVM implementations compatible with Oracle's Java SE (Standard Edition) - No longer available |Learn more
- (Author)
- 2014(Publication Date)
- Learning Press(Publisher)
As of September 2009, the current version of the Java Platform is specified as either 1.6.0 or 6 (both refer to the same version). Version 6 is the product version, while 1.6.0 is the developer version. The Java Platform consists of several programs, each of which provides a distinct portion of its overall capabilities. For example, the Java compiler, which converts Java source code into Java bytecode (an intermediate language for the Java Virtual Machine (JVM)), ____________________ WORLD TECHNOLOGIES ____________________ is provided as part of the Java Development Kit (JDK). The Java Runtime Environment (JRE), complementing the JVM with a just-in-time (JIT) compiler, converts intermediate bytecode into native machine code on the fly. Also supplied are extensive libraries, pre-compiled in which are several other components, some available only in certain editions. The essential components in the platform are the Java language compiler, the libraries, and the runtime environment in which Java intermediate bytecode executes according to the rules laid out in the virtual machine specification. Java Platform diagram from Sun Java Virtual Machine 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 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. - eBook - PDF
- John C. Mitchell(Author)
- 2002(Publication Date)
- Cambridge University Press(Publisher)
13.4 JAVA SYSTEM ARCHITECTURE 13.4.1 Java Virtual Machine There are several implementations of Java. This section discusses the implementa-tion architecture used in the Sun Java compiler and the JVM. The biggest difference between this architecture and some others is that some optimized implementations generate native code for the underlying hardware instead of interpreted code. How-ever, because the “just-in-time” or (JIT), compilers that generate native code on the fly are significantly more complicated than the standard JVM architecture, we use the JVM architecture as the basis for our discussion and analysis of Java implementation issues. The Java compiler produces a form of machine code called bytecode . The origin of the name bytecode, which is a standard term that predates Java, is that bytecodes are instructions for a virtual machine that may be 1 byte long. Many compilers for high-level languages actually produce bytecode instead of native machine code. For example, the influential UCSD Pascal compiler produces a form of bytecode called P-code, which is then interpreted by a virtual machine. Common ML and Smalltalk implementations also generate virtual machine bytecode. Figure 13.4 shows the main parts of the JVM and some of the steps involved in compiling and executing Java source code. The main parts of the JVM are the class loader, the bytecode verifier, the linker, and the bytecode interpreter. The top of Figure 13.4 shows a Java source code file A.java compiled to produce a class file A.class . The class file is in a specific format, containing bytecode instructions and some auxiliary data structures, including a symbol table called a constant pool . The class loader reads the class file and arranges the bytecode instructions in a form suitable for the verifier. The Java bytecode language contains type information, allowing the verifier to check that bytecode is type correct before it is executed by the virtual machine. - Xiao-Feng Li(Author)
- 2016(Publication Date)
- CRC Press(Publisher)
It requires huge efforts to implement a complete Java platform, especially the abundant class libraries, whereas it is relatively easy to implement a JVM. To the knowledge of the author, there are dozens of claimed JVM implementations, whereas there have been only three independent Java class library implementations: OpenJDK, GNU Classpath, and Apache Harmony. To date, OpenJDK library implementation is probably the only actively maintained Java library.Although the code bases can be completely different for different implementations of JVM, the technologies used can be similar between them because of the active communications in the community, including academia and industry.Passage contains an image
CHAPTER 2Inside of a Virtual MachineA FULL LANGUAGE IMPLEMENTATION USUALLY includes no less than three major parts: the virtual machine, the language libraries, and the tool set.Unless the language is of a very low level and is primitive such as assembly language for a specific processor, a common language implementation usually includes the core libraries of the language as part of the virtual machine. Sometimes the virtual machine has to hard-code certain logics that only work with the associated libraries. For example, a Java Virtual Machine (JVM) cannot live without the library package of java.lang, because some of the core data structures such as Java object and Java class rely on the definitions in packages java.lang.Object, java.lang.Class , and so on.To enable program development with a language, a tool set for the language is usually needed that works with the virtual machine to support debugging, profiling, packaging, and so on.The libraries and tool set have very different design considerations and require different expertise from virtual machine design. This book does not cover these two parts, but only discusses the virtual machine.2.1 CORE COMPONENTS OF VIRTUAL MACHINEVirtual machine implementations for the same language can vary dramatically in every aspect. But all of them must follow and support the same language specification; therefore, a set of core components are usually mandatory for every implementation.- eBook - ePub
- Nick Samoylov(Author)
- 2022(Publication Date)
- Packt Publishing(Publisher)
It only knows how to read bytecode. It reads the bytecode and other information from.class files, transforms (interprets) the bytecode into a sequence of binary code instructions that are specific to the current platform (where JVM is running), and passes the resulting binary code to the microprocessor that executes it. When talking about this transformation, programmers often refer to it as a Java process or just process. The JVM is often referred to as a JVM instance. This is because every time a java command is executed, a new instance of JVM is launched that’s dedicated to running the particular application as a separate process with its own allocated memory (the size of the memory is set as a default value or passed in as a command option). Inside this Java process, multiple threads are running, each with its own allocated memory. Some are service threads that are created by the JVM; others are application threads that are created and controlled by the application. That is the big picture of the JVM executing the compiled code. But if you look closer and read the JVM specification, you will discover that the word process, concerning the JVM, is used to describe the JVM internal processes too. The JVM specification identifies several other processes running inside the JVM that are usually not mentioned by programmers, except maybe the class loading process. This is because most of the time, we can successfully write and execute Java programs without knowing anything about the internal JVM processes. But once in a while, some general understanding of the JVM’s internal workings helps us identify the root cause of certain issues. That is why in this section, we will provide a short overview of all the processes that happen inside the JVM - No longer available |Learn more
Learn Java 12 Programming
A step-by-step guide to learning essential concepts in Java SE 10, 11, and 12
- Nick Samoylov(Author)
- 2019(Publication Date)
- Packt Publishing(Publisher)
JVM Structure and Garbage Collection
This chapter provides readers with an overview ofJava Virtual Machine (JVM ) structure and behavior, which are more complex than you might expect.A JVM is just an executor of instructions according to the coded logic. It also finds and loads into the memory the .class files requested by the application, verifies them, interprets the bytecodes (that is, it translates them into platform-specific binary code), and passes the resulting binary code to the central processor (or processors) for execution. It uses several service threads in addition to the application threads. One of the service threads, called garbage collection (GC ), performs an important mission of releasing the memory from unused objects.After reading this chapter, readers will better understand what constitutes Java application execution, Java processes inside JVM, GC, and how JVM works in general. The following topics will be covered in this chapter:- Java application execution
- Java processes
- JVM structure
- Garbage collection
Passage contains an image
Java application execution
Before getting deeper into how the JVM works, let's review how to run an application, bearing in mind that the following statements are used as synonyms:- Run/execute/start the main class
- Run/execute/start the main method
- Run/execute/start/launch an application
- Run/execute/start/launch JVM or a Java process
There are also several ways to do it. In Chapter 1 , Getting Started with Java 12 , we showed you how to run the main(String[]) method using IntelliJ IDEA. In this chapter, we will just repeat some of what has been said already and add other variations that might be helpful for you.Passage contains an image
Using an IDE
Any IDE allows for running the main() method. In IntelliJ IDEA, it can be done in three ways: - eBook - PDF
Architectures for E-Business Systems
Building the Foundation for Tomorrow's Success
- Sanjiv Purba(Author)
- 2001(Publication Date)
- Auerbach Publications(Publisher)
711 0-8493-1161-6/02/$0.00+$1.50 © 2002 by CRC Press LLC Chapter 54 Improving Performance in New Programming Environments: Java Paul J. Jalics Donald Golden Java is an effort by Sun Microsystems to bring the 30+-year-old C language into the next century by cleaning it thoroughly of all its sloppiness — including most of the object-oriented (OOP) features of C++ — and pro-viding it with the built-in functionality needed today, which is so sorely missing in most older languages. The most striking feature of Java programs is that they are executed with the help of a software component called the Java Virtual Machine (JVM), which executes Java machine instructions that are defined as part of the Java language. Thus, when a Java source program prog1.java is compiled, the compiler generates a prog1.class file that contains only JVM machine instructions. To execute the Java program, one calls upon the JVM interpreter. Sun’s compiler is named javac, and its JVM interpreter is named java. Thus, to compile and execute prog1, one might type javac prog1.java, which generates prog1.class, which is then executed by typing java prog1. Java executables (.class files) are totally portable from any architecture computer to any other, and from any operating system to any other. This is one reason that most Internet browsers have the JVM implemented so that sophisticated actions can be implemented by downloaded Java .class 712 SOLUTION PERFORMANCE AND SECURITY files. The JVM checks each class file before loading it for execution to make sure that it is well behaved and obeys the basic rules of the Java language. Hopefully, the security features of Java will be found sufficient to prevent downloaded class files from doing damage to the machines running the Java-enabled Internet browsers. There is another twist in Java code management: some JVMs include a “just-in-time” compilation feature. - eBook - ePub
- J.K. Petersen(Author)
- 2018(Publication Date)
- CRC Press(Publisher)
Java Virtual Machine JVM. Software routines for interpreting Java bytecodes into machine code. This interpretation/conversion process makes it possible to run Java applications on many different platforms. Each computer hardware architecture has a different way of interpreting programming instructions, based on the central processing unit and its support systems. If you have a software program running indirectly within a virtual environment instead of directly on the host platform, a way to convert the program instructions to those expected by the host processor is needed. The JVM enables Java portability across many different systems. See Java.Java XML, JXML An area of development and a mailing list devoted to Java and XML, particularly Java Class and Bean metadata expressed as CML documents, conversion of metadata to bytecodes, reversible conversion of Java Object Streams to XML documents, and other related issues.JavaBeans A Sun Microsystems Java language object-oriented, platform-independent security model included in JDK. See Java.JavaScript A cross-platform, scripted, open standard programming language familiar to most through the implementation incorporated into Netscape Web browsers. It is only superficially similar to Java, being slower and having a simpler syntax and limited functionality.JavaServer Pages JSP. An industry collaboration project lead by Sun Microsystems to enable Web developers to develop and maintain dynamic Web pages for integration with existing business systems. JSP enables the development of platform-independent Web-based applications. It separates the user interface from the content generation so that changes in layout don’t change the underlying content. JSP uses XML-style tags and scripts written in Java. Formatting tags (HTML or XML) are passed back to the response page. JSP is an extension of the Java Servlet technology, platform-independent Java server-side modules that fit into a Web server framework to extend the capabilities of the server with minimal overhead. JSP specifications are freely available to the development community so that Web servers and applications servers can be JSP-enabled. See Java.JavaTel - eBook - PDF
Java Programming Fundamentals
Problem Solving Through Object Oriented Analysis and Design
- Premchand S. Nair(Author)
- 2008(Publication Date)
- CRC Press(Publisher)
However, an interpreter does not keep a machine language equivalent of a source program in a file and as such interpretation takes place each time you execute the program. The programming language LISP used an interpreter. A program written in a high-level language is known as a source program or source code . The file containing a source program is called a source file . A source file is a plain text file and can be created using any text editor that can create a plain text fi le. With the introduction of compilers and interpreters, a source program no longer needs to be 8 ■ Java Programming Fundamentals written for a specific machine. For example, once you write a certain program in C++, all that is required to execute it in different machines is to compile the source program on the machine of your choice. This seemed like a perfect solution. Once Internet became popular, it was necessary to execute the same program on differ-ent machines without compiling on each one of those machines. This need resulted in the introduction of the concept of a virtual machine . Designers of Java introduced a common symbolic language called bytecode . The virtual machine that can understand the byte-code is termed as Java Virtual Machine ( JVM ). Thus, it became possible to compile a Java source program into bytecode and execute it on any machine that has JVM without com-piling again. JVM performs the enormous task of interpreting the bytecode into equivalent machine language instruction. Thus, Java language introduced the concept of platform independence to the world of computing. Self-Check 9. The Java program you write is an example of code. 10. A Java compiler translates a source program into its equivalent . CREATING AND EXECUTING JAVA PROGRAM There are two types of Java programs: applications and applets. In this book you will be intro-duced to application programs first. - eBook - PDF
- Chung Kwong Yuen(Author)
- 2000(Publication Date)
- WSPC(Publisher)
The loading and execution of applications are transparent to the volunteers. • Heterogeneity and Portability. Section 3.4. Project JAVM 65 The assumption that machines participating in a computation in a COW (Cluster of Workstations) setup are of homogeneous platform is no longer valid in the Internet environment. The Internet is a collection of machines of heterogeneous platforms and architectures. It will be uphill task for the programmer to write codes for different systems and distribute the compiled binaries to the systems. JAVM is developed entirely in Java. Hence, the portability of JAVM in the heterogeneous environment of Internet will never be an issue. • Security. This involves two aspects. Firstly, from the volunteer's perspective, by con-tributing his machine in a computation, he must have the assurance that it will be protected against malicious attacks (e.g. virus attack). In a COW setup, this can be enforced easily by maintaining users access rights and accounts, so that the network is available only to trusted users. In JAVM, with Java's tight security model, protection of volunteers' machines can be enforced. The second aspect involves computational security. Besides protecting volun-teers, the environment must also ensure that the computation itself is secure from malicious attacks from volunteers. One such attack could be the in-tentional submissions of erroneous results by volunteers that could render the entire computation worthless. Preventing volunteers from spying on computa-tions, which may be confidential, is also another concern. In JAVM, enforcing secure computations is a prime concern. To achieve this, we implement cryp-tographic and authentication mechanisms for network communications among machines in the system. • Fault Tolerance. An Internet-based computing environment is governed by the following char-acteristics: 1. Uncertain availability of machines. In the Internet, machines join and leave a computation at the whim of volunteers.
Index pages curate the most relevant extracts from our library of academic textbooks. They’ve been created using an in-house natural language model (NLM), each adding context and meaning to key research topics.










