Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (581)
games submitted by our members
Games in WIP (500)
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  
  JNLP Solution Posted  (Read 1902 times)
0 Members and 1 Guest are viewing this topic.
Offline Jeff

JGO Coder




Got any cats?


« Posted 2003-09-30 19:30:51 »

Okay,

I just updated CVS with a version that has a solution (I hope) for the JNLP problem.

Setting the property "net.java.games.util.plugins.nolocalnative" to any value on your java command line
(eg "-Dnet.java.games.util.plugins.nolocalnative=true")
will force it to skip the code that makes it look in the Jar's directory for the native lib and instead fall back to whatever the default behavior is for that environment.

Recognize that in this mode there may be plug-ins with
name conflicts for their local libs that cannot be used together.


Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline gregorypierce

Senior Member




I come upon thee like the blue screen of death....


« Reply #1 - Posted 2003-09-30 20:18:40 »

What is the behavior going to be for jogl and joal? I'm still confused as to why jogl works just peachy yet jinput has issues.

http://www.gregorypierce.com

She builds, she builds oh man
When she links, she links I go crazy
Cause she looks like good code but she's really a hack
I think I'll run upstairs and grab a snack!
Offline gregorypierce

Senior Member




I come upon thee like the blue screen of death....


« Reply #2 - Posted 2003-09-30 20:35:44 »

Nevermind, I understand what the issue is now. What is odd is that the JUtil plugin engine doesn't use the context classpath classloader when trying to load classes.

Jeff the fix that you put in is using the context classpath classloader or does it do something else?

http://www.gregorypierce.com

She builds, she builds oh man
When she links, she links I go crazy
Cause she looks like good code but she's really a hack
I think I'll run upstairs and grab a snack!
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline TheBohemian

Junior Member




Java will rule them all!


« Reply #3 - Posted 2003-09-30 22:49:07 »

I am suprised too. I thought I had found the solution already?

Did I forget to make clear that using the context classloader solves all the problems?

I thought using a property like net.java.games.util.plugins.nolocalnative broke the intention of the plugin mechnism because the native library (the plugin) has to be mentioned in the JNLP file.

Taking the context classloader-approach doesn't need this. Still you have pre-install the plugin but that can now be done with an installer.

cya

TheBohemian

---------------------------------------
my favorite OS: http://jnode.sf.net
Java 1.5 -> 1.4 converter: http://retroweaver.sf.net
Offline Jeff

JGO Coder




Got any cats?


« Reply #4 - Posted 2003-09-30 23:17:48 »

Quote
Nevermind, I understand what the issue is now. What is odd is that the JUtil plugin engine doesn't use the context classpath classloader when trying to load classes.

Jeff the fix that you put in is using the context classpath classloader or does it do something else?


All the fix does is disable the override of getLibrary on the plug-in class loader.  That over-ride is what makes it find the DLL in the same directory as the plug-in.

So with the porperty defined its now using the default class loader behavior for finding the native library, which I assume is what JOGL and JOAL do since they likely don't define custom class loaders at all.


Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline Jeff

JGO Coder




Got any cats?


« Reply #5 - Posted 2003-09-30 23:21:14 »

Quote
I am suprised too. I thought I had found the solution already?

Did I forget to make clear that using the context classloader solves all the problems?


When you say "context classloader" what are you referring to?  The bootloader?  The classpath class loader?  I'm afraid I'm not following the term.

Quote

I thought using a property like net.java.games.util.plugins.nolocalnative broke the intention of the plugin mechnism because the native library (the plugin) has to be mentioned in the JNLP file.


Yep it does.  I just accepted that as a limitation of JNLP distributed code, that they are going to have to have apriori knowledge of what plugins they are using.  Since you need this knowledge ANYWAY to prepare the download jars, it didn't seem to me like it was making things any more limited then they already are Wink

Quote

Taking the context classloader-approach doesn't need this. Still you have pre-install the plugin but that can now be done with an installer.


Right, and thats a great solution if the player wants to install it into his/her JRE, but I wanted to make both options still available to JNLP programs.  (Install into JRE or make a part of your app.)

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline TheBohemian

