| JavaSDL issues |
I’m writing the fremework for Beit Berl College GEMOLOGY program. I think it will be using javaSDL. Therefore, I collect a few links here for my personal use.
Installing javaSDL on Eclipse:
- Download sdljava-0.9.1-win32-bin.zip and optionally sdljava-0.9.1-src.zip (It contains the source code for the samples, very handy).
- Extract to any directory (e.g. C:\Java\sdljava-0.9.1).
- Click Start -> Settings -> Control Panel -> System -> Advanced -> Environment Variables and append C:\Java\sdljava-0.9.1\lib to the Path system variable.
- Go to C:\Java\sdljava-0.9.1\bin and execute testsprite.bat - If it works, congratulations, 75% done.
- Open Eclipse, create a new project, add a source file to it and paste the following into it:
import sdljava.*;
import sdljava.video.*;
try {
class HelloSDL {
public static void main(String[] args) {
final String caption = "Hello, SDL!";
System.out.println(caption);
SDLMain.init(SDLMain.SDL_INIT_VIDEO);
SDLVideo.wmSetCaption(caption, caption);
SDLSurface screen = SDLVideo.setVideoMode(640, 480, 24, 0);
java.lang.Thread.sleep(2500);} catch(Exception e) {
e.printStackTrace();
} finally {
SDLMain.quit();
}
}
} - Right click the source file and choose Run As … Run.
- If there isn’t already an entry below “Java Application”, create one. Ensure that the main class is set to “HelloSDL”.
- Switch to the Arguments tab and add the following to VM arguments: -Djava.library.path=C:\Java\sdljava-0.9.1\lib
- Open the project properties, select Java Build Path -> Libraries and click on Add external JARs, then choose C:\Java\sdljava-0.9.1\lib\sdljava.jar and click Open.
- Run the project. If it works, that’s all there is to it!
1 Comment so far
Leave a reply
http://www.brackeen.com/javagamebook
http://www.infospheres.caltech.edu/resources/jdk1.3.1_02/docs/guide/2d/
http://www.javaworld.com/javaworld/jw-07-1998/jw-07-media.html