Thursday, November 12, 2015

Java 8 and Swing redraw issues.

Ever since Java 8 got installed on my Windows 10 machine, it's been easy to completely mess up the re-draw on Java swing applications. Move the mouse over the program enough times and things go haywire.

I've noticed this in an early release of Android Studio 1.4 , a product called Freephoneline, and most noticeably, a Netbeans RCP that I wrote and sell.

It turns out that the problem is in Java 8 itself. Swing's rendering and Microsofts Direct draw do not play nice together.

To fix this problem in my Netbeans RCP product, I've added the command line parameters:

-J-Dsun.java2d.noddraw=true -J-Dsun.java2d.dpiaware=true

to my installation, which seem to fix the problem. See my previous post on where to do it.

I'm told that: -Dsun.java2d.d3d=false will also work


Monday, November 9, 2015

Customizing the Netbeans RPC Installer for Java Command Line parameters

Locate the app.conf file in "Netbeans"/harness/etc

This is used to build the installer for your RPC application.

For example, I needed more memory for my application, so I changed this:

# options used by the launcher by default, can be overridden by explicit
# command line switches
default_options="--branding ${branding.token} -J-Xms24m -J-Xmx64m"

To this:

# options used by the launcher by default, can be overridden by explicit
# command line switches
default_options="--branding ${branding.token} -J-Xms256m -J-Xmx1024m"


I've also added:
-Dsun.java2d.d3d=false
to hopefully turn off the wonky swing redrawing issues with Java 8