Junior Member




Java will rule them all!


« Reply #6 - Posted 2003-10-01 14:06:33 »

Quote
When you say "context classloader" what are you referring to?  The bootloader?  The classpath class loader?  I'm afraid I'm not following the term.


I thought of this one: Thread.currentThread().getContextClassLoader(). When accessing resources in a JNLP application one has to use this instead of the SystemClassLoader.

Quote

Right, and thats a great solution if the player wants to install it into his/her JRE, but I wanted to make both options still available to JNLP programs.  (Install into JRE or make a part of your app.)


To achieve this (both options) it is neccessary to change the  code in Plugins.java and PluginLoader.java to use the context classloader as well. Using the property to get things working only, results in being unable to load any installed plugin (security or classnotfound exception like I mentioned in the other thread).


cya

TheBohemian

---------------------------------------
my favorite OS: http://jnode.sf.net
Java 1.5 -> 1.4 converter: http://retroweaver.sf.net
Offline Jeff

JGO Coder




Got any cats?


« Reply #7 - Posted 2003-10-01 21:09:16 »

Ah.  I see.  What you are referring to is the loader used by the current class, in other words JWS's own custom class laoder.

This makes sense.  I'll change the parenting of the plugin-loader so iuts created as a child of the currentContextLoader.

Shouldn't be hard Smiley  I'l let you know when its done and if you can test it that would be great.



Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline Jeff

JGO Coder




Got any cats?


« Reply #8 - Posted 2003-10-01 22:47:01 »

Okie.

I've updated the Jutils PluginLoader code so that it creates itself using the current thread context loader.

Give it a shot and see if it works please?

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline TheBohemian

Junior Member




Java will rule them all!


« Reply #9 - Posted 2003-10-02 00:09:17 »

I wonder if you had read my long post in the other thread

*quoting myself* Cheesy

Quote

The only real problem is that PluginLoader is created without a parent that is able to find the class ControllerEnvironment. I think it would be pretty easy to fix the problems we have at the moment:
PluginLoader should be given the context class loader as parent!

*modifying jutils*
*recompiling*
*signing*

I can happily admit: This works! It fixes all problems!


Nice to have an official solution. Now I can change my jinputtester Smiley

cya

TheBohemian

---------------------------------------
my favorite OS: http://jnode.sf.net
Java 1.5 -> 1.4 converter: http://retroweaver.sf.net
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Jeff

JGO Coder




Got any cats?


« Reply #10 - Posted 2003-10-06 16:40:59 »

YepI had read it but I didn't completely follow it.  I had to work through
the issues myself to understand why it was necessary.

Gald it works now!  Thanks guys for bearing with me and pushing on this Smiley

JK

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline TheBohemian

Junior Member




Java will rule them all!


« Reply #11 - Posted 2003-10-07 00:48:16 »

Hm. I think that it is not working correctly. More details here:
http://www.JavaGaming.org/cgi-bin/JGNetForums/YaBB.cgi?board=jinput;action=display;num=1064272481;start=15#15

cya

TheBohemian

---------------------------------------
my favorite OS: http://jnode.sf.net
Java 1.5 -> 1.4 converter: http://retroweaver.sf.net
Offline Jeff

JGO Coder




Got any cats?


« Reply #12 - Posted 2003-10-15 02:44:03 »

AFAICS the referenced thread is old.

Are we now working correctly?  if not, what are the remaining issues?

JK

Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
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.

xsi3rr4x (54 views)
2014-04-15 18:08:23

BurntPizza (52 views)
2014-04-15 03:46:01

UprightPath (66 views)
2014-04-14 17:39:50

UprightPath (49 views)
2014-04-14 17:35:47

Porlus (66 views)
2014-04-14 15:48:38

tom_mai78101 (90 views)
2014-04-10 04:04:31

BurntPizza (150 views)
2014-04-08 23:06:04

tom_mai78101 (246 views)
2014-04-05 13:34:39

trollwarrior1 (204 views)
2014-04-04 12:06:45

CJLetsGame (211 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
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!