I was wondering, if you need to distribute a .jar to non programmers. How would you make sure the jar runs ? ie that the JAVA_PATH is set, and that the jar finds the java.exe.

I'm asking this, because my jar won't launch under windows without me specifying the java.exe location (haven't set the JAVA_PATH, and since the end user mustn't do any configuration to play a game ...)

Also another question. I'm using lwjgl, and my .jar needs a link to the native. I can't dynamically set java.library.path, so I'm going through a script that just calls the java -jar command and setting the java.library.path at the same time. Do you generally go through a script / exe or do you create another jar that does the call ? or is they a way to load the native dynamically ?

The JAVA_PATH should have been automatically set when Java was installed.

You can use either this Fat Jar creator which puts everything in 1 jar and it automatically launches your application, or you can look at this app, which creates a native executable for Windows, Mac, and Linux.

You can use applets or Java Web Start, it would be better. If you choose Web Start, avoid FatJar & co. because it creates big JARs and when Web Start downloads the JARs, the progress bar is updated only when a full JAR has just been downloaded, it means that if the download is quite long with a single JAR, the progress bar won't be updated and the final user will believe that your game crashes and does not work. I have this problem with my game, some JARs takes so long to be downloaded, some people believe that something is wrong and stops the install process

@raAking:Its weird, my JAVA_PATH wasn’t set on windows even though I have eclipse + java installed. I already got a one runnable jar (with several jars inside). I was using the batch/sh files actually to be able to pass an argument for the one jar file (i generate two, one for a server and one for a client, and for the moment the client can input the host address as an argument, but no worries, its temporary, I'll add a textfield or something in-game once I have time) and also for giving the java.library.path thing aswelledit: I mistook the fat Jar with something else (the ant script that puts jars in jars), it seems quite nice as well actually. Its exactly what I was looking for, thanks very much

Thanks for linking that launch4j, seems nice. I'll look into that for sure.

@gouessej:I was planning for a webstart too. Maybe not an applet though. A lot of people on the website seem to dislike webstart and like having a downloadable version. I got a webstart working for a lwjgl test application, so I think I'll manage for this one :pI didn't know the progress bar depended on the number of jars downloaded, thanks for the info.

@Cero:I'm in a bit of that mindstate as well. I'm guessing the exe instead of plain jar is because you are scared that a random user won't click on a .jar because he won't know what it its ?And do you use launch4j for your shipping too ?

@Cero:I'm in a bit of that mindstate as well. I'm guessing the exe instead of plain jar is because you are scared that a random user won't click on a .jar because he won't know what it its ?And do you use launch4j for your shipping too ?

also, like I said, I dont assume the user has java, and sometimes jars dont even work because, stuff like winrar takes the extension and stuff.I dont use any of those java tools like launch4j, splice and whatnotI just a batch to exe converter (compiler)I just make a batch that works, open the program, which is free, compile a exe out of it, give it an icon, and there you goyou can set whether or not to have a visible console.I just find all these tools kinda weird and difficult to handle.

since I ship the jvm with it, I just do something like " "jvm/bin/java" arguments -jar jarfile " and so on, and its a relative path to the jvm shipped, so it works everytime.

I ship jvm with it and exe files instead of jarsnot taking any chancesand surely I don't assume everyone has java installed

obviously only if you deploy "real things"

I don't see the reason to deploy windows executables, when developing applications in java. Thats defeating the point of the WORA.Why not distribute .jars and put a notice with it, about the need for Java to be installed. It seems to work for pretty large audiences - see Minecraft, Runescape or FunOrb.

first: there are many negative preconception about java in mainstream's mind, java is slow, stuff like minecraft may help to eventually reduce those, but we are not there yetnot completely hide, just from the eyes of the user: you have an installer, an exe, a couple of folders; thats it.its also part of the philosophy "making technology invisible"which brings me to my second point:the user should never have to deal with any tech shit. simple as that. every little thing the user has to install prior to being able to play, is a turnoffa windows user just wants an exe and shortcut, double click it, and boom, is just works.

So I rather have 3 versions, each specifically done for each OS (with few code changes thanks to java), which will simply work on that platform, than having one for all, that you can somehow get to work on allusers shouldn't have to deal with any of that.

Also 95% are windows users anyway. We are talking about GAMES here... not a whole lot of PC market beside windows.

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