Ok, I’ve made my java LWJGL application, its all in some .java files, and all is compiled and working.
What to do next?
How can i send it to my friends, and make it work at their home? (i just want them to run it , not compile it or anything…).
Ok, I’ve made my java LWJGL application, its all in some .java files, and all is compiled and working.
What to do next?
How can i send it to my friends, and make it work at their home? (i just want them to run it , not compile it or anything…).
The nicest option would be webstart. Check this basic tutorial:
http://www.cokeandcode.com/webstarthowto
Other than that… well, you could throw everything into one zip, with the native libs at the root with a bat file like:
java -classpath .;jinput.jar;lwjgl.jar;[etc];bla.jar your.main.Thingy
pause
Or with the native libs in a sub dir and -Djava.library.path=“whatever”. But it’s Windows only then and less comfy then webstart.
If they have Java installed, you only need to make a .jar file and they can run it like executable. When they double click on it, it will run. How to make a .jar file, you’ll have to find out for yourself, it isn’t hard.
Don’t rely on that, several compression-apps are know to hijack *.jar
“java -classpath .;jinput.jar;lwjgl.jar;[etc];bla.jar your.main.Thingy” - I dont understand that.
lets say I have the following project:
the main java file “project1.java” (LWJGL based) in “c:\java project\project1”
and one jpg file in “c:\java project\project1\data”
how would the batch file look like?..
thanks.
And I hate them all…
.jar file is meant to be a executable as I figured out, you should use it as such. Zip thing is only way of storage. If another application hijacks .jar extension, I would uninstall / blame it for that. Even if some app hijackes .jar, in windows you can always right click > open with > JRE, and in the process make JRE default for opening .jaf files, (but that requires open with > choose program > select JRE and check checkbox at the bottom).
The extension hijacking thing is a right pain. Webstart sometimes suffers from the same issue, as browsers may or may not prompt the user to save the .jnlp instead of open it directly (although this is less bad, as the saved jnlp is double-click-able).
Personally I quite like JSmooth for getting around the issue. Makes it dead easy to create a tiny little exe (complete with icon) that is gurantteed to be double-click-able and looks just like a native app. (Mac users don’t usually get the zip extension hijacked, and webstart seems to work fine out of the box. Likewise for linux people).
ok, i thanks all, i have 2 more questions -
I’ve used JSmooth fine with LWJGL, all you have to remember to do is set the java.library.path argument in the JVM configuration section. Performance is unaffected, all it does is provide a handy way of launching the app.
Probably best to get it working with jars and the command line first though, then it’ll be easier to do a webstart / JSmooth version.
I, i tired it, but i got a “noclassdeffounderror” on all my LWJGL libraries.
they are stored in “C:\Java Libraries\lwjgl-1.0-rc1”
how can i add them to my jar file?
ah the pain… use a manifest file, it’s nicer way to create jars with manifest. Put your LWJGL jar into your jar file like any other file.
Then you need to add class path argument into manifest file to your LWJGL jar file.
This is example how I did it when I worked with jdbc driver:
command line:
jar -cfmv viktorije.jar manifest.mf “mysql-connector-java-3.1.12-bin.jar” “viktorije” “images”
… this uses manifest.mf file, adds msyql… .jar, adds viktorije dir and adds images dir, all into newly created viktorije.jar
about -cfmv you can all read in jar tutorial
Would you explain that to your users? Guess not. If you did, they wouldn’t understand. Users are ignorant.
Ok, I did something else, and it worked , but now i have a totally new bug
i have a “java.lang.NoClassDefFoundError” on one of my package classes.
the package is defined as a class path in my manifest file as:
Class-Path: myUtilities
the app crashes when i try to call one of myUtilities classes from my main class.
what can it be?
Actually yes I would, It’s only a sentence or two in FAQ:
Q: My app dosen’t run when I click on it but WinZip/WinRar/some_other_compression_app opens it and displays it’s contents
A: Uninstall that compression app OR right click on .jar, go to open with, choose program, select Java Runtime SE, check “I want always to open this with…”, click ok.
Explanation: Who’s fault is it? The compression app becouse…
Anyway I would stick to standards instead of letting other application pushing me around… On the other hand I didn’t released anything serious yet so I’m yet about to see hell 
so myUtilities is a package? According to java tutorial, you can only point to classes or jar files, guess that doesn’t include packages:
So you can create a myUtilities.jar with myUtilities package and put it into your .jar file, then add myUtilities.jar to Class-Path.
Isn’t jar a package?
anyway, i pushed all the class files of myUtilities package into a jar file, and i’ve included it in the main jar file.
still doesn’t work.
im TOTALLY lost.
my app is very light weight… maybe i can send it to someone who is ready to make a batch file?
i guess that i’ll learn the rest by myself…
I can also describe the structure of my files etc., if it will do any good.
Yeah, but your players won’t read your faq. As soon as they see a game without anything obvious to start it they’ll already have dismissed it as broken and wandered off.
too bad for them… I wont try to fix the world because of this. Anyway If I ever make a serious game that I want to sell, I guess it will come with an installer, and then installer could restore .jar association to JRE if needed. Or even .exe that would run that .jar. … No point of discussing it now since I’m not even close to selling anything.
honestly … I don’t know 
structure would be very good. I’m interested why this thing doesn’t work so if you want you can send your app to me and I will try to make a jar file. kova1337(funnyA)gmail.com
Thanks. I mailed u all the info needed, and all the files.
BTW - i tried to use JSMOOTH, but i could not get it to work anyway.