Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (498)
Games in Android Showcase (115)
games submitted by our members
Games in WIP (562)
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  
  -Djava.library.path and System.setProperty  (Read 3363 times)
0 Members and 1 Guest are viewing this topic.
Offline mgm

Junior Newbie





« Posted 2010-11-05 19:26:13 »

I have searched a bit before asking. I use netbeans. In my project, I use Slick and so lwjgl.
When I use-Djava... it works very well. on the other hand, when I use System.setProperty("java.library.path", "identic path")

IT give me the same path but lwjgl doesn't load...it said me unsatisfiedlink error no lwjgl in java.lib...
why?
my first line of the main is setProperty... Huh

its cool to develop but if my programme does not run out of the IDE its useless... Undecided

someone can give me a clue? or explain to me why?
my main class
Quote
package infl3Client;

import org.newdawn.slick.AppGameContainer;
import org.newdawn.slick.SlickException;

public class Main {
   public static void main(String[] args){
      System.setProperty("java.library.path", System.getProperty("user.dir")+"/res/lib/");
      System.out.println(System.getProperty("java.library.path"));
               
      try {
         AppGameContainer container = new AppGameContainer(new Game());
         container.setDisplayMode(1024,768,false);
         container.start();
      } catch (SlickException e) {}
   }
}
Offline cylab

JGO Ninja


Medals: 49



« Reply #1 - Posted 2010-11-05 21:00:28 »

Unfortunately simply calling setProperty() doesn't do the trick. There was a lengthy thread about this, leading to this solution

Mathias - I Know What [you] Did Last Summer!
Offline mgm

Junior Newbie





« Reply #2 - Posted 2010-11-05 22:54:02 »

thanks it's very helpful, its work ^^ (for the moment  Grin) I ' ll modify it to be more adapted to my needs.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline kappa
« League of Dukes »

JGO Kernel


Medals: 77
Projects: 15


★★★★★


« Reply #3 - Posted 2010-11-05 23:05:30 »

The above seems like a very hacky way to solve the problem.

Since you are using LWJGL you can simply use

1  
System.setProperty("org.lwjgl.librarypath", path);


instead of "java.library.path" to make it work.
Offline mgm

Junior Newbie





« Reply #4 - Posted 2010-11-05 23:45:19 »

yes it work too and is more simply but I need more than lwjgl... Jinput too and in future, need others too so I think the hacky way is better when you need more than one or two natives sources
Offline Nate

JGO Kernel


Medals: 147
Projects: 4
Exp: 14 years


Esoteric Software


« Reply #5 - Posted 2010-11-06 00:23:48 »

If you use your own classloader to load the classes that you don't control that are loading native libs, then you can override ClassLoader#findLibrary to control where the native libs are found.

Offline kappa
« League of Dukes »

JGO Kernel


Medals: 77
Projects: 15


★★★★★


« Reply #6 - Posted 2010-11-06 00:39:17 »

yes it work too and is more simply but I need more than lwjgl... Jinput too and in future, need others too so I think the hacky way is better when you need more than one or two natives sources

for Jinput you can use
1  
System.setProperty("net.java.games.input.librarypath", path);


however, if you need more natives then that, then cylabs method above should work pretty well.
Offline mgm

Junior Newbie





« Reply #7 - Posted 2010-11-06 07:59:08 »

I have not think about it... I do not control on what is loaded...

@kapta : Where did you find thoses lines of property which are very simple to use and maintain... Where did you find the key string associated to the native ?
Offline kappa
« League of Dukes »

JGO Kernel


Medals: 77
Projects: 15


★★★★★


« Reply #8 - Posted 2010-11-06 12:51:05 »

@kapta : Where did you find thoses lines of property which are very simple to use and maintain... Where did you find the key string associated to the native ?

in the source code for the two libraries, when I was looking for similar functionality.
Offline mgm

Junior Newbie





« Reply #9 - Posted 2010-11-06 15:28:05 »

Thanks I have not thinked about looking in source code  Roll Eyes
With a line like that its more easy to maintain the code and to read it Grin
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.

radar3301 (9 views)
2014-09-21 23:33:17

BurntPizza (28 views)
2014-09-21 02:42:18

BurntPizza (18 views)
2014-09-21 01:30:30

moogie (20 views)
2014-09-21 00:26:15

UprightPath (27 views)
2014-09-20 20:14:06

BurntPizza (29 views)
2014-09-19 03:14:18

Dwinin (46 views)
2014-09-12 09:08:26

Norakomi (74 views)
2014-09-10 13:57:51

TehJavaDev (102 views)
2014-09-10 06:39:09

Tekkerue (50 views)
2014-09-09 02:24:56
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

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
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!