Posts Tagged ‘java’

Disappearing menu in Netbeans aka Java GUI issue

March 15th, 2014 2 comments

The actual Netbeans 7.4 is showing some really annoying behaviour. In fullscreen mode, menus disappear on releasing the mouse button and/or selections seem to have an offset to the mouse position. Due to several threads in the Internet, this problem is caused by the JDK, is independent from the software (Netbeans in my case) and the JDK version, and exists for several years now. A miscalculation of the mouse position after window resizing (or something related) seems to be responsible.

Workaround (Works with Netbeans, have no idea if too with other applications):

  • Netbeans should start in non-fullscreen mode by default
  • Move the window to the upper left corner of your screen (probably your window manager will have some snap-on functionality there)
  • Now maximize the window

This seams to work for oracle- and openJDK v7 and Debian/Gnome3 and according to the Web for several other Linux distributions and desktop environments.

Please insert excessive Java rant here.

Categories: wtf Tags: , ,

Update-alternatives by example

March 13th, 2014 2 comments

Hi everyone,

some Linux distributions are using a symlink-based method to manage multiple versions of the same binary. For example one could have several Java VM version installed on the same system. Usually typing the java command will start one of them … but which one? The command update-alternatives manages a set of symlinks, located in /etc/alternatives by default, which refer to the correct binary. In the case of java, /etc/alternatives/java will refer to the binary somewhere in /usr/lib/jvm (for Debian). To change this link just call:

sudo update-alternatives –config java
There are 2 choices for the alternative java (providing /usr/bin/java).

Selection Path Priority Status
* 0 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 auto mode
1 /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java 1061 manual mode
2 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 manual mode

Press enter to keep the current choice[*], or type selection number:

The command’s output will show a list of installed alternatives for this binary, which will be configured by the packet manager. Selecting a number will change the symlink.

To add a custom alternative, update-alternatives –install is used. The description of this command can be found in it’s manpage, but I think an example will make it more clear. Let’s say we got JDK7 from the oracle website and want to add it. First install/copy it do a useful destination. I’ve chosen /usr/lib/jvm/java-7-sunjdk-amd64/jdk/. 😉

update-alternatives –install /usr/bin/java java /usr/lib/jvm/java-7-sunjdk-amd64/jdk/bin/java 1072

The first parameter (excluding –install) is the path of the symlink your system will use to find the binary. Therefore, it has to be at a location listed in your PATH environment variable. Thereafter, the name of the group is specified followed by the absolute location of the binary. A group is an alias which assorts the similar binaries. Finally, a priority value is set. The result looks like this:

update-alternatives –config java
There are 3 choices for the alternative java (providing /usr/bin/java).

Selection Path Priority Status
0 /usr/lib/jvm/java-7-sunjdk-amd64/jdk/bin/java 1072 auto mode
* 1 /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java 1061 manual mode
2 /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java 1071 manual mode
3 /usr/lib/jvm/java-7-sunjdk-amd64/jdk/bin/java 1072 manual mode


Categories: linux Tags: ,

Ubuntu with Oracle/SUN JRE/JDK

December 17th, 2010 No comments

In the current Ubuntu one can only get the open-jre and open-jdk installed via apt(itude). Because of some major issues concerning Swing, I needed to install the sun-jre and sun-jdk. To make this possible you have to edit /etc/apt/sources.list as root (or with sudo 😉 ). Uncomment the two following lines close to the end of the file.

deb lucid partner
deb-src lucid partner

Save the file and do a

sudo aptitude update


sudo apt-get update

After that you can install the packages sun-java6-jre and sun-java6-jdk with an aptitude search (or apt-cache search) ready for installation. For using this runtime environment as systems default you need to do a

sudo update-alternatives --config java

which produces output similar to the following(sorry for the german bash 😉 )

Es gibt 2 Auswahlmöglichkeiten für die Alternative java (welche /usr/bin/java bereitstellen).

Auswahl      Pfad                                      Priorität Status
* 0          /usr/lib/jvm/java-6-openjdk/jre/bin/java   1061      Auto-Modus
1            /usr/lib/jvm/java-6-openjdk/jre/bin/java   1061      manueller Modus
2            /usr/lib/jvm/java-6-sun/jre/bin/java       63        manueller Modus

Drücken Sie die Eingabetaste, um die aktuelle Wahl[*] beizubehalten,
oder geben Sie die Auswahlnummer ein:

choose the correct number (here: 2), hit Enter…done!

Categories: linux, software Tags: , , , ,

Java 4 ever

July 1st, 2010 No comments
Categories: fun, nerdcore, software Tags: ,