Archive for the ‘ Java ’ Category

What is the Java Technology?

This article as the explanation of Object Oriented Programming (OOP) that I write before

A programming language
Java Programming Language looks like with C++ Language.

A development environment
Java technology provide: compiler, interpreter, documentation generator, and class file packaging.

An application environment
Is standalone program that don’t need web browser to execute the program (applet).

A deployment environment
There are 2 deployment environment:
a. JRE ( Java Runtime Environment) providing classes that store in packages, GUI class component, and API Collection.
b. Web browser - many commercial web browser which provide the environment of Java Technology Interpreter and Runtime.

OOP vs Procedural

Procedural :

- Task is finished in the form of function or procedure.
- Manner looks at - program a sequence instruction.
- Programer must break down a problem be sub problem more simple.
- Function and procedure is principal focus.
- Function and procedure is used to manipulate data.
- Data has passive.

Object Oriented Programming :

- Function and data doesn’t be two matters apart.
- Function and data is one unitary called as active object.
- Manner looks at - program series object that cooperate to finish a problem.

Java-Overloading

Meaning: Wrote came back method by the name of that was same to some class.

The aim: facilitated the use of method with fungsionalitas that was similar.

Overloading Role:

Mode access overriding method must be the same or wider than overriden method.
Subclass only might override method superclass one time, might not be more than one method in the same class that was same precisely.
Overriding method might not throw checked exceptions that not it was declared by overridden method.

The Rule to declare Overloading Method

- The name method must same
- List of the parameter must be different
- Return type might be the same, also might be different

Example of Overloading

public class Coloring extends Model {
   public void Picture(String color, int t1, int t2, int3) {
   …
   }
   public void Picture(String color, int t1, int t2, int3, int t4) {
   …
  }

}


Java-Overriding

Overview

1. Subclass that try to modify behaviour that inheritted from superclass.
2. Aim: subclass has more specific behaviour .
3. Done by return declare method property of parent class at subclass.

- Method declaration in subclass must equal to found at super class. sameness in:

  • name
  • return type
  • parameter list (total, type, and sequence)

- Method in parent class called overriden method
- Method in subclass called overriding method.

Example:

public class Animal {
public void SetVoice() {
System.out.println(“Blesepblesep”);
}
}

public class Dog extends Animal {
public void SetVoice() {
System.out.println(“Hug hug”);
}
}


Installation Java Virtual Machine

  • Do installation java virtual machine till finish.
  • Do to setting path and classpath by as follows:
  1. open control panel - system
  2. choose tab: advanced
  3. choose button: environment variables
  4. at part system variables do to setting PATH and CLASSPATH as follows:
  • In variable path add = c:\folder_name_where_you_install\bin
  • In variable CLASSPATH add = c:\folder_name_where_you_install\lib\tools. jar

When does variable CLASSPATH not exist so make new variable with push new button. Check installation result by open command promt, type command javac, when out use manner instruction so installation success.

Java Virtual Machine

Before install Web Container as prerequisite to running JSP, so first of all must install Java Virtual Machine. Java Virtual Machine software that functioned to translate program Java so that understandable by computer. To has Java Virtual Machine at computer, so necessary downloaded JDK (Java Development Kit) available at http://java.sun.com because to development need API class. When not do process development and only necessary run program, so that need only JRE (Java Runtime Environment).

Context

A Context is a web application apart, selfsupporting, independent. A context has configuration each. Library from a Context also can not be read by other Context. Object at a Context can not accessing object at other Context.

Above a web application server like Jakarta Tomcat can deploy more than one Context. You can make a Context with create a subdirectory be TOMCAT_HOME/webapps/. In folder webapps/ here’s file JSP put.
A Context complete has subdirectory WEB-INF/ where found web.xml that be configuration file from this Context. In WEB-INF/ can found subdirectory classes/ and lib/. Subdirectory classes/ where files .class put, while lib/ where files .jar, be files collection. class, put.

Jakarta Tomcat

Jakarta Tomcat is a web application server, has ability as Servlet container and JSP container where you deploy servlet and JSP. Above Jakarta Tomcat, Servlet and JSP will work to serve request from client, normal it shaped browser.

To be able to run Jakarta Tomcat, you want Java Development Kit (JDK). For Jakarta Tomcat Installation, you can downloaded binary from http: //jakarta.apache.org, in format. zip, . tar. gz. you necessary do only decompress file.

In work with Jakarta Tomcat, you have a directory that known as TOMCAT_HOME. TOMCAT_HOME directory where Jakarta Tomcat installed. Furthermore be TOMCAT_HOME you will find several subdirectory, like bin/, conf/, logs/ and webapp/. In subdirectory bin/ found files executable especially to run and stop Jakarta Tomcat. In subdirectory conf/ found files to configuration. In subdirectory logs/ found log files. And subdirectory webapp/ where you can put web application you get up with Servlet and JSP. In subdirectory webapp/ you can create subdirectory. sub merectory this be made as context by jakarta tomcat.

You can run Jakarta Tomcat with execute startup.sh at subdirectory bin/. while to stop Tomcat execute shutdown.sh at sub merectory bin/ also. According to default Jakarta Tomcat at disposal request from client pass port 8080. pass browser web, you can contact http://localhost:8080/

Web Container

Base on J2EE spesification, known EJB Container, Web Container and Application Server. Web container services that run by a java application server especially to services compliance/compatible with servlet and JSP. Besides be services by Java Application Server, Web Container selfcontained. Web container example such Tomcat, Servletexec, Resin, Jrun, Blazix. Web container also can cooperate with web server, for example Tomcat with Apache, Jrun with IIS.

Web server is software for server that handle request pass protocol HTTP that used by web sites at this time in handle request file static html, like Apache and Microsoft IIS. Now, web server often “encapsulated” by Java Application Server as HTTP Server.

Java application server is server that consist of HTTP server (web server), EJB container also Web container. Example Java Application Server: Sun J2EE RI 1.2/1.3, Borland Appserver 4.5/Enterprise Server 5.0, Oracle9i Application Server and another.

JSP Life cycle

Like another application Java type (servlet, applet, midlet etc), JSP also have a strong type mean use variable on page must declare before. For example in sintaks reduplication here:

for (int i=1; i<13; i++)
{
// statement
}

As other server side scripts, JSP even also need web server. ASP Script need IIS as web server, PHP need IIS or Apache, while JSP can use Apache Tomcat as one of the web server that support it.

So that can run JSP files based on Java, need web server that can to processed java, or minimalyl JSP engine that can integration with web server.