19.11.09

NetBeans JAXB Problem: typedef class com.sun.tools.xjc.XJCTask cannot be found

Phenomenon:
I developed a JAXB application using JAXB Wizard on Netbeans 6.7.1. I submitted the program to SVN and then checkout into another computer. When I tried to compile the program, I met an error as:

D:\......\xml_binding_build.xml:8: typedef class com.sun.tools.xjc.XJCTask cannot be found

Reason:
Netbeans projects uses nbproject/private directory to contain some system dependent attributes. I usual ignore this directory when I submit my application to a version control system. However, Netbeans puts the JAXB path information in this directory, which cause my the compilation problem.

jaxws.endorsed.dir=D:\\Program Files\\NetBeans 6.7.1\\java2\\modules\\ext\\jaxws21\\api:D:\\Program Files\\NetBeans 6.7.1\\ide11\\modules\\ext\\jaxb\\api

Due to my understanding, I think this must be a bug of JAXB Wizard in Netbeans.

Solution:
Create another project in the current Netbeans environment and run JAXB Wizard once. Look at the nbproject/private/private.properties file, copy the corresponding line into your target JAXB application, clean and build the application.

9.11.09

Select a directory with a JFileChooser

reference: http://www.rgagnon.com/javadetails/java-0370.html

chooser = new JFileChooser();
chooser.setCurrentDirectory(new java.io.File("."));
chooser.setDialogTitle(choosertitle);
chooser.setFileSelectionMode(JFileChooser.DIRECTORIES_ONLY);

8.10.09

Resource for Creating Java Based Server

Apache MINA: http://mina.apache.org
JBoss Netty: http://jboss.org/netty/
STOMP: http://stomp.codehaus.org/

13.9.09

MX4J Step by Step: 2. Using mx4j


C:\sources\temp\MBeanTest01>java -cp \
lib\mx4j.jar;lib\mx4j-impl.jar;lib\mx4j-jmx.jar;lib\mx4j-rimpl.jar;dist\MBeanTest01.jar \
-Djavax.management.builder.initial=mx4j.server.MX4JMBeanServerBuilder \
com.example.mbeans.HelloMain

MX4J Step by Step: 1. A Simple MBean

http://java.sun.com/j2se/1.5.0/docs/guide/jmx/tutorial/essential.html

Notes:

You'd better use ObjectName.getInstance(String) instead of new ObjectName(String) for efficiency reason.

9.9.09

Import Project into Subversion Using NetBeans IDE

http://www.netbeans.org/kb/docs/ide/subversion.html#synchronizing

Here is some complementary:

1. on the server side:
svn mkdir ${repo-root}/<your-project-directory>/<your-project-directory>
2. on the client side:
svn://<host>/<repo-root>/<your-project-directory>/<your-project-directory>

If you don't create at lease one level of subdirectory and import the project under that subdirectory, you will encounter such an Error Message on the client side:

Trying to use the Subversion plugin with svn+ssh, I get the following: org.tigris.subversion.javahl.ClientException: Trying to use an unsupported feature Server d


1.9.09

Create an All-in-One Document Page of Javadoc

Today I was asked to print out all information of a Java project. I gave a solution based on Javadoc. However, Javadoc generates many HTML files for packages and classes, one for each generally. I came up with an idea to re-organise all the files together.

Therefore, I made a PERL program to do the job automatically. I found Javadoc has very good documentation templates, all essential information comes between

<!-- ========= END OF TOP NAVBAR ========= -->

and

<!-- ======= START OF BOTTOM NAVBAR ====== -->

This template helps me a lot. The work ended up with a 200 lines of PERL.

Actually, I could refine the document a little bit. But the current solution is good enough I think.