The Java Virtual Machine

Monday July 26 2010 8:29 am | Category : java application | Comments (2)

The Java Virtual Machine

The Java virtual machine is called “virtual” because it is an abstract computer defined by a specification. To run a Java program,
you need a concrete implementation of the abstract specification. This chapter describes primarily the abstract specification of the Java virtual machine.
To illustrate the abstract definition of certain features, however, this chapter also discusses various ways in which those features could be implemented.

What ‘s the Java Virtual Machine?

To understand the Java virtual machine you must first be aware that you may be talking about any of three different things
when you say “Java virtual machine.” You may be speaking of the abstract specification, a concrete implementation, or a runtime instance.

The abstract specification is a concept, described in detail in the book: The Java Virtual Machine Specification, by Tim Lindholm and Frank Yellin.
Concrete implementations, which exist on many platforms and come from many vendors, are either all software or a combination of hardware and software.
A runtime instance hosts a single running Java application.
Each Java application runs inside a runtime instance of some concrete implementation of the abstract specification of the Java virtual machine.
In this book, the term “Java virtual machine” is used in all three of these senses. Where the intended sense is not clear from the context,
one of the terms “specification,” “implementation,” or “instance” is added to the term “Java virtual machine”.

The lifetime of a Java Virtual Machine

A runtime instance of the Java virtual machine has a clear mission in life: to run one Java application.
When a Java application starts, a runtime instance is born. When the application completes, the instance dies.
If you start three Java applications at the same time, on the same computer, using the same concrete implementation,
you’ll get three Java virtual machine instances. Each Java application runs inside its own Java virtual machine.
A Java virtual machine instance starts running its solitary application by invoking the method of some initial class.
The method must be public, static, return , and accept one parameter.
Any class with such a method can be used as the starting point for a Java application.

For example, consider an application that prints out its command line arguments:

