Wednesday, October 15, 2008

Display Chinese characters in Eclipse console

Recently, I have been working on a project for a Chinese company. As a result, I want to display Chinese characters in Eclipse console. I am using Eclipse 3.3. I don't want to change Regional and language settings for Windows XP since it will influence other programs. After searching with google, I find the following solution work for me. First, we need to configure the JRE we are using in Eclipse.

  1. In Preferences->Java->Installed JREs, choose the JRE you are using.

  2. Click Edit to show Edit JRE dialog

  3. Input -Dfile.encoding=UTF-8 in Default VM Arguments


Second, we need to configure all the Run (Debug) configurations.

  1. In Common tab, select UTF-8 as Console Encoding


Eclipse 3.4 does not have this prolem. It can display Chinese correctly by default.

Monday, September 22, 2008

Notebook and Ballpoint Pen

My favorite note book and ballpoint pen

Wednesday, August 27, 2008

Swap CAPSLOCK and ESC key in Windows

I decide to do the swap because I use VIM a lot. Save the following text into a file such as swap.reg. Double click the file import the registry values.

REGEDIT4
[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Keyboard Layout]
"Scancode Map"=hex:00,00,00,00,00,00,00,00,03,00,00,00,3a,00,01,00,01,00,3a,00,00,00,00,00

Saturday, August 16, 2008

Build Ruby on Windows

Get the Ruby 1.8.7 source code from ftp://ftp.ruby-lang.org/pub/ruby/1.8/ruby-1.8.7-p71.tar.gz. Extract the source code to a directory such as D:/Ruby 1.8.7-p71 . Open a Visual Studio .NET 2003 Command Prompt. Run the following commands to compile ruby.
  • cd /d D:/Ruby 1.8.7-p71
  • win32\configure.bat
  • nmake
If the following error occurs, its means that Cygwin find is invoked from the make file. Make sure that windows find precedes Cygwin find in PATH environment variable.


Creating Makefile
find: `=': No such file or directory
NMAKE : fatal error U1077: 'cl' : return code '0x1'
Stop.

Saturday, August 2, 2008

HTTP Status 404 when running tomcat inside Eclipse

HTTP Status 404 will show up when I running tomcat inside Eclipse. And my resource exists. The error will disappear when I restart tomcat for some times. How many times I need to restart tomcat to remove the error is random. And the dialogs of Run on server wizard is random.

Sometimes, I get this error when using welcome-file-list. For some reasons, the welcome-file can be found.

I have used tomcat in Eclipse for some. My overall experience is bad. Maybe some improvements should be made on WTP. For now, I use ANT to deal with Tomcat. And it works well.

Classpath subtlety when using tomcat inside Eclipse

First, an eclipse dynamic web project only recognized classes produced by source folders configured in Java Build Path->Source and classes in the libraries under WebContent/WEB-INF/lib folder. The locations of source folders and class output folders do not matter if they are inside this project. The count of source folders and output folders also does not matter. By default, the output class folder is build/classes. It does not recognize the jar libraries which are not under WebContent/WEB-INF/lib and class folder configured in Java Build Path->Libraries. For class compilation, it is Ok. ClassNotFound exception will be thrown if you begin to use Run on server.

Wednesday, July 2, 2008

Running the Eclipse 3.4 formatter application

D:\gnu\eclipse\eclipse.exe -application org.eclipse.jdt.core.JavaCodeFormatter -config D:\gnu\jee\workspace\Concurrency\.settings\org.elipse.jdt.core.prefs d:\Foo.java