Saturday, November 1, 2008

Printing from Java with CUPS 1.3+

I had a problem with printing from the Java application on my Fedora 9. The problem was quite strange and reproducible on both Java 1.5. and 1.6. It was even more strange because it appeared only after I've updated my Fedora to version 9.
It turned out that the problem was on the level where Java meets CUPS 1.3+. There is a corresponding Sun's bug. There is no such problem for CUPS version lover than 1.3. It looks like Java had made too many assumption how CUPS should work... and CUPS guys changed some things in 1.3.
As always Google came with help and the solution was found.

Friday, October 31, 2008

Java 1.4 on Fedora 9

Recently I needed to work on a legacy Swing project written on Java 1.4. So, I've installed 1.4 JDK on my Fedora 9 and... got a following error:
/usr/java/j2sdk1.4.2_16/jre/lib/i386/libawt.so: libXp.so.6: cannot open shared object file: No such file or directory occurred
A little googling brought me to the Oracle forum post. The problem was that AWT requires the libXp package. After I've installed it the problem vanished :)

Friday, May 30, 2008

Java 1.6 on Mac... at last!

It is here. After 1.5 years. Java 1.6 on Mac. But... it is only for the Leopard and only for 64-bit Intel machines.
PPC, 32-bit Intel and Tiger folks are currently still out of the board.
There are two interesting facts regarding this Apple's release.
  1. It was not announced on Apple Developer Connection Java topics RSS. In fact that feed is useless. I'm still receiving here a bunches of 3 identical notifications about release notes for Java on Mac 10.5. The date when this document was published is 2007-10-31. Yeah, after 6 month Apple still reminds me (and the other subscribers of that feed) about such "news".
  2. Almost month passed since Java 1.6 on Mac release. And there is complete silence about this event on the Desktop community on java.net. This is rather strange - there was a lot of complains about long absence of this release (e.g. here and here).
Anyway, it's good it is here.

Wednesday, May 7, 2008

Running TestNG on NetBeans 6.0

TestNG is a great testing framework. And it's much more powerful than JUnit.
The problem for NetBeans 6.0 users is that there is no plugin for TestNG. I've spend a lot of time before I managed to run TestNG in a simple way. After some time I've figured out that the main obstacle is that NetBeans does not recognizes TestNG classes as test classes. And this was the key to success.
I've successfully run the tests using its command line and NetBeans Run feature. And it was done on the NetBeans Java SE bundle (the simplest one).
So, here are the simple steps to launch TaestNG on NetBeans:
  1. Project Properties -> Libraries. Compile-time libraries must contain testng-XXX.jar (where XXX is your TestNG version). Also Run-time libraries must contain the path to your compiled tests (if you put your test to default test directory, than the path to compiled tests should be build/test/classes).
  2. Create TestNG xml file(s). There are instructions how to build such file in the framework site. E.g. create testng.xml and put it in the project root.
  3. Project Properties -> Run. Create new configuration. You may name is testNG ;) Enter org.testng.TestNG as the Main Class. Put your TestNG xml file(s) as Arguments. Multiple xml files should be separated by space. Enter your project directory as Working Directory.
Congratulations! Now you can run your TestNG tests through NetBeans Run feature.

P.S. Even if there will be only one person on Earth who saves a few hours this post worth its writing.

Monday, March 3, 2008

Regular method call vice call through reflection

This summary is not available. Please click here to view the post.

Monday, January 21, 2008

openSUSE 10.3 and microphone

Recently I've bought a microphone. While this device works fine without configuring on MS Windows, you need to apply some efforts to make it work on Linux.
On my current system (openSUSE 10.3) the sound recorder application KRecord did not recorded anything :) I've played with KMix for some time but I did not managed to record anything. Fortunately, I have more luck with Skype.
As it is correctly emphasized on some forums, the key option for making the microphone work fine on Linux is KMix > Switches > Mic Boost. It was disabled on my openSUSE by default. And if this option is disabled, your voice is almost not heard.
The bad thing is that this option is not saved. So, you have to enable it every time you boot your system.