JVM(Java virtual machine):it is the runtime environment for java programs and it contains the following :
1)class loader
2)byte code verifier
3)jit compiler and interpreter
java is a platform independent language which means it can be operated in any operating system
when you execute a program in C && C++ a .exe file is obtained which contains the source code
and operating system details where as when you execute a program in java a .class file is created which contains the byte code(source code) only.It is the JVM which links this byte code with the operating system details.
The Java Virtual Machine forms part of a large system, the Java Runtime Environment (JRE). Each operating system and CPU architecture requires a different JRE. The JRE comprises a set of base classes, which are an implementation of the base Java API, as well as a JVM. The portability of Java comes from implementations on a variety of CPUs and architectures. Without an available JRE for a given environment, it is impossible to run Java software.
Functionality of JVM(Java Virtual Machine)
Java sovles the problem of platform independence by usingbyte code.Java complier does not produce native executablecode.
Instead it produces a special format called byte code.Byte code is a highly optimized set of instructionsdesigned to executed by a java runtime system called JavaVirtual Machine(JVM).JVM is an interpreter for byte code.
This interpreter reads or understands the bytecode andexecutes the corresponding native machine instructions.Thus to port java programs to a new platform ,all thatneeded is to port the interperter and some of the libraryroutines.
Even the complier is written in java.The bytecodes are precisely defined and remain the same on allplatforms.The use of byte code enables the java runtime system toexecute programs much faster.
The JVM is the core of the Java platform and is responsible for:
1. Loading bytecodes from the class files
2. Verifying the loaded byte codes
3. Linking the program with the necessary libraries
4. Memory Management by Garbage Collection
5. Managing calls between the program and the host environment.
Instead it produces a special format called byte code.Byte code is a highly optimized set of instructionsdesigned to executed by a java runtime system called JavaVirtual Machine(JVM).JVM is an interpreter for byte code.
This interpreter reads or understands the bytecode andexecutes the corresponding native machine instructions.Thus to port java programs to a new platform ,all thatneeded is to port the interperter and some of the libraryroutines.
Even the complier is written in java.The bytecodes are precisely defined and remain the same on allplatforms.The use of byte code enables the java runtime system toexecute programs much faster.
The JVM is the core of the Java platform and is responsible for:
1. Loading bytecodes from the class files
2. Verifying the loaded byte codes
3. Linking the program with the necessary libraries
4. Memory Management by Garbage Collection
5. Managing calls between the program and the host environment.
Login Authentication using JSP, Servlet, MySQL in JAVA
In this example we will show you how to authenticate and login user against database username and password. This program consists of a JSP page and a Servlet to authenticate the user against database username and password.
User enters the username and password on the JSP page and clicks on the "Sign-In" button. On the form submit event, data is posted to the servlet for authenticating the user. Servlet makes JDBC connection and authenticate the user. Before submitting data to servlet, javascript is ensuring that none of the fields must be empty.
We are using tomcat server for running Servlet and JSP page. You can use any browser to test the application. We are using two files AuthenticLogin.jsp and LoginAuthentication.java and we are making the application in "webapps/JSPMultipleForms" in tomcat server.
Download Source Code
User enters the username and password on the JSP page and clicks on the "Sign-In" button. On the form submit event, data is posted to the servlet for authenticating the user. Servlet makes JDBC connection and authenticate the user. Before submitting data to servlet, javascript is ensuring that none of the fields must be empty.
We are using tomcat server for running Servlet and JSP page. You can use any browser to test the application. We are using two files AuthenticLogin.jsp and LoginAuthentication.java and we are making the application in "webapps/JSPMultipleForms" in tomcat server.
Download Source Code
Installing Apache Tomcat Server in Eclipse IDE
- If you do not have Apache Tomcat on your machine, you will first need to download and unzip Apache Tomcat (this scenario was written using Apache Tomcat version 5.0.28, but other versions can be substituted).
- Start the Eclipse WTP workbench.
- Open Window -> Preferences -> Server -> Installed Runtimes to create a Tomcat installed runtime.
- Click on Add... to open the New Server Runtime dialog, then select your runtime under Apache (Apache Tomcat v5.0 in this example):
- Click Next , and fill in your Tomcat installation directory :
- Ensure the selected JRE is a full JDK and is of a version that will satisfy Apache Tomcat (this scenario was written using SUN JDK 1.4.2_06). If necessary, you can click on Installed JREs... to add JDKs to Eclipse.
- Click Finish .
Subscribe to:
Posts (Atom)