A cllection of eclipse tutorials

Home arrow Java Tutorials arrow Developer Tools arrow A cllection of eclipse tutorials
A cllection of eclipse tutorials Print E-mail
Written by Administrator   
Friday, 16 June 2006

Abstract (eclipse tutorial)

The Eclipse project is the Eclipse Foundation’s major backbone. This big Eclipse project has three subprojects — the Platform subproject, the Java Development Tools subproject, and the Plug-in Development subproject.

Installing Eclipse  tutorial

1,Download Java (J2SE v 1.4.2_05 SDK):

(This is not needed for Mac OS X, since it is already built in.) For Windows and Linux, visit the web site:
http://java.sun.com/j2se/1.4.2/download.html


select Download J2SE SDK. (On Windows, you will need admin privileges.) Be careful that you do not confuse the JRE with SDK, you need the SDK. Once the download is complete, install java by clicking on the file you downloaded. This will lead you through the installation process.

2,Download Eclipse:

To download Eclipse visit the web page
http://www.eclipse.org/downloads/index.php

You may select any mirror site, e.g. "Main Eclipse Download Site". (Depending on the current internet traffic load, some mirror sites may be very busy, and you may want to experiment until finding one that provides good response time.)
There are several versions of Eclipse, and it is important you install the correct one. Check that the site has the latest version, in particular be sure you download the version with "Build Type" = "Latest Release" and "Build Name" = "3.1". If you do not see this, try another mirror site. Click on the "3.1" link, and this will take you to a page where you can select the version for your particular platform (e.g. "Windows" or "Linux"). Locate your platform and click the download link, e.g., (http). Save the resulting zip file in any directory of your choosing.

3,Install Eclipse:

Unlike most modern software products, Eclipse has not have a fancy installation procedure. To install it, simply extract the zip file in the directory where your programs are stored, e.g. C:\Program Files. This will create a directory named eclipse. The executable program file is located in this directory and is called "eclipse.exe". On Windows systems, it is a good idea to create a shortcut to this executable on your desktop. To do this, right-click on the "eclipse.exe" file and select "Send To → Desktop".
Initializing Eclipse:
Eclipse stores all its files in a directory called its "workspace". When Eclipse is run for the first time, it will ask you where you want the workspace to be placed. You can just use the default location (which will be in the directory where eclipse was installed). Some people find it more convenient to place the workspace somewhere in their "My Documents" directory, e.g. "My Documents\Eclipse".
After this, you should see the "Welcome to Eclipse 3.1" page.

Unit Testing in Eclipse Using JUnit(eclipse  tutorials)

1.  Introduction to JUnit 
2.  Creating a Test Class 
3.  Creating a Test Suite 
4.  Running JUnit Test Cases 
5.  Assertion Statement Reference 
6.  Exercise
7.  Resources

Full article

Creating JFace Wizards(eclipse tutorial)

Wizards are used extensively throughout Eclipse. You can use wizards to create a new Java class or new resources like Projects, Folders or Files. A well designed wizard can considerably simplify user tasks and increase productivity.

Wizards are meant to take the hassle out of standard, repetitive, or tedious user tasks. For example, the Java New Class wizard can collect enough information to generate a skeleton implementation of a user's class, including package statements, constructors, inherited methods, and other details. Of course, as the wizard developer, you must implement the code that makes the wizard useful for your domain.

Not only does the platform contain many wizards, but there is a lot of support for writing your own. The JFace wizard framework lets you concentrate on the specifics of your wizard implementation. You will need to use the org.eclipse.jface.wizard package of JFace. It is very easy to get started while the support is flexible enough to allow you to add more complex logic to your wizards.

Full article

 

Getting Started with Eclipse and Tomcat(eclipse tutorial)

This is a tutorial on how to get you started with Servlet development with Eclipse IDE to develop XML-RPC services that can be a counterpart for your XWT application. It will guide you through installing the necessary tools and building your first XMLRPC Servlet. There is a separate tutorial available here that focuses on developing the client-side XWT application.

