Showing posts with label java. Show all posts
Showing posts with label java. Show all posts

Wednesday, August 11, 2010

InstallShield Wizard Fails With OpenJDK

I tried installing software packaged using InstallShield but each time I ran the installer it would fail with the message:

could not load wizard specified in /wizard.inf (104)

The problem turned out to be that after recently installing Lucid Lynx the JRE is OpenJDK, even though I had installed the Sun Java packages (sun-java6-*) I hadn't updated my Java alternatives. All that was needed was to switch to the Sun JRE, thus:

sudo update-java-alternatives -v -s java-6-sun

In fact, I subsequently removed all OpenJDK-related packages.

Wednesday, March 18, 2009

Java Plug-In Next Generation with Firefox 3.0

I wanted to use Sun's Java Plug-In "Next Generation" (NG) with Firefox 3.0. However, at the time of writing the latest packages available in Ubuntu's repositories are sun-java6-*, which correspond to Java 6.0 update 7. This contains the "classic" plug-in; the NG plug-in was introduced in Java 6.0 update 10.

So, I downloaded the latest Sun JDK - v6.0 update 12 - and installed it in /opt/java. Then I performed the following steps:
  1. Create a symbolic link from /usr/lib/jvm to the installed JDK
    cd /usr/lib/jvm
    sudo ln -s /opt/java/jdk1.6.0_12 java-6u12-sun

  2. Created /usr/lib/jvm/.java-6u12-sun.jinfo. I simply copied .java-6-sun and editted (see below).
    Note, that in order to use the NG rather than "classic" plug-in, I specified /usr/lib/jvm/java-6u12-sun/jre/lib/i386/libnpjp2.so for the *-javaplugin.so alternatives. I also needed to add an entry for firefox-3.0-javaplugin.so, which is missing from .java-6-sun.jinfo.
  3. Installed alternatives for /usr/lib/jvm/java-6u12-sun. For each line of .java-6u12-sun.jinfo I ran update-alternatives --install, e.g.
    sudo update-alternatives --install \
    /usr/bin/firefox-3.0-javaplugin.so \
    firefox-3.0-javaplugin.so \
    /usr/lib/jvm/java-6u12-sun/jre/lib/i386/libnpjp2.so \
    64
    
    Doing this manually is a bit tedious, so I created a Perl script to do - see below.

  4. Selected the java-6u12-sun jav alternative, i.e.
    sudo update-java-alternatives -s java-6u12-sun
The /usr/lib/.java-6u12-sun.jinfo I created in step 2.
name=java-6-sun-1.6.0.12
alias=java-6u12-sun
priority=64
section=non-free

