Friday, February 10, 2006

BufferedImage needs Display under Unix


java.lang.InternalError: Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable.


set java.awt.headless=true

unless your system needs a gui, then, you need to google.

Thursday, February 09, 2006

A cool function

I wish i saw this when i had to do java homework, it would have helped.
to bad i never had to since reverse any numbers.

Wednesday, February 08, 2006

RMI on UNIX problems

so now that i have my server running on Freebsd, there is a slew of related problems:

i got this on the client:

RMI connection refused problem solved.
java.rmi.ConnectException: Connection refused to host:; nested exception is: Connection refused: connect

when i was connecting to the bsd server which isnt localhost by the way, the error seems to stem from the way i have my hosts file setup on bsd, and a quick solution is to include the following code when launching the server:


that fixes everything.

another problem im getting now has to do with BufferedImage. apperantly BufferedImage requires a screen to draw its image on. and i dont have one, when i shell into the system. i get this error:

java.lang.InternalError: Can't connect to X11 window server using ':0.0' as the value of the DISPLAY variable.

Solution will be presented when i find it.

RMI is pretty evil

new problems and their solutions:

any time you get an exception having to do with marshaling and you know that you have not changed any of your stubs, then its a codebase error! to fix:

into that directory you can put your stubs, tho there is a little catch there. you have to put them in like this
if the fully qualified name ofr Class_Impl_Stub is package1.subpackage.Class_Impl_Stub

people on the interweb say that using an http address is less troublesome then trying to use a file:// url

also, put your policy file into the same directory as your main jar file.

here is a good command line example of how i start my server:
>java -Djava.rmi.server.hostname= -Djava.rmi.server.codebase= -jar server.jar

note that server.jar contains a manifest file that points to all the libs it needs.

your client app should also have this codebase declaired obviously.