Yolinux.com logo

YoLinux Tutorial: Java on Linux

This covers Java development and execution on Linux. Both commercially supported products and Open Source GPL'd software will be covered.
Also see the YoLinux Java Servlets,Tomcat and Apache Tutorial.

Contents:


Related YoLinux Tutorials:

°TomCat Tutorial

°IBM Websphere

°YoLinux Tutorials Index



Free Information Technology Magazine Subscriptions and Document Downloads


Free Information Technology Software and Development Magazine Subscriptions and Document Downloads


Java Integrated Development Environments, Virtual Machines and Tools:

IDE: This is primarily the domain of commercial systems. Various components are available as GPL'd software.

  • Eclipse.org extensible IDE consortium - IBM, Red Hat, Rational Java project, ... (Open Source)
  • NetBeans.org - (Sun) Open Source IDE written in Java. GUI builder. Requires a JVM
  • Borland JBuilder for Linux - See install procedures below. Complete IDE for building applications, JSP/Servlets, JavaBeans[tm], Enterprise JavaBeans and distributed J2EE applications. Comes with AppServer and Visi-Broker (Visigenics CORBA broker). Suports UML, SOAP, UDDI, WSDL. (Linux, Solaris, Mac OS X and MS/Windows) Oracle also sells a version of JBuilder under the Oracle brand name.
  • BEA: Weblogic Workshop (Eclipse based) Full web services and Java development IDE.
  • Oracle JDeveloper - Full IDE for Java and web services (WSDL, SOAP, ...) development.
  • Metrowerks: CodeWarrior - Java and GNU C++ development
  • JDEE - Java Development Environment for Emacs
  • Jet Brains: IntelliJ IDEA
  • Visual-Paradigm - UML Tool Builder which interfaces with most of the other IDE's listed above.
Also see IDE Installations below.

JVM/JDK: Java Virtual Machines (JVM) and Software Development Kits (SDK)

Java Build Tools:

Java Tools:

  • Macrovision: InstallAnywhere - Universal Java software installation tool for commercial software distribution. Includes JVM installation if necessary.
  • Quest: JProbe - Profiler, Debugger, Threadalyzer. Supports Blackdown, Sun, IBM JDK's
  • Quest: JClass - Java components (Tables, charts, graphics, database front-ends, text fields) Supports Borland, IBM Visual Age, SUN IDE's and Netscape/Explorer browsers
  • Compuware: DevPartner - Distributed application, memory, performance, code coverage and thread deadlock detection and analysis. Also supports Oracle PL/SQL and Java stored procedure applications.
  • CodeMesh - A make Java and C++ work together product.
  • SeaGullSoftware.com: LEgaSuite - J2EE based, XML driven process execution and Workflow Automation framework which can be deployed on a multitude of J2EE servers.

Java Test Tools:

  • JUnit - Software development unit testing tool.
  • Apache.org: Gump - Continuous build and integration tool for Java. Interfaces with CVS or Subversion. Supports Ant and Maven. Will show which check-in breaks the build.
  • Abbot - Java JUnit extension to support GUI test framework. Uses an AWT robot class to test code. (Review: Java Developer Journal Apr. 2003)
  • Pounder.sourceforge.net - Utility for automating Java GUI tests
  • XPTools - suite of tools for Java testing and development
  • Test Coverage Tools:
    Test coverage tools report on which parts of the code were "covered" or executed during software test suite execution. Typical reports detail routines executed and a percertage of the code executed. Helps assess test reliability (how effective was the test in testing all of the code) and helps find dead code.
    • Koalog Code Coverage - Workes with byte code in process or remote. Written in Java. Reports in XML, HTML, LaTeX, CSV or text. Reports on line, method, class, package and full application coverage. (Commercial)
    • Quilt.Sourceforge.net: JUnit-Quilt - Provides Code Coverage information off of a JUnit Unit Test. Statement and Branch coverage. Operates on Java Byte code.(Commercial)


Java Servlet, Application Servers and JSP Servers:

Simply put, Java servlets are like CGI in Java for the dynamic generation of web content. JSP is enbedding Java in a web page which is processed by the servlet engine before being served.


Java App Server, SOA, Middleware and Three Tier Systems (J2EE/EJB or CORBA services):


Java Frameworks, API:


Java Data Storage: (Databases)

