Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (515)
Games in Android Showcase (122)
games submitted by our members
Games in WIP (577)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  running Java4k on Ubuntu Linux  (Read 1767 times)
0 Members and 1 Guest are viewing this topic.
Offline Damocles
« Posted 2013-02-16 15:05:49 »

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)

 

Offline pjt33
« Reply #1 - Posted 2013-02-21 19:17:19 »

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.

<snip>

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

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.
Offline jonjava
« Reply #2 - Posted 2013-02-21 19:53:19 »

... why can't OpenJDK run 4k applets?

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Damocles
« Reply #3 - Posted 2013-02-21 19:55:09 »

Because it exits with an exception.

Offline jonjava
« Reply #4 - Posted 2013-02-21 19:56:42 »

Hoooh, what kind of exception?

Offline Damocles
« Reply #5 - Posted 2013-02-21 20:00:50 »

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.

Offline gouessej
« Reply #6 - Posted 2013-02-21 20:21:50 »

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

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.
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.

Thus the tip to use the oracle-jre when using Linux.
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)

Offline Damocles
« Reply #7 - Posted 2013-02-21 20:39:32 »

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

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
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.

Offline zeroone
« Reply #8 - Posted 2013-02-21 20:44:50 »

Does the mirror work for you?

http://meatfighter.com/java4k2013/dord/
Offline Damocles
« Reply #9 - Posted 2013-02-21 20:47:48 »

unfortunately not,
Looks like I need OpenJDK-7.

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
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

Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline gouessej
« Reply #10 - Posted 2013-02-21 20:53:43 »

Maybe use update-alternatives.

Offline zeroone
« Reply #11 - Posted 2013-02-21 20:55:16 »

Maybe use update-alternatives.

Agreed.  It looks like the default JRE is not Java 7.
Offline gouessej
« Reply #12 - Posted 2013-02-21 20:57:59 »

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.

Offline Damocles
« Reply #13 - Posted 2013-02-21 21:02:37 »

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)

 Huh

Offline gouessej
« Reply #14 - Posted 2013-02-21 21:08:55 »

J2SE 7 = 51
source

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

Offline Jimmt
« League of Dukes »

JGO Kernel


Medals: 136
Projects: 4
Exp: 3 years



« Reply #15 - Posted 2013-02-21 23:31:31 »

What's wrong with the standard JDK? I ran it on ubuntu and it's fine for applets.
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

TehJavaDev (31 views)
2014-10-27 03:28:38

TehJavaDev (26 views)
2014-10-27 03:27:51

DarkCart (40 views)
2014-10-26 19:37:11

Luminem (21 views)
2014-10-26 10:17:50

Luminem (25 views)
2014-10-26 10:14:04

theagentd (31 views)
2014-10-25 15:46:29

Longarmx (61 views)
2014-10-17 03:59:02

Norakomi (57 views)
2014-10-16 15:22:06

Norakomi (46 views)
2014-10-16 15:20:20

lcass (43 views)
2014-10-15 16:18:58
Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!