Category Archives: Java

Text preprocessing: Wrap around a punctuation with spaces using Java

Input text = “Hello-my $world?” Output text = “Hello – my $ world ? ”

Posted in Java, text mining | Leave a comment

Cleaning Punctuations at the end and beginning of a word

Key: exploit the Character class.

Posted in Java | Leave a comment

JMenuBar/JMenuItem and JTextPane: Focus Owner Problem for Cut/Copy/Paste/Select All

When using JMenuItem in JMenuBar to cut/copy/paste/select all text from a JTextPane, a focus from JTextPanel is temporarily lost to JMenuItem. The loss of focus causes isFocusOwner() of JTextPane to return false. As a result, the cut/copy/paste/select all methods using … Continue reading

Posted in Java | Leave a comment

Implement Java methods for showing/hiding components

I am implementing a user-interface where there is a main JPanel called centerPanel containing two smaller JPanels, source panel and target panel. The source panel contains a JTextPane, and the target panel also contains a JTextPane and another JPanel for holding JButtons. The structure of this … Continue reading

Posted in Java | Leave a comment

Setup WEKA and LIBSVM for WEKA in Debian Etch

When we try to use LIBSVM through WEKA, we might encounter the problem of libsvm.jar not in the classpath. Here, I’d like to describe how to set up Weka and LIBSVM for weka. 1) Download weka-3.5.7.zip from http://www.cs.waikato.ac.nz/ml/weka/, and unzip … Continue reading

Posted in Java, Linux, text mining | 1 Comment

A Practice on LIBSVM Example in Debian Etch Using Java

This exercise comes from “A Practical Guide to Support Vector Classification” paper by Chih-WEi Hsu, Chih-Chung Chang and Chih-Jen Lin. It can be downloaded from http://www.csie.ntu.edu.tw/~cjlin/libsvm/index.html. The goal for writing this page is to record step-by-step instructions of an example … Continue reading

Posted in Java, text mining | 3 Comments

Some common errors in Jasper report: SEVERE: Digester.getParser and JRException: Error compiling report java source files

I’ve followed a tutorial on how to use Jasper report in Netbeans IDE at http://developers.sun.com/jsenterprise/reference/techart/jse8/jasper_reports.html However, I encountered the following problems. (Please note that when I refer to jasperreport library, I mean my customized library that contains a number of … Continue reading

Posted in Java | 9 Comments

Java regular expression: Replace and negate some punctuations

The situation is that we want to replace some punctuations in a text string and we want to exploit POSIX code, \p{Punct}. However, we do not want to cover all punctuations in the \p{Punct} class. For example, we want to … Continue reading

Posted in Java | 2 Comments

Installation of JDk1.6.0_04 X64 on Debian Etch AMD64

1) Download jdk1.6.0_04 x64 version for Linux from http://java.sun.com 2) Add executable permission to the current user. >chmod u+x jdk-6u4-linux-amd64.bin 3) Install the software >./jdk-6u4-linux-amd64.bin The JDK will be installed in the current working directory as jdk1.6.0_04. Therefore, if we … Continue reading

Posted in Java, Linux | 4 Comments

JList is not scrollable.

I am developing a tool for text mining. I use JList to hold all unique terms and their statistically significant values. I encounter a problem that when I create JList and put it into JScrollPane, the JScrollPane is not scrollable. … Continue reading

Posted in Java | 4 Comments