DB API:


Java GUI Components:

The compiled code is not cross platform but use of cross platform GUI frameworks should make the source portable if coded well.

  • SL.com - Sherrill - Lubinski SL-GMS - [Applet demo]
    Dynamic graphic GUI components and controls for real time interfaces and displays. Common ".m1" file graphic framework for C++ and Java. Graphic sources include Visio, bitmaps and DXF. Supports pan, zoom, drill-down and hyperlink capability. Supports input as well as displays. Low weight applets for good performance
  • Quest: JClass Delivered as separate class components to be integrated within ones program. Many are Bean components which can be dragged and dropped within a GUI IDE. Many configurable widgets.
  • Genlogic.com: GLG - Dynamic, data driven visual components. Must use GLG monolithic super class framework within your application. Widgets are used within their class framework. Includes many widgets. Stong support of widgets for process control displays.
  • ILog.com: JViews - Diagraming and data graphing capabilities. Requires use of their super class framework. Few predefined widgets. (just graphs and layout) Developer must develop most widgets.
  • Infragistics.com: JSuite - Access control (ACL), db connection pools, GUI components (calendars, explorer trees, editing components), charting (scatter, bar) Not all components were beans and thus would not integrate with IDE.
  • INT.com: Java components - 2D and 3D data visualization.

Custom Java GUI Components


Java GUI frameworks:

  • SWING - Sun GUI API (written using AWT)
  • AWT - Java's primitive graphics layer.
  • JavaFX - Sun Java GUI description language/presentation layer.

Java GUI's and interaction defined by an XML file. This allows for an infinitely flexible interface.

  • JGB - Extensible infrastructure and design. Shows promise for easily reconfigurable GUI layouts.


Java Connection Architectures and Web Services:

Topologies:

  • client - server: e.g.:
    • WWW: Web browser (client) to web server (server) connection. A click on a web page invokes processing by the server which feeds a response to the web browser.
      Software: Apache web server and CGI
    • Servlets: A JVM used to process Java to perform CGI functionality.
      Software:
    • Web Services:
      • SOAP: client calls a remote process. The requested process and input arguments are encapsulated in XML and passed to the server. The server executes the requested function and passes the results back to the client encapsulated in XML.
      • SOA: Service Oriented Architecture - key components of a SOA include services, dynamic discovery, and messages.
        May integrate the following to locate and invoke the web service:
        1. UDDI: Universal Description, Discovery, and Integration - Find a web service, registry
          Software:
        2. WSDL: Web Services Description Language. - Locate the SOAP service and server
        3. SOAP - The Web services server.

        Software:
        • Apache Axis2: SOAP and WSDL support. The Axis SOAP/WSDL engine servlet runs under Tomcat which is coupled with the Apache web server.
        • Apache CXF: (was XFire) Web services programming framework: SOAP, WSDL, JAX, ...
        • Also see lists above i.e. JBoss, BEA Weblogic, IBM Websphere, Sun, Oracle Application server, ...
      • CORBA: Compact binary transport over IIOP. May use a CORBA name server to locate services. Native Java support.
      • Java RMI: Remote Method Invocation. Native Java support.
  • peer to peer: Two systems or processes passing information between the two.
    • JMS: Java Messaging Service. Supports publish-subscribe communications framework. Subscription via callback methods provided by the subscriber. ActiveMQ is often used as a communications bus for ESB.
      JMS and other message queues:
  • Three tier architectures: J2EE (middleware)
    J2EE Software:
  • ESB: Enterprise Service Bus - a collection of specialized processes (may be distributed) integrated by a common infrastructure which handles communication, interactions, interfaces, authentication, discovery and any other needs of the service bus.
    • BPEL: Business Process Execution Language - Workflow defined in an XML schema, used to invoke web services in the proper order and deliver the results.
      BPEL Software: Apache ODE. (Note project Agila is retired.)
    ESB Software:


Cloud Computing:

Most Cloud computing efforts are available as services purchased through vendors such as Amazon Web Services (EC2: Elastic Computing Cloud) or Google AppEngine. Project Caroline is an open source project to provide cloud computing infrastructure.


Java Kernel Support:

Linux has support for Java binaries in the OS. You can execute Java applications and Java Applets just like any other program once the Java Runtime Environment is loaded and the kernel configured.
See:


