Eclipse or SUNrise...

Eclipse or SUNrise...
...JAVA for sure

Thursday, June 21, 2007

Problems with codepage on NetBeans 5.5

Some time ago, I was working in a project developed on Linux Ubuntu systems. The project was based on NetBeans 5.5 platform and everything went well, until I had to port the application to my private laptop, with Windows XP on it. After installing and configuring all the stuff, I tried to compile and deploy the app, but I got tons of errors. I quickly recalled that on Linux there is a standard unicode UTF-8 format codeing and on Windows I got the magic CP1250-whatever format which is Microsoft's equivalent of ISO8859-2 (middle-eastern European language type used in my country).

Normaly advanced editors (even the EditPlus) are cappable to switch the code-page and there is no problem with such matters. So to solve the problem I tried the NetBeans options. It was quite tricky to find the right one, especialy because you need to type it by yourself... Guys from Sun hidden it under

tools > options > advanced options > Editing > Java Sources

To make it clear, let me just show you. You have to type exactly "UTF-8"

Ok, so was it it? Nope... it wasn't. It fixed the characters so they looked fine but still the code wouldn't compile. After a while, I came up with something else to fix this. Because I didn't found any other options conected with java compiler on NetBeans I wrote a script which started NetBeans with proper compiler encoding. The script is very simple and looks like this:

"C:\Program Files\netbeans-5.5\bin\netbeans.exe" -J-Dfile.encoding=UTF-8

I made a shortcut on the desktop, and finally it worked just fine.

If it happens that you know a better sollution - please let me know. I have to check out if they fixed this on NetBeans6.

1 comment:

Masaki said...

Hi Sebastian, on NetBeans 6.0, these encoding setting for sources and compile can be specified on project property dialog. Please check the latest NetBeans 6.0 dev build and see "Source" category of your project property dialog. (