jre ControlPanel /usr/lib/jvm/java-6u12-sun/jre/bin/ControlPanel
jre java /usr/lib/jvm/java-6u12-sun/jre/bin/java
jre java_vm /usr/lib/jvm/java-6u12-sun/jre/bin/java_vm
jre javaws /usr/lib/jvm/java-6u12-sun/jre/bin/javaws
jre jcontrol /usr/lib/jvm/java-6u12-sun/jre/bin/jcontrol
jre keytool /usr/lib/jvm/java-6u12-sun/jre/bin/keytool
jre pack200 /usr/lib/jvm/java-6u12-sun/jre/bin/pack200
jre policytool /usr/lib/jvm/java-6u12-sun/jre/bin/policytool
jre rmid /usr/lib/jvm/java-6u12-sun/jre/bin/rmid
jre rmiregistry /usr/lib/jvm/java-6u12-sun/jre/bin/rmiregistry
jre unpack200 /usr/lib/jvm/java-6u12-sun/jre/bin/unpack200
jre orbd /usr/lib/jvm/java-6u12-sun/jre/bin/orbd
jre servertool /usr/lib/jvm/java-6u12-sun/jre/bin/servertool
jre tnameserv /usr/lib/jvm/java-6u12-sun/jre/bin/tnameserv
jre jexec /usr/lib/jvm/java-6u12-sun/jre/lib/jexec
jdk HtmlConverter /usr/lib/jvm/java-6u12-sun/bin/HtmlConverter
jdk appletviewer /usr/lib/jvm/java-6u12-sun/bin/appletviewer
jdk apt /usr/lib/jvm/java-6u12-sun/bin/apt
jdk extcheck /usr/lib/jvm/java-6u12-sun/bin/extcheck
jdk idlj /usr/lib/jvm/java-6u12-sun/bin/idlj
jdk jar /usr/lib/jvm/java-6u12-sun/bin/jar
jdk jarsigner /usr/lib/jvm/java-6u12-sun/bin/jarsigner
jdk java-rmi.cgi /usr/lib/jvm/java-6u12-sun/bin/java-rmi.cgi
jdk javac /usr/lib/jvm/java-6u12-sun/bin/javac
jdk javadoc /usr/lib/jvm/java-6u12-sun/bin/javadoc
jdk javah /usr/lib/jvm/java-6u12-sun/bin/javah
jdk javap /usr/lib/jvm/java-6u12-sun/bin/javap
jdk jconsole /usr/lib/jvm/java-6u12-sun/bin/jconsole
jdk jdb /usr/lib/jvm/java-6u12-sun/bin/jdb
jdk jhat /usr/lib/jvm/java-6u12-sun/bin/jhat
jdk jinfo /usr/lib/jvm/java-6u12-sun/bin/jinfo
jdk jmap /usr/lib/jvm/java-6u12-sun/bin/jmap
jdk jps /usr/lib/jvm/java-6u12-sun/bin/jps
jdk jrunscript /usr/lib/jvm/java-6u12-sun/bin/jrunscript
jdk jsadebugd /usr/lib/jvm/java-6u12-sun/bin/jsadebugd
jdk jstack /usr/lib/jvm/java-6u12-sun/bin/jstack
jdk jstat /usr/lib/jvm/java-6u12-sun/bin/jstat
jdk jstatd /usr/lib/jvm/java-6u12-sun/bin/jstatd
jdk jvisualvm /usr/lib/jvm/java-6u12-sun/bin/jvisualvm
jdk native2ascii /usr/lib/jvm/java-6u12-sun/bin/native2ascii
jdk rmic /usr/lib/jvm/java-6u12-sun/bin/rmic
jdk schemagen /usr/lib/jvm/java-6u12-sun/bin/schemagen
jdk serialver /usr/lib/jvm/java-6u12-sun/bin/serialver
jdk wsgen /usr/lib/jvm/java-6u12-sun/bin/wsgen
jdk wsimport /usr/lib/jvm/java-6u12-sun/bin/wsimport
jdk xjc /usr/lib/jvm/java-6u12-sun/bin/xjc
plugin xulrunner-1.9-javaplugin.so /usr/lib/jvm/java-6u12-sun/jre/lib/i386/libnpjp2.so
plugin firefox-javaplugin.so /usr/lib/jvm/java-6u12-sun/jre/lib/i386/libnpjp2.so
plugin firefox-3.0-javaplugin.so /usr/lib/jvm/java-6u12-sun/jre/lib/i386/libnpjp2.so
plugin iceape-javaplugin.so /usr/lib/jvm/java-6u12-sun/jre/lib/i386/libnpjp2.so
plugin iceweasel-javaplugin.so /usr/lib/jvm/java-6u12-sun/jre/lib/i386/libnpjp2.so
plugin mozilla-javaplugin.so /usr/lib/jvm/java-6u12-sun/jre/lib/i386/libnpjp2.so
plugin midbrowser-javaplugin.so /usr/lib/jvm/java-6u12-sun/jre/lib/i386/libnpjp2.so
plugin xulrunner-javaplugin.so /usr/lib/jvm/java-6u12-sun/jre/lib/i386/libnpjp2.so


The perl-script used in step 3. above. Copy-and-paste into /tmp/java6u12sun.pl then:
cd /tmp
chmod +x java6u12sun.pl
sudo ./java6u12sun.pl

-----
#!/usr/bin/perl

use strict;

# Read .jinfo file.
my @lines = ();
open(JINFO, '/usr/lib/jvm/.java-6u12-sun.jinfo')
or die "Can't open .jinfo file.";
@lines = ;
close(JINFO);

# Install alternatives.
for (@lines)
{
if ($_=~ m+/usr/lib/jvm/java-6u12-sun+)
{
my @split = split ' ', $_;
system "update-alternatives --install /usr/bin/@split[1]  @split[1]  @split[2] 64";
}
}

1;

Wednesday, October 15, 2008

Sun Java 6.0 update 7 resets alternatives

For some reason the recent updates for the sun-java6-* packages to v6-07-3 reset my Java alternatives to java-6-openjdk. Fixed with

sudo update-java-alternatives -s java-6-sun

Monday, July 21, 2008

SOLVED: Firefox 3 Sun Java Plug-In