Real Time Java:

The Java Real-Time System (RTS) runs on the Linux Real-Time kernel. The "Red Hat Enterprise MRG" (Messaging Real-time Grid) is a set of over 50 RPMs which add or replace components of the "Enterprise Linux" release. It includes a real-time kernel, configuration and tuning utilities, performance monitoring tools and documentation. The Red Hat MRG Linux includes software based on the University of Wisconsin's Condor project for high throughput computing. The Red Hat MRG release includes QPID, the Apache group's implementation of the AMQP message queues which greatly improves messaging throughput vs traditional SOA technology.


Installing the Java Software Developers Kit Version (SDK) 1.4:

Download: http://java.sun.com/j2se/1.4/download.html
(Download j2sdk-1_4_0_03-linux-i586-rpm.bin)
x86_64 AMD Athelon/Opteron/Turion-64/EM64T info for: jdk-1_5_0_version-linux-amd64-rpm.bin

Install:

chmod +x j2sdk-1_4_0_03-linux-i586-rpm.bin
./j2sdk-1_4_0_03-linux-i586-rpm.bin
...
This is where you agree to their license. Press the space bar to scroll down in "More". Do you agree the the above license terms? [yes or no] yes ... rpm -ivh j2sdk-1_4_0_03-fcs-linux-i586.rpm
The SDK installed in /usr/java/j2sdk1.4.0_03/

Set environment variables. (Add to $HOME/.bash_profile)

PATH=/usr/java/j2sdk1.4.0_03/bin:$PATH:$HOME/bin:./
export PATH
export JAVA_HOME=/usr/java/j2sdk1.4.0_03
export CLASSPATH=/usr/java/j2sdk1.4.0_03/lib/tools.jar:/usr/java/j2sdk1.4.0_03/jre/lib/rt.jar:./
Must include "./" in CLASSPATH. This is necessary in 1.4.0_03.

Test program: Test.java

public class Test
{
public static void main(String[] args)
{
System.out.println("Hello world");
}
}
Compile: javac Test.java

(or /usr/java/j2sdk1.4.0/bin/javac Test.java)
Note that the file name and the class name are the same. This became a requirement in SDK 1.4. The result of the compile is the file: Test.class

Run:

[prompt]$ java Test
Hello world
(or /usr/java/j2sdk1.4.0/bin/java Test)

[Potential Pitfall]: Red Hat Enterprise Linux and other Linux systems which install GNU Java may find that this conflicts with the Sun Java installation. You may have to remove this (for example RHEL4):
rpm -e java-1.4.2-gcj-compat-1.4.2.0-27jpp java-1.4.2-gcj-compat-devel-1.4.2.0-27jpp.noarch

The Java SDK includes the following commands:

  • javac: Linux Java compiler (i.e. javac program-name.java)
  • java: Byte code interpreter / Java program launcher. (i.e. java program-name Do not include ".class" extension.)
    Test version: java -version
  • appletviewer: Views Java applet embedded in html file. (appletviewer myfile.html)
  • javaws: Java Web Start application manager. Java application handler for browser.
    (Also see YoLinux Mozilla configuration tutorial)
  • javadoc: Generate API documentation from tagged comments.
  • javah: Creates C header and stub files for Java class.
  • javap: Java file disassembler
  • jdb: Java debugger
  • jar: JAR archive file generation tool.


Java IDE Installations:


Installing Eclipse on Linux:

Edit and debug Java IDE tool with plug-ins

To install, just un-tar the package to the area desired: tar -xzf eclipse-j2ee-europa-linux-gtk-x86_64.tar.gz
Typical installation is to /opt/


Installing Borland JBuilder 9 Enterprise on Linux:

UML design, edit, test Java IDE tool

  1. Load JBuilder9 Enterprise CD 1
    Note the /etc/fstab cdrom statement used below. This may have been altered when using CrossOver PC software installer as it may add "user,unhide," to the list of options and prohibit a JBuilder installation.:
    /dev/cdrom              /mnt/cdrom              iso9660  noauto,owner,kudzu,ro 0 0
    [Potential Pitfall]: If the install script does not execute, it could be because of the way the CD was mounted.
  2. CD should automount. If not mount.
  3. cd /mnt/cdrom
  4. Execute the install script on the CD: ./install_linux
    • Select "Borland JBuilder 9 Enterprise" and select all components
    • Agree to license
    • Select "Full Install"
    • Set install path to /opt/JBuilder9
      (no spaces allowed)
    • Select "Install" button.
    • Select "Done" button.
    • Terminate installer program. Select "X" in window corner.
  5. If using a FlexLM License, place licence file in the following directory: /opt/JBuilder9/defaults/license.dat
    FlexLM License server info
  6. Four desktop icons created:
    • JBuilder: Start JBuilder 9
    • Licensing Information: Obtain a trial licence or register your single user license.
    • JDataStore Explorer
    • JDataStoreServer
Note: To uninstall run: /opt/JBuilder9/UninstallEnterprise/UninstallEnterprise

Desktop icon launcher:

  • Name: JBuilder9
  • Commnd: /opt/JBuilder9/bin/jbuilder
  • Icon: /opt/JBuilder9/bin/jbuilder_icon.xpm


Borland OptimizeitSuite Installation:

Optimizeit Suite, Profiler, Thread Debugger and Code Coverage
  1. Load JBuilder9 Enterprise CD 2
  2. CD should automount. If not mount.
  3. cd /opt
  4. tar -xvzf /mnt/cdrom/linux/suite.tgz
    This creates /opt/OptimizeitSuite55/...
  5. Add FlexLM License: /opt/OptimizeitSuite55/lib/license.dat

Tools:

  • /opt/OptimizeitSuite55/CCoverage
  • /opt/OptimizeitSuite55/OptimizeIt
  • /opt/OptimizeitSuite55/ProgressTracker
  • /opt/OptimizeitSuite55/ThreadD


Developer Sites:


Java Tutorials:


Links:

News Groups:

Glossary:

  • J2SE: Java 2 Standard Edition: Foundation for desktop, server, J2EE, web services, embedded and real-time applications
  • J2ME: Java 2 Micro Edition
  • J2EE: Java 2 Enterprise Edition: Server side and middleware. built upon J2SE. Web services, SOA, component model, management and communications API.
  • JAXP: Java API for XML processing.
  • JAXM: Java API for message processing.
  • JAXR: Java API for XML based registry integration. Registration and discovery of web services.
  • JAX-RPC: Java API for a remote procedure call interface.
  • JAXB: Enables bindings between XML schemas and Java objects.
  • JINI: Framework for advertising services on the local network. Discovery mechanism for systems to obtain and lease these services. See jini.org, Apache river.
  • JMX: Monitor distributed devices, applications and service driven networks.
  • JVM: Java Virtual Machine - compiles Java byte code to machine code, then executes.
  • SOAP: Simple Object Access Protocol.
  • UDDI: Universal Description, Discovery and Integration. SOAP services discovery.
  • WSDL: Web Services Description Language. Name service to locate SOAP service and its interface definition.
  • XSLT: eXtensible Stylesheet Language Transformation. i.e. translates XML into renderable XHTML for viewing in a browser or translate XML to a format required for another aplication.

[Potential Pitfall]: If your Sun or IBM JVM doesn't work with RH 7.1? - [Solution]


Books:

"Core Java 2, Volume 1: Fundamentals "
by Cay S. Horstmann, Gary Cornell
ISBN # 0132354764, Prentice Hall PTR 8th edition

The industry standard. Need I say more?

Amazon.com
"Core Java 2: Volume 2 Advanced Features "
by Cay S. Horstmann, Gary Cornell
ISBN # 0132354799, Prentice Hall PTR 8th edition

The industry standard. Need I say more?

Amazon.com
"Core Java Server Faces"
by David Geary, Cay S. Horstmann
ISBN # 0131738860, Prentice Hall PTR 2nd edition

Amazon.com
"JSP, Servlets, and MySQL"
by David Harms
ISBN # 0764547879, Hungry Minds, Inc

Amazon.com
Dr. Dobb's Journal

Free subscription to the premier resource for professional programmers and software developers. Multi-language and multi-platform with program listings, coding tips, design issue discussions and algorithms. Subscribe here!

Free
Subscription

Return to http://YoLinux.com home page
Return to YoLinux Tutorial Index
Feedback Form

Copyright © , 2001, 2002, 2003, 2005, 2007, 2008 by Greg Ippolito