// On CD-ROM in file jvm/ex1/Echo.javaclass Echo
{ public static void main(String[] args)
{
int len = args.length;
for (int i = 0; i {
System.out.print(args[i] + ” “);
}
System.out.println();
}
}

You must in some implementation-dependent way give a Java virtual machine the name of the initial class that has the method that
will start the entire application. One real world example of a Java virtual machine implementation is the program from Sun’s Java 2 SDK.
If you wanted to run the application using Sun’s on Window98, for example, you would type in a command such as:
java Echo Greetings, Planet.

The first word in the command, indicates that the Java virtual machine from Sun’s Java 2 SDK should be run by the operating system.
The second word, is the name of the initial class.must have a public static method named that returns and takes a array as its only parameter.
The subsequent words, are the command line arguments for the application.
These are passed to the method in the array in the order in which they appear on the command line.
So, for the previous example, the contents of the array passed to main,
The method of an application’s initial class serves as the starting point for that application’s initial thread.
The initial thread can in turn fire off other threads.
Inside the Java virtual machine, threads come in two flavors: daemon and non- daemon.
A daemon thread is ordinarily a thread used by the virtual machine itself, such as a thread that performs garbage collection.
The application, however, can mark any threads it creates as daemon threads.
The initial thread of an application–the one that begins at –is a non- daemon thread.
A Java application continues to execute (the virtual machine instance continues to live) as long as any non-daemon threads are still running.
When all non-daemon threads of a Java application terminate, the virtual machine instance will exit.
If permitted by the security manager, the application can also cause its own demise by invoking the method of class or .
In the application previous, the method doesn’t invoke any other threads. After it prints out the command line arguments, returns.
This terminates the application’s only non-daemon thread, which causes the virtual machine instance to exit.

The Architecture of the Java Virtual Machine

In the Java virtual machine specification, the behavior of a virtual machine instance is described in terms of subsystems, memory areas, data types,
and instructions. These components describe an abstract inner architecture for the abstract Java virtual machine.
The purpose of these components is not so much to dictate an inner architecture for implementations.
It is more to provide a way to strictly define the external behavior of implementations.
The specification defines the required behavior of any Java virtual machine implementation in terms of these abstract components and their interactions.
When a Java virtual machine runs a program, it needs memory to store many things, including bytecodes and other information
it extracts from loaded class files, objects the program instantiates, parameters to methods, return values, local variables,
and intermediate results of computations. The Java virtual machine organizes the memory it needs to execute a program into several runtime data areas.
Although the same runtime data areas exist in some form in every Java virtual machine implementation,
their specification is quite abstract. Many decisions about the structural details of the runtime data areas are left to the
designers of individual implementations.
Different implementations of the virtual machine can have very different memory constraints.
Some implementations may have a lot of memory in which to work, others may have very little.
Some implementations may be able to take advantage of virtual memory, others may not.
The abstract nature of the specification of the runtime data areas helps make it easier to implement the Java virtual machine on a wide
variety of computers and devices.
Some runtime data areas are shared among all of an application’s threads and others are unique to individual threads.
Each instance of the Java virtual machine has one method area and one heap. These areas are shared by all threads running inside the virtual machine.
When the virtual machine loads a class file, it parses information about a type from the binary data contained in the class file.
It places this type information into the method area. As the program runs, the virtual machine places all objects the program instantiates onto the heap.
As each new thread comes into existence, it gets its own pc register (program counter) and Java stack.
If the thread is executing a Java method (not a native method), the value of the pc register indicates the next instruction to execute.
A thread’s Java stack stores the state of Java (not native) method invocations for the thread.
The state of a Java method invocation includes its local variables, the parameters with which it was invoked,
its return value (if any), and intermediate calculations. The state of native method invocations is stored in an implementation-dependent way
in native method stacks, as well as possibly in registers or other implementation-dependent memory areas.
The Java stack is composed of stack frames (or frames). A stack frame contains the state of one Java method invocation. When a thread invokes a method,
the Java virtual machine pushes a new frame onto that thread’s Java stack. When the method completes, the virtual machine pops and discards
the frame for that method.
The Java virtual machine has no registers to hold intermediate data values. The instruction set uses the Java stack for storage of intermediate data values. This approach was taken by Java’s designers to keep the Java virtual machine’s instruction set compact and to facilitate implementation on architectures with few or irregular general purpose registers. In addition, the stack-based architecture of the Java virtual machine’s instruction set facilitates the code optimization work done by just-in-time and dynamic compilers that operate at run-time in some virtual machine implementations.

software engineer.

Java Goes Open Source

Friday July 16 2010 8:29 am | Category : java application | Comments (0)

In November of this year Sun Microsystems moved to “open source” status for Java, after a decade of maintaining proprietary status for the portable programming language. Specifically, Sun has placed Java into the public domain by putting it under GPL – an acronym for General Public License. What this means is that software programmers will have vastly increased freedom to develop programs based on Java and to develop modifications for the language itself.

It also puts Sun into the mainstream with other major platform developers such as Linux. While the company had put its Solaris operating system into open source status some time ago, Java is a highly distributed consumer platform and providing open source access to it gives the company a real boost in its standing among its peers. Perhaps more important, it will stimulate further development of consumer oriented Java-based programs. It is estimated that eight out of every ten cell phones have a Java application running on them.

A GPL use requires that any product developed under such licensure be returned to the “open source community” and remain, in effect accessible to all. Sun’s variation on this principle has an exception for applications built on the Java “Virtual Machine,” a platform that the company made available to software developers some time ago.

What this exception does is allow continued development of proprietary software written for Java, which keeps the language viable as a platform for revenue producing products. Prior to the switch to GPL status, Java program developers had to pay a licensing fee to Sun.

IBM has been after Sun to take Java to open source status for years. Their Works Projects has been a center for the development of open source products, primarily based on Linux. From their perspective, Sun’s decision to grant GPL status for Java is viewed as an opportunity to unite with Linux and provide a stronger platform to challenge Microsoft. The politics of software can be enormously complicated, especially when there’s an elephant like Microsoft in the house. But what Sun has accomplished with this move is provide an opportunity for programmers to zero in on Java products as potentially large revenue sources.

Unlike Linux, which was spun off of UNIX to provide an alternative to Windows, Java stands in a class of its own. While Linux has survived in the marketplace, it has never mounted a major challenge to Windows. Java’s unique qualities and the intellectual property that protects those qualities will now be an open book for programmers developing new applications.

It will also provide the opportunity to bundle Java products with Linux based software. Sun’s internal interest in this move is to stimulate more developers to use the language, in order to revive its own internal software business. Since taking a huge hit in their high-end server market, Sun has been struggling to find a new path and has increasingly looked to software as an opportunity.

Sun’s EVP for software summed up the value of the move for the company and its product. “People have been hesitant to distribute Java worldwide with Linux (distributions) because of (concerns over) license alignment,” Green said. “This is the last gate to ensure that Java will be distributed worldwide.”

Madison Lockwood is a customer relations associate, specializing in small business development, for Apollo Hosting. Apollo Hosting provides website hosting, ecommerce hosting, vps hosting, and web design services to a wide range of customers.

Java Developers

Tuesday July 6 2010 8:30 am | Category : java application | Comments (0)

At Aegis , we offer you the chance of a lifetime for permanently hiring from our extensive resource of experienced Java software professionals for the benefit of successfully developing and maintaining your business projects.

All our Java Developers are well qualified with excellent communication and analytical skills and with considerable experience in their respective areas of expertise.

Developers are equipped with high end Workstations with the latest software and tools installed for constancy in their work. All communication channels like MSN, Yahoo, AOL, and SKYPE are available with the developers for easier transfer of information & communication during projects.

Why Aegis:

Continuous commitment to Java platform since the foundation of our company, which makes us the best choice of an expert in Java development and integration solutions.

A motivated team with a strong technical background and commitment to excellence, which ensures efficient work and delivery of high-quality software. We undertake projects both large and small and tailor the solution to meet the budget and the deadlines. Java has many advantages, not least of which is that there are many open source projects that provide industrial-strength foundations on which to build cost-effective solutions.

our Java expertise was complemented by a broad range of experience. Today we operate in a spectrum of sectors and are able to bring a depth of knowledge to all our projects. We offer Dedicated Development Services & Consultancy on Java Platform. At Aegis we have pool of Expertise to get any size Big or Small Java application done.

As the leading international provider of Java software technology in India we are committed for best services and solutions on Java Platform.

Technologies and Tool we work On:

Java EE, Java SE, JNI, EJB, JPA, XML, Spring, Hibernate, TopLink, OSGi

Apache Axis, Codehous xFire

JSP, Servlets, JSF, Struts, WebWork, Ajax, JavaScript, XHTML

Swing, SWT

Oracle, DB2, Microsoft SQL Server, SAPDB, PostgreSQL, MySQL, FireBird, Derby, Hypersonic

PL/SQL, Transact-SQL, Oracle Forms

ERwin Data Modeler, BPwin, PowerDesigner 6.0—12.0

IntelliJ IDEA, Eclipse, Ant, Maven, Cruise Control, TeamCity, Hudson

JUnit, TestNG, Emma, Clover, Selenium

Apache Tomcat, JBoss, Weblogic, WebSphere, Orion, Resin, Oracle Application Server

Qualifications of our Java Developers

Qualifications of JAVA, J2EE Developer

4-year college degree in computer science or 3 Years Masters Degree

Software Development Life Cycle Experience

Extensive exposure to JAVA, J2EE, J2ME

JBoss, Tomcat, Apache, IBM Web sphere, Oracle Application Server, Struts, Beans, EJB, Ant

XML, Web Services, XSLT

J2ME, Xlet, Java Foundation Profile, Java CDC

harsh savani