Installing the development environment

The first step is to install the development environment. In this example our development environment is based on Eclipse IDE and we use Tomcat servlet container. These tools integrate well and are freely available from their vendors.

  • Install JDK 1.4
  • Install Apache Tomcat 4
  • Install Eclipse IDE
  • Install the Tomcat plugin for Eclipse (read the included readme.html!)
  • Download the Apache XML-RPC library
  • Start Eclipse
  • Under Window / Preferences / Tomcat, check Tomcat Version 4.1.x and browse to teh Tomcat installation directory; under Tomcat / JVM Settings select the JDK 1.4 or detected jvm in the JRE - dropdown.
  • If you are proficient with Tomcat, we recommend that you clean up all the extra stuff from TOMCAT_HOME/conf/server.xml as this will greatly decrease the startup time.

 Creating a new Web-application project

To create a new web application, we must first set up a new project in Eclipse.

Start by creating a new Java Tomcat project from Eclipse: open File / New / Project and select Java / Tomcat project
Name the project, check "can update server.xml" and click Finish.
Right click the newly created project, select Properties / Tomcat, set the Context name to /xmlrpc
Copy xmlrpc-1.2-b1.jar (from the xmlrpc-1.2-b1.zip archive) and place it under Eclipse/workspace/<your project name>/WEB-INF/lib
In Eclipse, right click your project and choose Properties, under Java Build Path, on the Libraries-tab, and add the above mentioned file as an external JAR. In the adjoining Order and Export tab, check  xmlrpc-1.2-b1.jar.
In the Eclipse resource view, browse to the WEB-INF/lib directory, right click and select Refresh


Writing the application

Now you are ready to write your first XmlRPC Servlet. Here we use a fortune server that will serve us useless witticisms.

Right click the new project and select New->Other->Class, name the class "TestServlet" and set it's superclass to HttpServlet.
Insert the following code in TestServlet.java:

 import javax.servlet.*;
import javax.servlet.http.*;
import java.io.*;
import org.apache.xmlrpc.XmlRpcServer;
public class TestServlet extends HttpServlet {  
public static XmlRpcServer xmlrpc = new XmlRpcServer();
public void init (ServletConfig config) throws ServletException   {    
 xmlrpc = new XmlRpcServer(); 
 xmlrpc.addHandler("fortune", new Fortune()); 
 }  
public void doPost(HttpServletRequest req, HttpServletResponse res) throws ServletException, IOException
  {   
  byte[] result = xmlrpc.execute(req.getInputStream(), null, null);    
   res.setContentType("text/xml");
   res.setContentLength(result.length);   
  OutputStream output = res.getOutputStream();
     output.write(result);   
    output.flush(); 
 }}

Right click the project and select New->Other->Class, name the class "Fortune" and set it's superclass to Object.

Insert the following code in Fortune.java:


public class Fortune { 
 public String get(int index) 
 {   return fortunes[index];
  } 
 public String get()   {  
   return fortunes[random.nextInt() % fortunes.length];   }   private String[] fortunes = 
 {      "This is an ignore, please test...", 
        "An unbreakable toy is useful for breaking other toys"  }; 
 private java.util.Random random = new java.util.Random();}

Save your new class files.
Choose from the Eclipse -menu Window->Preferences and there Tomcat and check our tutorial project to be added to the tomcat classpath.

Deploying the application

The servlet container requires some configuration before you can access the application. The configuration is stored in the web.xml file which is stored in web application's WEB-INF directory.

Here is the configuration file for the example application created above. Right click the WEB-INF icon in your project and select New->File, call the file web.xml and copy & paste the following xml into it:
<?xml version="1.0" encoding="UTF-8"?>

<!DOCTYPE web-app PUBLIC "-//Sun Microsystems, Inc.//DTD Web Application 2.2//EN"
"http://java.sun.com/j2ee/dtds/web-app_2_2.dtd">
<web-app>

<servlet>
<servlet-name>xmlrpc</servlet-name>
<servlet-class>XwtXmlRpcServlet</servlet-class>
</servlet>

