Thread: [sdljava-users] Problems with JavaSDL.. I've been trying for hours to get this to work.
Status: Beta
Brought to you by:
ivan_ganza
From: Chris D. <Des...@nt...> - 2005-02-13 23:09:00
|
Hi, I've no idea whatsoever about how to use JavaSDL at all. I downloaded the win32 compiled version, and I've followed the instructions in INSTALL, and yet it still isn't working. My default VM arguments are '-Djava.library.path=D:/Programming/eclipse/plugins/org.eclipse.swt.win32_3.1.0/os/win32/x86 -Djava.library.path="d:/Java Code/sdljava/lib"', and I've added 'sdljava.jar' to the Libraries section classpath of the Java Build Path section of the current project. My testing code, at the moment, is: public static void main(String[] args) { System.loadLibrary("sdljava"); try { SDLMain.init(SDLMain.SDL_INIT_EVERYTHING); } catch (SDLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } and it is giving me: Exception in thread "main" java.lang.UnsatisfiedLinkError: D:\Java Code\sdljava\ lib\sdljava.dll: Can't find dependent libraries at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(Unknown Source) at java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.loadLibrary0(Unknown Source) at java.lang.System.loadLibrary(Unknown Source) at LoachApp.main(LoachApp.java:10) However.. if I then remove 'System.loadLibrary("sdljava");', I get the following message: Exception in thread "main" java.lang.UnsatisfiedLinkError: get_SDL_PRESSED at sdljava.x.swig.SWIG_SDLMainJNI.get_SDL_PRESSED(Native Method) at sdljava.x.swig.SWIG_SDLMainConstants.<clinit>(SWIG_SDLMainConstants.java:12) at sdljava.SDLMain.<clinit>(SDLMain.java:37) at LoachApp.main(LoachApp.java:11) If anyone has got this working in Eclipse IDE, could someone guide me along? Thanks :D I've attached some screenshots if it helps. -- |>>> Dessimat0r /`\ | "We cannot turn back time, but we can _ _|_ _ move it forwards with our own hands." |;|_|;|_|;| \\. . / [www: http://codeknight.net ] \\: . / [e-mail: des...@nt... ] ||: U | /`\ [icq: 21477909 ] ||:. | [msn: des...@nt... ] \,/ ||: U.| ||: | \,/ ||: , | ____--`~--- '--~~__ __ ----~ - ~`---, -~--~ ~---__ ,--~' ~~----___ |
From: Robert S. <the...@gm...> - 2005-02-14 00:08:57
|
Hi Chris, at first I wonder whether this can work: -Djava.library.path=D:/Programming/eclipse/plugins/org.eclipse.swt.win32_3.1.0/os/win32/x86 -Djava.library.path="d:/Java Code/sdljava/lib" You should put both absolute filenames in one argument. On Windows you separate usually with a ; It should look like: -Djava.library.path=D:/Programming/eclipse/plugins/org.eclipse.swt.win32_3.1.0/os/win32/x86;"d:/Java Code/sdljava/lib" --- Exception in thread "main" java.lang.UnsatisfiedLinkError: D:\Java Code\sdljava\ lib\sdljava.dll: Can't find dependent libraries This one looks like sdljava's JNI library (sdljava.dll) cannot find SDL itself. If have no idea how you solve that on Windows elegantly. On GNU/Linux and other Unices we install libraries usually system wide which is less usually on Windows. As a workaround you can download SDL's DLLs from libsdl.org and put them in the same directory as sdljava.dll. cu Robert Chris Dennett wrote: > Hi, I've no idea whatsoever about how to use JavaSDL at all. I > downloaded the win32 compiled version, and I've followed the > instructions in INSTALL, and yet it still isn't working. > > My default VM arguments are > '-Djava.library.path=D:/Programming/eclipse/plugins/org.eclipse.swt.win32_3.1.0/os/win32/x86 > -Djava.library.path="d:/Java Code/sdljava/lib"', and I've added > 'sdljava.jar' to the Libraries section classpath of the Java Build > Path section of the current project. > > My testing code, at the moment, is: > > public static void main(String[] args) { > System.loadLibrary("sdljava"); > try { > SDLMain.init(SDLMain.SDL_INIT_EVERYTHING); > } catch (SDLException e) { > // TODO Auto-generated catch block > e.printStackTrace(); > } > } > > and it is giving me: > > Exception in thread "main" java.lang.UnsatisfiedLinkError: D:\Java > Code\sdljava\ > lib\sdljava.dll: Can't find dependent libraries > at java.lang.ClassLoader$NativeLibrary.load(Native Method) > at java.lang.ClassLoader.loadLibrary0(Unknown Source) > at java.lang.ClassLoader.loadLibrary(Unknown Source) > at java.lang.Runtime.loadLibrary0(Unknown Source) > at java.lang.System.loadLibrary(Unknown Source) > at LoachApp.main(LoachApp.java:10) > > However.. if I then remove 'System.loadLibrary("sdljava");', I get the > following message: > > Exception in thread "main" java.lang.UnsatisfiedLinkError: > get_SDL_PRESSED > at sdljava.x.swig.SWIG_SDLMainJNI.get_SDL_PRESSED(Native Method) > at > sdljava.x.swig.SWIG_SDLMainConstants.<clinit>(SWIG_SDLMainConstants.java:12) > > at sdljava.SDLMain.<clinit>(SDLMain.java:37) > at LoachApp.main(LoachApp.java:11) > > If anyone has got this working in Eclipse IDE, could someone guide me > along? Thanks :D > I've attached some screenshots if it helps. > > > ------------------------------------------------------------------------ > > > ------------------------------------------------------------------------ > > > ------------------------------------------------------------------------ > |
From: Chris D. <Des...@nt...> - 2005-02-14 00:37:25
|
Great! The script now works! All I had to do is download SDL from ww.libsdl.org and plonk SDL.dll into my c:\windows\system32 directory. System.loadLibrary("sdljava"); is still required, however. I'll have a go at using it, and use the mailing list again if any other problems arise. By the way, I have doubts about the portability of this code. How many users are going to mess around with all this if they want to play an SDL Java game on their system? It seems that Java is a bit wrapped in obfuscation when it comes to using C libraries. Regards, Chris Robert Schuster wrote: > Hi Chris, > > at first I wonder whether this can work: > > -Djava.library.path=D:/Programming/eclipse/plugins/org.eclipse.swt.win32_3.1.0/os/win32/x86 > -Djava.library.path="d:/Java Code/sdljava/lib" > > You should put both absolute filenames in one argument. On Windows you > separate usually with a ; > It should look like: > > -Djava.library.path=D:/Programming/eclipse/plugins/org.eclipse.swt.win32_3.1.0/os/win32/x86;"d:/Java > Code/sdljava/lib" > > --- > > Exception in thread "main" java.lang.UnsatisfiedLinkError: D:\Java > Code\sdljava\ > lib\sdljava.dll: Can't find dependent libraries > > This one looks like sdljava's JNI library (sdljava.dll) cannot find > SDL itself. If have no idea how you solve that on Windows elegantly. > On GNU/Linux and other Unices we install libraries usually system wide > which is less usually on Windows. > As a workaround you can download SDL's DLLs from libsdl.org and put > them in the same directory as sdljava.dll. > > > cu > Robert -- |>>> Dessimat0r /`\ | "We cannot turn back time, but we can _ _|_ _ move it forwards with our own hands." |;|_|;|_|;| \\. . / [www: http://codeknight.net ] \\: . / [e-mail: des...@nt... ] ||: U | /`\ [icq: 21477909 ] ||:. | [msn: des...@nt... ] \,/ ||: U.| ||: | \,/ ||: , | ____--`~--- '--~~__ __ ----~ - ~`---, -~--~ ~---__ ,--~' ~~----___ |
From: <st...@ta...> - 2005-02-14 00:49:19
|
Hi Chris, Chris Dennett wrote: > By the way, I have doubts about the portability of this code. How many > users are going to mess around with all this if they want to play an SDL > Java game on their system? It seems that Java is a bit wrapped in > obfuscation when it comes to using C libraries. I had to get around this too and my solution was to move the necessary absolute path into the java realm. So for SDL.dll I use System.load() to get the VM to load the native lib. You should be able to make a reasonable assumption about where your app is installed at runtime or you can infer it from classpath/user.dir/etc. This mean you should be able to generate that absolute path just before loading the native SDL lib in the java code. I haven't yet explored whether this would also be a preferable way of loading sdljava.dll though, but do let us know how you get on :) Cheers, Steph -- ================================================================ Stephane Meslin-Weber Email: st...@ta... Software Engineer Web: http://odonata.tangency.co.uk ================================================================ |
From: Ivan Z. G. <iva...@ya...> - 2005-02-14 01:52:41
|
Sounds like you got it working now. Thanks everyone for your help on the list. Regarding the portability -- it is just assumed that the SDL libraries can be resolved and are installed properly. Either present in c:\windows\system32 or in some other way configured so that the VM can locate the required libraries. I will update the INSTALL doc to be more clear on this aspect. If you were to actually ship a game created with sdljava then you would want to package up the SDL dll files you need (SDL, SDL_mixer, etc...) and have the installer for your game install these in the appropriate places. The users of your game should not have to deal with anything special. It should follow a standard install process like that for any game you buy off the shelf. Again I will update the documentation to be more clear and hopefully avoid this problem in the future. Please continue to send questions/comments/etc... -Ivan/ Chris Dennett wrote: > Great! The script now works! All I had to do is download SDL from > ww.libsdl.org and plonk SDL.dll into my c:\windows\system32 directory. > System.loadLibrary("sdljava"); is still required, however. I'll have a > go at using it, and use the mailing list again if any other problems > arise. > > By the way, I have doubts about the portability of this code. How many > users are going to mess around with all this if they want to play an > SDL Java game on their system? It seems that Java is a bit wrapped in > obfuscation when it comes to using C libraries. > > Regards, > Chris > > > Robert Schuster wrote: > >> Hi Chris, >> >> at first I wonder whether this can work: >> >> -Djava.library.path=D:/Programming/eclipse/plugins/org.eclipse.swt.win32_3.1.0/os/win32/x86 >> -Djava.library.path="d:/Java Code/sdljava/lib" >> >> You should put both absolute filenames in one argument. On Windows >> you separate usually with a ; >> It should look like: >> >> -Djava.library.path=D:/Programming/eclipse/plugins/org.eclipse.swt.win32_3.1.0/os/win32/x86;"d:/Java >> Code/sdljava/lib" >> >> --- >> >> Exception in thread "main" java.lang.UnsatisfiedLinkError: D:\Java >> Code\sdljava\ >> lib\sdljava.dll: Can't find dependent libraries >> >> This one looks like sdljava's JNI library (sdljava.dll) cannot find >> SDL itself. If have no idea how you solve that on Windows elegantly. >> On GNU/Linux and other Unices we install libraries usually system >> wide which is less usually on Windows. >> As a workaround you can download SDL's DLLs from libsdl.org and put >> them in the same directory as sdljava.dll. >> >> >> cu >> Robert > > > |
From: Chris D. <Des...@nt...> - 2005-02-14 03:43:32
|
I've got a question regarding SDLImage. Is it me, or is this class redundant? To me, it just seems to be a factory class for SDLSurface, from which image surfaces can be created from filename handles (as strings), and it may be better to transfer the load methods back to SDLSurface as constructors, while keeping stub methods in SDLimage for backwards compatiblity. Also, perhaps filename should be an actual file handle type, instead of a String, from the underlying Java architecture (if it exists)? ;) On the whole, however, this seems really well implemented, but I think you have to carry on reaching into the Java architecture for well defined types. Regards, Chris -- |>>> Dessimat0r /`\ | "We cannot turn back time, but we can _ _|_ _ move it forwards with our own hands." |;|_|;|_|;| \\. . / [www: http://codeknight.net ] \\: . / [e-mail: des...@nt... ] ||: U | /`\ [icq: 21477909 ] ||:. | [msn: des...@nt... ] \,/ ||: U.| ||: | \,/ ||: , | ____--`~--- '--~~__ __ ----~ - ~`---, -~--~ ~---__ ,--~' ~~----___ |
From: Ivan Z. G. <iva...@ya...> - 2005-02-14 04:05:07
|
You bring up a good question. The reason it has been implemented this way is because SDLSurface should not have a dependency on the SDL_Image library. If we put those methods into SDLSurface you would also have to link in the SDL_Image into the core. I would like to keep them separated as such so that you can pick and choose which library to use -- but not depend on any others. In reality all the SDLImage API is already provided by java libraries in java core and jai I believe. So the benefit of SDLImage for us is questionable. The method SDLVideo.createRGBSurfaceFrom(...) could be used to load images loaded via standard java libraries (note; for next release this method will be re-implemented with NIO buffers). Perhaps we should provide some helper methods within SDLVideo to create surfaces from images which then invoke the standard java api's to do so. It cannot be an actual java filehandle because the string is transferred directly to: SDL_Surface * SDLCALL IMG_Load(const char *file); And SDL has no idea what a java file handle would mean. Thanks for the compliment. I want this to be a an API that can seriously be used to develop most types of games in java. Please give me any more of your comments. PS: we're ramping up for the next release. Should be within two weeks or so. Please see the CHANGES_0_9_1 for a list of whats coming. There is more to add to the file but its mostly up to date. If anyone wants to get a feature in for 0_9_1 please drop me a note. Thanks -Ivan/ Chris Dennett wrote: > I've got a question regarding SDLImage. Is it me, or is this class > redundant? To me, it just seems to be a factory class for SDLSurface, > from which image surfaces can be created from filename handles (as > strings), and it may be better to transfer the load methods back to > SDLSurface as constructors, while keeping stub methods in SDLimage for > backwards compatiblity. Also, perhaps filename should be an actual > file handle type, instead of a String, from the underlying Java > architecture (if it exists)? ;) > > On the whole, however, this seems really well implemented, but I think > you have to carry on reaching into the Java architecture for well > defined types. > > Regards, > Chris > |
From: Robert S. <the...@gm...> - 2005-02-14 12:14:34
|
Hi > > If anyone wants to get a feature in for 0_9_1 please drop me a note. > Some time ago I asked for this: Btw: Could you add a version API? It would be nice to retrieve SDL's version and the version of the binding itself programmatically. IMHO this would be a nice feature. My game prints out a log when starting where besides other things the version numbers of underlying APIs appear. If something goes wrong on a user's machine he/she can send me the log and I can quickly see which versions of APIs where in use. cu Robert |
From: Ivan Z. G. <iva...@ya...> - 2005-02-15 02:21:06
|
Yes I remember, sorry it had slipped my mind, this feature will get added. -Ivan/ Robert Schuster wrote: > Hi > >> >> If anyone wants to get a feature in for 0_9_1 please drop me a note. >> > Some time ago I asked for this: > > Btw: Could you add a version API? It would be nice to retrieve SDL's > version and the version of the binding itself programmatically. > > IMHO this would be a nice feature. My game prints out a log when > starting where besides other things the version numbers of underlying > APIs appear. If something goes wrong on a user's machine he/she can > send me the log and I can quickly see which versions of APIs where in > use. > > cu > Robert > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click > _______________________________________________ > sdljava-users mailing list > sdl...@li... > https://lists.sourceforge.net/lists/listinfo/sdljava-users |
From: Ivan Z. G. <iva...@ya...> - 2005-02-15 03:15:09
|
I checked in code which returns an SDLVersion instance if you call version() on SDLMain. Let me know if this is along the lines of what you had in mind. I will add for other modules soon... -Ivan/ Ivan Z. Ganza wrote: > Yes I remember, sorry it had slipped my mind, this feature will get > added. > > -Ivan/ > > Robert Schuster wrote: > >> Hi >> >>> >>> If anyone wants to get a feature in for 0_9_1 please drop me a note. >>> >> Some time ago I asked for this: >> >> Btw: Could you add a version API? It would be nice to retrieve SDL's >> version and the version of the binding itself programmatically. >> >> IMHO this would be a nice feature. My game prints out a log when >> starting where besides other things the version numbers of underlying >> APIs appear. If something goes wrong on a user's machine he/she can >> send me the log and I can quickly see which versions of APIs where in >> use. >> >> cu >> Robert >> >> >> ------------------------------------------------------- >> SF email is sponsored by - The IT Product Guide >> Read honest & candid reviews on hundreds of IT Products from real users. >> Discover which products truly live up to the hype. Start reading now. >> http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click >> _______________________________________________ >> sdljava-users mailing list >> sdl...@li... >> https://lists.sourceforge.net/lists/listinfo/sdljava-users > > > > > > ------------------------------------------------------- > SF email is sponsored by - The IT Product Guide > Read honest & candid reviews on hundreds of IT Products from real users. > Discover which products truly live up to the hype. Start reading now. > http://ads.osdn.com/?ad_id=6595&alloc_id=14396&op=click > _______________________________________________ > sdljava-users mailing list > sdl...@li... > https://lists.sourceforge.net/lists/listinfo/sdljava-users |
From: LEBOEUF B. <bar...@ya...> - 2005-02-14 00:49:55
Attachments:
eclipse_running_2.jpg
eclipse_running.jpg
|
Hi Chris, For executing SDLJava Applications inside Eclipse you'll need = sdljava.dll and SDL.dll inside your java.library.path (d:/Java Code/sdljava/lib). Next go in menu "Run" -> "Run...", select your application and clic on "Arguments" tab. Put in "VM Arguments :" part the following text "-Djava.library.path=3Dd:\Java Code\sdljava\lib" and at last just below, = set your root "working directory" to the lib path. See the screen captures attach to this mail to have an idea. CUS, /Bart -----Message d'origine----- De=A0: sdl...@li... [mailto:sdl...@li...] De la part de Chris Dennett Envoy=E9=A0: lundi 14 f=E9vrier 2005 00:10 =C0=A0: sdl...@li... Objet=A0: [sdljava-users] Problems with JavaSDL.. I've been trying for = hours to get this to work. Hi, I've no idea whatsoever about how to use JavaSDL at all. I=20 downloaded the win32 compiled version, and I've followed the=20 instructions in INSTALL, and yet it still isn't working. My default VM arguments are=20 '-Djava.library.path=3DD:/Programming/eclipse/plugins/org.eclipse.swt.win= 32_3. 1.0/os/win32/x86=20 -Djava.library.path=3D"d:/Java Code/sdljava/lib"', and I've added=20 'sdljava.jar' to the Libraries section classpath of the Java Build Path=20 section of the current project. My testing code, at the moment, is: public static void main(String[] args) { System.loadLibrary("sdljava"); try { SDLMain.init(SDLMain.SDL_INIT_EVERYTHING); } catch (SDLException e) { // TODO Auto-generated catch block e.printStackTrace(); } } and it is giving me: Exception in thread "main" java.lang.UnsatisfiedLinkError: D:\Java=20 Code\sdljava\ lib\sdljava.dll: Can't find dependent libraries at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(Unknown Source) at java.lang.ClassLoader.loadLibrary(Unknown Source) at java.lang.Runtime.loadLibrary0(Unknown Source) at java.lang.System.loadLibrary(Unknown Source) at LoachApp.main(LoachApp.java:10) However.. if I then remove 'System.loadLibrary("sdljava");', I get the=20 following message: Exception in thread "main" java.lang.UnsatisfiedLinkError: = get_SDL_PRESSED at sdljava.x.swig.SWIG_SDLMainJNI.get_SDL_PRESSED(Native Method) at=20 sdljava.x.swig.SWIG_SDLMainConstants.<clinit>(SWIG_SDLMainConstants.java:= 12) at sdljava.SDLMain.<clinit>(SDLMain.java:37) at LoachApp.main(LoachApp.java:11) If anyone has got this working in Eclipse IDE, could someone guide me=20 along? Thanks :D I've attached some screenshots if it helps. --=20 |>>> Dessimat0r /`\ | "We cannot turn back time, but we can _ _|_ _ move it forwards with our own hands." |;|_|;|_|;| \\. . / [www: http://codeknight.net ] \\: . / [e-mail: des...@nt... ] ||: U | /`\ [icq: 21477909 ] ||:. | [msn: des...@nt... ] \,/ ||: U.| ||: | \,/ ||: , | ____--`~--- '--~~__ __ ----~ - ~`---, -~--~ ~---__ ,--~' ~~----___ |