Having recently switched from Firefox 2 to Firefox 3, I found that the Java Plug-In was no longer working. Looking at the list of browser plugins being used by Firefox 3 (enter "about:plugins" in the browser's navigation field) I discovered that the OpenJDK GCJ was being used rather than Sun's JRE v6.0 plugin (from the sun-java6-* packages).

It took some time to work out why this was the case - /usr/lib/firefox/plugins contained a symbolic link to /etc/alternatives/mozilla-firefox-javaplugin.so, which in turn was set to Sun's JRE v6.0 plug-in.

The only Java Plug-In alternative set to OpenJDK's was that of xulrunner-1.9. So, I changed it's setting to Sun's JRE v.6.0 of the plugin:

sudo update-alternatives --config xulrunner-1.9-javaplugin.so

and upon restarting Firefox 3 it used Sun's Java Plug-In.

Very weird, and possibly related to this bug?

Friday, May 16, 2008

Compiz effects causing problems for Java Swing applications

As a Java developer I use IntelliJ's IDEA Java IDE, which is itself a Java Swing application. Unfortunately, after upgrading to Hardy Heron I noticed that some IDEA dialogs weren't being displayed as empty windows. This turns out to be a known bug with Java Swing and Compiz.

I tried two workarounds:
  1. Setting the environment variable AWT_TOOLKIT=MToolkit. This solved the problem with empty Swing dialog windows but introduced a new problem with windows losing keyboard focus.
  2. I also installed Sun's JDK6.0 update 10 beta (build24) and used this to run IntelliJ IDEA. Compiz now works correctly with IntelliJ IDEA.

Saturday, June 16, 2007

Sun Java6

I decided to update my Java Runtime Environment (JRE) and development kit (JDK). I simply installed the following packages using Synaptic:
  • sun-java6-bin
  • sun-java6-demo
  • sun-java6-doc
  • sun-java6-fonts
  • sun-java6-jdk
  • sun-java6-jre
  • sun-java6-plugin
  • sun-java6-source
I did not have to uninstall any of my existing (1.5, 1.4.2 & 1.3.1) JDKs and JREs.

Thursday, August 24, 2006

Sun JDK1.3.1

I needed to install Sun's Java SDK v1.3.1, so I downloaded and installed j2sdk-1_3_1_18-linux-i586. However, when attempting to run it the following error was produced.
$ /opt/jdk1.3.1_18/bin/java
/opt/jdk1.3.1_18/bin/i386/native_threads/java: error while loading shared libraries: libstdc++-libc6.1-1.so.2: cannot open shared object file: No such file or directory
To workaround this I installed the GNU stdc++ library (libstdc++2.10-glibc2.2) using Synaptic. This creates the file /usr/lib/libstdc++-3-libc6.2-2-2.10.0.so which I then symlinked to libstdc++-libc6.1-1.so.2 as follows:
$ cd /usr/lib
$ sudo ln -s libstdc++-3-libc6.2-2-2.10.0.so libstdc++-libc6.1-1.so.2

Monday, June 19, 2006

Installing Sun's Java - Problem Solved

A recent problem I had installing Sun's Java5 package for Ubuntu turned out to be due to me having misconfigured Synaptic's repositories; I hadn't properly referenced the multiverse repository. Once I had corrected this as described in this guide, I was able to install the sun-java5 packages using Synaptic.

After installation I ran sudo update-alternatives --config java and selected /usr/lib/jvm/java-1.5.0-sun/jre/bin/java as the default java.

Monday, June 12, 2006

Installing Sun's Java

[ Update: problem solved ]

It appears that at one time Sun's Java 5 was available for installation via apt-get/Synaptic (sun-java5-* packages). This no longer appears to be the case and I suspect it's related to recent problems with the terms of Sun's Java license.

Therefore, to install the JRE/JDK one must resort to the standard download and installation process from Sun's web-site. For example, to install the Sun's Java runtime environment (JRE 5.0 Update 7) do the following:
  1. download the self-extracting bin file
  2. make executable
    chmod +x jre-1_5_0_07-linux-i586.bin
  3. run the executable (requires acceptance of the terms of the license)
    sudo ./jre-1_5_0_07-linux-i586.bin
  4. move the extracted file-tree to a suitable location
    sudo mv jre1.5.0_07/ /opt
  5. configure the browser plug-in, e.g. for Firefox:
    cd /usr/lib/firefox/plugins/
    sudo ln -s /opt/jre1.5.0_07/plugin/i386/ns7/libjavaplugin_oji.so
  6. set your JAVA_HOME environment variable and put it into your PATH variable e.g. in $HOME/.bash_profile add
    JAVA_HOME=/opt/jre1.5.0_07
    PATH="${PATH}:${JAVA_HOME}/bin"
  7. To run the Control Panel
    ControlPanel