<servlet-mapping>
<servlet-name>xmlrpc</servlet-name>
<url-pattern>/fortune</url-pattern>
</servlet-mapping>

</web-app>

 Running the example

To run the example application the servlet container must be running. This is straightforward, if you have the Tomcat-plugin installed in Eclipse. After the servlet container is up and running you can access the application using the specified URL.

Run tomcat by clicking the Start Tomcat -icon in the Eclipse toolbar.
Point your web browser to http://localhost:8080/xmlrpc/fortune
At which point you'll be told that the servlet doesn't support the GET method. Exciting, innit? Now, fetch the XWT widget set, unpack it and add a file called main.xwt in the toplevel directory with the following contents:

<xwt>

   <static>
      xwt.theme("xwt.standard", "org.xwt.themes.monopoly");
   </static>

   <import name="xwt.standard.*"/>
   <import name="xwt.standard.widgets.*"/>

   <template height="180" width="400" thisbox="frame" orient="vertical">
      svc = xwt.origin.replace("fortune.xwar", "fortune/fortune");

      refresh = function() {
         try {
            $fortune.text = xwt.xmlrpc(svc).fortune.get();
         } catch(e) {
            $fortune.text = e.faultString;
         }
      }

      xwt.thread = refresh;

      $refresh._click = function(c) { xwt.thread = refresh; }

      <box id="fortune"/>
      <button id="refresh" text="Refresh"/>
   </template>
</xwt>

The Power of Three - Eclipse, Tomcat, and Struts(eclipse tutorial)

Introduction

As a programmer it's important to be productive, and as any other craftsman you need good tools to be productive. In this article I'll present a set of tools, which can really help you get your job done. What's more, they're all free, open source, and well documented. I've been using these tools in several real-life projects and have found that they often outdo expensive development tools. This is because they're simple to install, simple to use, reliable and have good performance.

The names of the tools are Eclipse, Tomcat, and Struts.

You've probably heard about all of them, and maybe you have used them in your work, but anyway: here's a short description of each:

  • Eclipse is an IDE from eclipse.org, which can be used for programming in Java and many other programming languages.
  • Tomcat is a J2EE web server from the Apache Jakarta project
  • Struts is a framework--also from Apache Jakarta--for building MVC-type servlet applications

So, these tools are made for making web applications based on the servlet specification. They don't cover EJB's, since Tomcat is not an EJB-server, and standard Eclipse does not cover EJB's.

Eclipse has a project type for Java development, but strangely enough not for Java web application development. A Java web application is characterized by a special directory structure (war-file structure), and a set of specialized files: jsp-files, XML configuration files, servlets, etc. To fill this gap, a very nice Eclipse plug-in from sysdeo.com is at hand. It not only gives us the web application project but also a way of managing the Tomcat server from within Eclipse. Below we'll see how to install and use this plug-in.

Struts gives you a way of building modular, de-coupled web applications. How Struts is included in Eclipse is another topic that'll be covered later in this article.

Full tutorial

Getting Started with Eclipse and the SWT(eclipse tutorial)

This site contains some tutorials and example programs that will help programmers who are new to Eclipse and the Standard Widget Toolkit (SWT) install Eclipse correctly and run some simple Java/SWT programs.  The main focus of this site is illustrating the use of the SWT for developing Java-based desktop applications.  We have included information on compiling Eclipse/SWT applications into executables with GCJ.  We have also included a brief introduction to installing the CDT (C/C++) plug-in into Eclipse that supports the development of C and C++ programs and an introduction to the Java Native Interface that permits Java and C programs to communicate with each other.  The majority of the tutorials focus on Windows (XP) but the examples that we have run on Linux also work correctly.

Full tutorial

 

Building J2EE Applications using JBOSS and ECLIPSE (eclipse tutorial)

Tutorial.
 Preface
 
About the Authors
 
Acknowledgments
 
Disclaimer
 
Introduction
 
