running Java4k on Ubuntu Linux

Ok, Java4k applets dont really run in your normal Ubuntu (Kubuntu, Mint) etc installation,
since The OpenJDK IcedTea Plugin is … well not capable to run them.

There are several tutorials online showing how to replace the OpenJDK JVM with the one from Oracle.

Anyhow, here my method of using a local Orcale JRE to run Applets on Firefox without replacing your OpenJDK


Manually Installing Orcale(Sun) Java in Ubuntu for Firefox


#1 get the JRE


go to the Oracle Java Downloadsite
http://www.oracle.com/technetwork/java/javase/downloads/jre7-downloads-1880261.html

download the current Linux release, for example: jre-7u13-linux-i586.tar.gz

extract the *.tar.gz folder into your Homefolder (I just used the normal Archive Manager here)
copy it to:
$HOME/javaInstallations/jre1.7.0_13

So you have the all the runtimefiles in your private Homefolder

Ok, its not the “propper” way to install it in you homefolder,
but you have more control over your Java installation this way.
(like your own portable installation)
And can run it independent of your current Java installation.


#2 make a Link to /lib/i386/libnpjp2.so


now you need to make a symbolic link to the
jre1.7.0_13/lib/i386/libnpjp2.so
file in the Firefox plugin directory.

go to :

cd /usr/lib/mozilla/plugins

check if the libnpjp2.so link is in this folder, if yes remove it

rm libnpjp2.so

now create a symbolic link to the file in the Java-runtime folder:

sudo ln -s $HOME/javaInstallations/jre1.7.0_13/lib/i386/libnpjp2.so

this should now run your Oracle Java in FireFox on Ubuntu


#3 Test it


You could run FireFox from a terminal to see the log-output, and verify wich version of the JRE
is running.
(when starting a Java Applet at Java4k.com for example)

That combination is what’s improper. There’s nothing wrong with installing the JRE within ~, but if you do that then put the symlink to the plugin in ~/.mozilla/plugins.

Personally I prefer to do the extra work to install the JRE in /usr/local and register it with the alternatives system.

… why can’t OpenJDK run 4k applets?

Because it exits with an exception.

Hoooh, what kind of exception?

I dont have it set up right now. But I remember some classnotfound execption.
On virtually any of the java4k games.

I did several linux installation, an it has never worked. Dont know what the exact reason is, but anyhow something
the casual user will not be able to circumvent.

Thus the tip to use the oracle-jre when using Linux.

Please give some more information.

There is still a bug affecting LWJGL applets, there are some problems with JNLP in applets but most of the time it works like a charm. I have used OpenJDK under GNU Linux for years under Lubuntu, Debian, Mandriva and Mageia.

I give you another tip: use OpenJDK, contribute, help the developers of Icedtea-web to implement the missing features and fix a few bugs.

Edit.: Griefer 4k works fine here:
java version “1.7.0_06-icedtea”
OpenJDK Runtime Environment (mageia-2.3.6.1.mga2-i386)
OpenJDK Client VM (build 23.7-b01, mixed mode)

example: DORD by zeroone (as I suppose he knows how to build a jar propperly)

http://www.java4k.com/index.php?action=games&method=view&gid=465


java version "1.6.0_27"
OpenJDK Runtime Environment (IcedTea6 1.12.1) (6b27-1.12.1-2ubuntu0.12.04.2)
OpenJDK Server VM (build 20.0-b12, mixed mode)
JAR http://www.java4k.com/applet.php?gid=465 not found. Continuing.
net.sourceforge.jnlp.LaunchException: Fatal: Initialization Error: Could not initialize applet. 
	at net.sourceforge.jnlp.Launcher.createApplet(Launcher.java:735)
	at net.sourceforge.jnlp.Launcher.getApplet(Launcher.java:676)
	at net.sourceforge.jnlp.Launcher$TgThread.run(Launcher.java:886)
Caused by: java.lang.ClassNotFoundException: a
	at net.sourceforge.jnlp.runtime.JNLPClassLoader.loadClass(JNLPClassLoader.java:1401)
	at net.sourceforge.jnlp.Launcher.createApplet(Launcher.java:725)
	... 2 more
Caused by: 
java.lang.ClassNotFoundException: a
	at net.sourceforge.jnlp.runtime.JNLPClassLoader.loadClass(JNLPClassLoader.java:1401)
	at net.sourceforge.jnlp.Launcher.createApplet(Launcher.java:725)
	at net.sourceforge.jnlp.Launcher.getApplet(Launcher.java:676)
	at net.sourceforge.jnlp.Launcher$TgThread.run(Launcher.java:886)
