# Java

# Java

Java is an object-oriented programming language that is intended to be runnable from many different operating systems without recompiling.

- **Essential Links**
    - Home Page: [http://java.sun.com](http://java.sun.com)
    - Downloads: [http://java.sun.com/downloads/](http://java.sun.com/downloads/)
    - Forums: [http://forum.java.sun.com/index.jspa](http://forum.java.sun.com/index.jspa)
    - Tutorials: [http://java.sun.com/learning/tutorial/](http://java.sun.com/learning/tutorial/)
    - Community: [http://www.theserverside.com](http://www.theserverside.com)
    - Conference: [http://java.sun.com/javaone/sf/](http://java.sun.com/javaone/sf/)
- **Open Source**
    - The Apache Software Foundation: [http://www.apache.org/](http://www.apache.org/)
    - O’Reilly Open Source Java Directory: [http://www.onjava.com/pub/q/java\_os\_directory](http://www.onjava.com/pub/q/java_os_directory)
    - Java-Source.Net: [http://java-source.net/](http://java-source.net/)
- **Books**
    - *For Learning Java:*
        - Core Java, Volume I: Fundamentals by Gary Cornell, Cay S. Horstmann, Cay S. Forstmann
        - Core Java, Volume II: Advanced Features by Cay Horstmann, Gary Cornell
    - *For Reference:*
        - The Java™ Programming Language by Ken Arnold, James Gosling, David Holmes
        - The Java™ Language Specification by James Gosling, Bill Joy, Guy Steele, Gilad Bracha
    - *For Best Coding Practices:*
        - Effective Java by Joshua Bloch
    - \_ For Designing GUIs:\_ 
        - Java Look and Feel Design Guidelines: [http://java.sun.com/products/jlf/index.html](http://java.sun.com/products/jlf/index.html)
- **Tools**
    - IDEs 
        - Eclipse: [http://www.eclipse.org](http://www.eclipse.org)
        - NetBeans: [http://www.netbeans.org/](http://www.netbeans.org/)
        - Sun Java Studio Enterprise: [http://developers.sun.com/prodtech/javatools/jsenterprise/index.jsp](http://developers.sun.com/prodtech/javatools/jsenterprise/index.jsp)
        - Sun Java Studio Creator: [http://developers.sun.com/prodtech/javatools/jscreator/index.jsp](http://developers.sun.com/prodtech/javatools/jscreator/index.jsp)
    - Frameworks 
        - Java Server Faces: [http://java.sun.com/javaee/javaserverfaces/](http://java.sun.com/javaee/javaserverfaces/)
        - Shale: [http://struts.apache.org/struts-shale/](http://struts.apache.org/struts-shale/)
        - Spring: [http://www.springframework.org/](http://www.springframework.org/)
        - Struts: [http://struts.apache.org/](http://struts.apache.org/)
        - Webwork: [http://www.opensymphony.com/webwork/](http://www.opensymphony.com/webwork/)
        - Tapestry: [http://jakarta.apache.org/tapestry/](http://jakarta.apache.org/tapestry/)
        - Grails: [http://grails.codehaus.org/](http://grails.codehaus.org/)
        - <span class="caps">RIFE</span>: [http://rifers.org/](http://rifers.org/)
        - Trails: [https://trails.dev.java.net/](https://trails.dev.java.net/)
        - Hibernate: [http://www.hibernate.org/](http://www.hibernate.org/)
    - <span class="caps">AJAX</span>
        - Prototype: [http://prototype.conio.net/](http://prototype.conio.net/)
        - Script.aculo.us: [http://script.aculo.us/](http://script.aculo.us/)
        - Dojo: [http://dojotoolkit.org/](http://dojotoolkit.org/)
        - <span class="caps">DWR</span>: [http://getahead.ltd.uk/dwr/](http://getahead.ltd.uk/dwr/)
        - Google Web Toolkit: [http://code.google.com/webtoolkit/overview.html](http://code.google.com/webtoolkit/overview.html)
        - Java Server Faces: [http://java.sun.com/javaee/javaserverfaces/ajax/tutorial.jsp](http://java.sun.com/javaee/javaserverfaces/ajax/tutorial.jsp)
    - Build 
        - Ant: [http://ant.apache.org/](http://ant.apache.org/)
        - Maven: [http://maven.apache.org/](http://maven.apache.org/)

- Web Container 
    - Tomcat: [http://jakarta.apache.org/tomcat/index.html](http://jakarta.apache.org/tomcat/index.html)
- Application Server 
    - JBoss: [http://www.jboss.com/products/jbossas](http://www.jboss.com/products/jbossas)
    - Geronimo: [http://geronimo.apache.org/](http://geronimo.apache.org/)
- Portal 
    - Liferay: [http://www.liferay.com/web/guest/home](http://www.liferay.com/web/guest/home)
    - JBoss: [http://labs.jboss.com/portal/jbossportal/index.html](http://labs.jboss.com/portal/jbossportal/index.html)
- Enterprise Content Management 
    - Alfresco: [http://www.alfresco.com/](http://www.alfresco.com/)

# XML and Java

- **<span class="caps">XML</span> and Java**
    - Cocoon is a Java-based framework. It utilized pipelines and <span class="caps">SAX</span> events to create a verstile <span class="caps">XML</span> parsing architecture. The Cocoon web site is at: [http://cocoon.apache.org/2.0/](http://cocoon.apache.org/2.0/). Books are now coming out on Cocoon (check out Amazon). The O’Reilly web site has on-line articles on Cocoon: “Introducing Cocoon 2.0” ([http://www.xml.com/pub/a/2002/02/13/cocoon2.html](http://www.xml.com/pub/a/2002/02/13/cocoon2.html)) , “Creating <span class="caps">SOAP</span> Services with Cocoon” ([http://www.xml.com/pub/a/ws/2003/03/18/cocoon.html](http://www.xml.com/pub/a/ws/2003/03/18/cocoon.html)) —Jose

# Converting Java content into AJAX (Javascript and XML)

If you have a program in Java or know how to program in Java and would like to convert your code to be used on websites as <span class="caps">AJAX</span> (Javascript and <span class="caps">XML</span>), Google Web Toolkit can help do it for you instead of doing so by hand.

[Google Web Toolkit](http://code.google.com/webtoolkit/)

The Web Toolkit offers alot of tools for creating webcontent from your Java apps and is perfect for me since I dont have any experience with Javascript or <span class="caps">XML</span>. If you know how to program in Java, make sure to check it out.

# Create a Java class that is only comparable to itself

In Java 5 and above, how to create a Java class that is only comparable to itself? The answer is to extend Comparable&lt;TheClass&gt;. This works even if TheClass uses generics.

```
public class SelfComparableOnly<T> implements Comparable<SelfComparableOnly<T>> {    ...    public int compareTo(SelfComparableOnly<T> o) {	// Compare itself to o    }    ...}
```

# Removing old Java versions

Java is notorious for installing updates (current version as of this writing is version 6, Update 23) but not removing the old versions.

Finding a system with multiple Java versions (e.g. Java 6 Update 10, Java 6 Update 17, and Java 6 Update 20 all on the system’s Add/Remove Programs) is fairly common.

Java until recently did not provide for proper “upgrading” of old versions or cleanup of them. Fortunately Java 6 Update 23 does do this properly.

To remove older versions:

[http://www.java.com/en/download/faq/remove\_olderversions.xml](http://www.java.com/en/download/faq/remove_olderversions.xml)  
[http://www.java.com/en/download/help/uninstall\_java.xml](http://www.java.com/en/download/help/uninstall_java.xml)

It is, unfortunately, fairly primitive— simply to to Add/Remove Programs or Programs and Features and remove them one at a time by uninstalling them.

# Java Server Faces

**Java Server Faces (<span class="caps">JSF</span>)** Mark Norton came across a very handy web page which documents all of the standard <span class="caps">JSF</span> tags and includes examples in <span class="caps">XML</span> and graphics. [http://www.horstmann.com/corejsf/jsf-tags.html](http://www.horstmann.com/corejsf/jsf-tags.html)