Search
×

Sign up

Use your Facebook account for quick registration

OR

Create a Shvoong account from scratch

Already a Member? Sign In!
×

Sign In

Sign in using your Facebook account

OR

Not a Member? Sign up!
×

Sign up

Use your Facebook account for quick registration

OR

Sign In

Sign in using your Facebook account

Shvoong Home>Books>java/j2ee technology Review

java/j2ee technology

Book Review   by:ganeshv     Original Author: ganesh
ª
 
I am working as a software engineer in java domain in India.I have knowldge in j2ee technology
Java Virtual Machine (JVM) jvm
is a small application mainly written in C language that needs to be
installed in order to execute JAVA programs. Whenever a Java program is
compiled it is converted into BYTE CODE. Further when java program is
executed, JVM executes those byte codes and converts them into machine
language understood by the underlying operating system. Since JVM is
platform dependent it makes Java platform independent. Byte codes
produced during compilation are always same for all operting systems
but since JVM is platform dependent it reads those byte codes and
convert them into the machine language for which the JVM has been
designed. eg. JVM built for Linux operating system will convert the
byte codes into machine language understood by Linux and the underlying
machine hardwares. Just In Time Compiler (JIT) Although
Java was designed for interpretation, there is technically nothing
about Java that prevents on-the-fly compilation of bytecode into native
code. Sun provides its Just In Time (JIT) compiler for bytecode which
when included in the JVM, it compiles bytecode into executeable code in
real time one by one as the program demands. The JIT compiles code as
it is needed during execution. However, the just-in-time approach still
yields a significant performance boost. Whether your Java program is
actually intepreted in the traditional way or compiled on the fly its
functionality is the same. Suppose there are to files (Java class)
which are used by a Java program will be loaded into the memory one by
one on a demand basis. JVM will not check for the availablity of the
files before executing the code. In case if it is not able to find the
required file in between the execution of the program, JVM will throw
an exception saying that it has not found the file and exit the program
from that point. The program will not complete successfully.





Posted by
ganesh



at

11:45 AM






0 comments




































Wednesday, August 8, 2007








java basics








Java
programming language (object-oriented) is developed by Sun
Microsystems. Java is a simple, scalable, general purpose object
oriented programming language. This is a beginner java tutorial blog
covering java basics along with java source code. Characteristics of JavaSimpleReusablePortable (Platform Independent)FamiliarRobustSecureHigh PerformanceDynamicThreadedInterpreted.Java Architecture The
Java environment is composed of a number of system components. You use
these components at compile time to create the Java program and at run
time to execute the program. Java achieves its independence by creating
programs designed to run on the Java Virtual Machine rather than any
specific computer system.• After you write a Java program, you use
a compiler that reads the statements in the program and translates them
into a machine independent format called bytecode.• Bytecode files, which are very compact, are easily transported through a distributed system like the Internet.• The compiled Java code (resulting byte code) will be executed at run time.ava programs can be written and executed in two ways: • Stand-alone application (A Java Swing Application) • Applet which runs on a web browser (Example: Internet Explorer)Java source code Below is a java sample code for the traditional Hello World program. Basically,
the idea behind this Hello World program is to learn how to create a
program, compile and run it. To create your java source code you can
use any editor( Text pad/Edit plus are my favorites) or you can use an
IDE like Eclipse.public class HelloWorld { public static void main(String<> args) { System.out.println("Hello World"); }//End of main}//End of HelloWorld ClassOutputHello WorldABOUT THE PROGRAM
I created a class named "HelloWorld" containing a simple main function
within it. The keyword class specifies that we are defining a class.
The name of a public class is spelled exactly as the name of the file
(Case Sensitive). All java programs begin execution with the method
named main(). main method that gets executed has the following
signature : public static void main(String args<>).Declaring this
method as public means that it is accessible from outside the class so
that the JVM can find it when it looks for the program to start it. It
is necessary that the method is declared with return type void (i.e. no
arguments are returned from the method). The main method contains a
String argument array that can contain the command line arguments. The
brackets { and } mark the beginning and ending of the class. The
program contains a line ''System.out.println("Hello World");'' that tells
the computer to print out on one line of text namely ''Hello World''. The
semi-colon '';'' ends the line of code. The double slashes ''//'' are used
for comments that can be used to describe what a source code is doing.
Everything to the right of the slashes on the same line does not get
compiled, as they are simply the comments in a program.Java Main method Declarationsclass MainExample1 {public static void main(String<> args) {}}class MainExample2 {public static void main(String <>args) {}} class MainExample3 {public static void main(String args<>) {}} All the 3 valid main method''s shown above accepts a single String array argument. Compiling and Running an Application
To compile and run the program you need the JDK. The JDK is distributed
by Sun Microsystems. The JDK contains documentation, examples,
installation instructions, Java class libraries and packages, and
tools. Download an editor like Textpad or EditPlus to type your code.
When you save your source code, you must save it with a .java
extension. The name of the file must be the name of the public class
contained in the file. In the above case, it must be ''HelloWorld'' and
the .java extension.Steps for Saving, compiling and Running a Java Step 1:Save the program With .java Extension, i.e. HelloWorld.javaStep 2:Compile the file from DOS prompt by typing javac ,i.e. javac HelloWorld.javaStep 3:Successful Compilation, results in creation of HelloWorld.class containing byte codeStep 4:Execute the file by typing java , i.e. java HelloWorld This would print “Hello World” on your screen Java Development Kit The
Java Developer''s Kit is distributed by Sun Microsystems. The JDK
contains documentation, examples, installation instructions, class
libraries and packages, and toolsjavadoc The javadoc tool provided by Sun is used to produce documentation for an application or program, Jar Files A
jar file is used to group together related class files into a single
file for more compact storage, distribution, and transmission. PATH and CLASSPATH
The following are the general programming errors, which I think every
beginning java programmer would come across. Here is a solution on how
to solve the problems when running on a Microsoft Windows Machine.1. ''javac'' is not recognized as an internal or external command, operable program or batch file
When you get this error, you should conclude that your operating system
cannot find the compiler (javac). To solve this error you need to set
the PATH variable.How to set the PATH VariableFirstly
the PATH variable is set s
Published: September 22, 2007   
Please Rate this Review : 1 2 3 4 5
Translate Send Link Print
X

.