Prerequisites for this tutorial
 
Tools required for this tutorial
 
Case Study Overview

 


Chapter 1.
 Configuration of ECLIPSE using JBOSS and LOMBOZ
 
Install Eclipse
 
Install JBOSS
 
Creating Database Schema
 
Install Lomboz
 
Lomboz Configuration
 
Configure JBOSS to run from within Eclipse
 
Test your configuration

 


Chapter 2.
 Overview Of J2EE Technology and Concepts
 
J2EE Components
 
J2EE Clients
 
Web Components
 
Business Components
 
Enterprise Information System Tier
 
J2EE Containers
 


Packaging
 
J2EE Platform Roles
 
Distributed Architecture in J2EE
 
Java Naming Directory Interface (JNDI) Architecture

 


Chapter 3.
 Creating a Stateless Session Bean
 
Tasks
 
Create J2EE Project
 
Create StoreAccess Stateless Bean
 
Setup DAO
 
Create StoreAccess's DAO Interface
 
Add Business Method
 
Implement DAO Interface
 
Add Callback Method
 
Deploy StoreAccess Bean
 
Create your Test Client
 
Test your Client

 


Chapter 4.
 Creating a Stateful Session Bean
 
Tasks
 
Create StoreAccessState Stateful Bean
 
Create StoreAccessSate's DAO Interface
 
Add Business Method
 
Add Callback Method
 


Implement DAO Interface
 
Deploy StoreAccessState Bean
 
Create your Test Client
 
Test your Client

 


Chapter 5.
 Creating a BMP Entity Bean
 
Tasks
 
Create Customer BMP Entity Bean
 
Create Customer's DAO Interface
 
Add Finder Methods
 
Add Business Methods
 
Implement Customer's DAO Interface :
 
Deploy Customer Bean
 
Add Create Method in StoreAccess
 
Add Business Method in StoreAccess
 
Create your Test Client
 


Test your Client
 
Exercise

 


Chapter 6.
 Creating a CMP Entity Bean
 
Tasks
 
Create Item CMP Entity Bean
 
Implement ejbCreate Method
 
Add Finder Methods
 
Add Business Methods
 
Add Callback Methods
 
Deploy Item Bean
 
Add Business Method in StoreAccess
 


Create your Test Client
 
Test your Client
 
Exercise

 


Chapter 7.
 Creating a Message Driven Bean
 
Tasks
 
Create RequestItems MDB Bean
 
Create Immutable Value Object RequestItem
 
Implement onMessage Method
 
Deploy RequestItems Bean
 
Create Test Client
 


Test your Client
 
Exercise

 


Chapter 8.
 Creating Web Clients
 
Create AccessController Servlet
 
Implement init method
 
Implement methods doGet and doPost
 
Deploy AccessController Servlet
 
Test your Servlet
 
Create JSP Page
 
Add Html and JSP Tags
 
Deploy Module OnlineStore
 
Test your JSP Page

 


Chapter 9.
 Creating Web Services  
Web Services Standards
 
Web Services In Java
 
Installing AXIS
 
Configuring AXIS with JBOSS
 
Create the Web Service
 
Deploy the Web Service
 
Create Web Service Test Client
 
Test your Client
 
Create and Test Web Client
 
Create and Test VB.Net Client
 
Create and Test Perl Client
 
Full tutorial

Build Perl applications with Eclipse (eclipse tutorial)

This tutorial will look at the basics of the EPIC plug-in before moving on to an examination of the EPIC system using a real-world example, developing a small module and script entirely within Eclipse that supports RSS parsing. You'll use this as an opportunity to examine other areas, such as the integration with Perldoc, code folding and refactoring -- all of which can make the application development process run more smoothly. By the end, you will have a good understanding of how the EPIC plug-in can be used to develop your Perl applications within Eclipse.

Full tutorial

 

Last Updated ( Friday, 16 June 2006 )

  home              contact us

 

©2006-2014 DeveloperZone.biz   All rights reserved     powered by Mambo Designed by Siteground