java.lang.NullPointerException
	at net.sourceforge.jnlp.NetxPanel.runLoader(NetxPanel.java:154)
	at sun.applet.AppletPanel.run(AppletPanel.java:381)
	at java.lang.Thread.run(Thread.java:679)
java.lang.NullPointerException
	at sun.applet.AppletPanel.run(AppletPanel.java:431)
	at java.lang.Thread.run(Thread.java:679)

while other applets such as my Griefer on another webpage (in my signature) work.

Seems it can load the jar, or is due to pack200 decryption or whatever.
But all the Java4k games just dont run.

Does the mirror work for you?

http://meatfighter.com/java4k2013/dord/

unfortunately not,
Looks like I need OpenJDK-7.


OpenJDK Runtime Environment (IcedTea6 1.12.1) (6b27-1.12.1-2ubuntu0.12.04.2)
OpenJDK Server VM (build 20.0-b12, mixed mode)
Exception in thread "Applet" java.lang.UnsupportedClassVersionError: a : Unsupported major.minor version 51.0
	at java.lang.ClassLoader.defineClass1(Native Method)
	at java.lang.ClassLoader.defineClass(ClassLoader.java:634)
	at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
	at java.net.URLClassLoader.defineClass(URLClassLoader.java:277)
	at java.net.URLClassLoader.access$000(URLClassLoader.java:73)
	at java.net.URLClassLoader$1.run(URLClassLoader.java:212)
	at java.security.AccessController.doPrivileged(Native Method)
	at java.net.URLClassLoader.findClass(URLClassLoader.java:205)
	at net.sourceforge.jnlp.runtime.JNLPClassLoader$CodeBaseClassLoader.findClass(JNLPClassLoader.java:1903)
	at net.sourceforge.jnlp.runtime.JNLPClassLoader.findClass(JNLPClassLoader.java:1509)
	at net.sourceforge.jnlp.runtime.JNLPClassLoader.loadClassExt(JNLPClassLoader.java:1526)
	at net.sourceforge.jnlp.runtime.JNLPClassLoader.loadClass(JNLPClassLoader.java:1341)
	at net.sourceforge.jnlp.Launcher.createApplet(Launcher.java:725)
	at net.sourceforge.jnlp.Launcher.getApplet(Launcher.java:676)
	at net.sourceforge.jnlp.Launcher$TgThread.run(Launcher.java:886)
java.lang.NullPointerException
	at net.sourceforge.jnlp.NetxPanel.runLoader(NetxPanel.java:154)
	at sun.applet.AppletPanel.run(AppletPanel.java:381)
	at java.lang.Thread.run(Thread.java:679)
java.lang.NullPointerException
	at sun.applet.AppletPanel.run(AppletPanel.java:431)
	at java.lang.Thread.run(Thread.java:679)


Its weired, because I have it installed, and linked the libnpjp2.so to it though
/usr/lib/jvm/java-7-openjdk-i386/jre/lib/libnpjp2.so

Maybe use update-alternatives.

Agreed. It looks like the default JRE is not Java 7.

But he shouldn’t tinker anything, using the provided packages in Synaptic should work.

However, it doesn’t work here too. I have no exception but it loops forever.

i used update-alternatives and switched to

Selection Path Priority Status

0 /usr/lib/jvm/java-6-openjdk-i386/jre/bin/java 1061 auto mode
1 /usr/lib/jvm/java-6-openjdk-i386/jre/bin/java 1061 manual mode

  • 2 /usr/lib/jvm/java-7-openjdk-i386/jre/bin/java 1051 manual mode

java -version
java version “1.7.0_13”
OpenJDK Runtime Environment (IcedTea7 2.3.6) (7u13-2.3.6-0ubuntu0.12.04.1)
OpenJDK Server VM (build 23.7-b01, mixed mode)

however it still throws an exception with

java version “1.6.0_27”
OpenJDK Runtime Environment (IcedTea6 1.12.1) (6b27-1.12.1-2ubuntu0.12.04.2)
OpenJDK Server VM (build 20.0-b12, mixed mode)

???

J2SE 7 = 51
source

Something is wrong in your configuration. Try to uninstall other versions of Java and Icedtea-web.

What’s wrong with the standard JDK? I ran it on ubuntu and it’s fine for applets.