This may be a completely stupid question, but here it goes… How does one create an executable from Java? I noticed that Tribal Troubles had different versions for each system. How? Is there a “compier” or something?
You mean an .exe file to start your programm in Windows? Just google with “java + exe” and you may find some helpful links. This should also be possible for other OS.
But I wouldn’t use them.
- Normally you need do distribute an DLL that contains all classes. So it would be really big.
- This will limit your programm to a special OS. In my opinion a java program should be able to run everywhere.
What prompted this question was Oddlabs Tribal Trouble. It’s a very professional looking game, right down to the distribution and I was hoping that someone could cast some light on how that was accomplished.
you can allways hack a little c and code a launcher.
True! I’ll look into that! Thanks!
a .bat (Windows) and .sh (Linux) would do the job also.
Wow! JSmooth looks pretty sweet! I have been using bat’s, but I just think exe’s look more professional.
JAR’s look better than both.
Webstart looks better than JAR’s.
too often i’ve had the problem with jar’s i send it too my friend, when he clicks it his zip program opens it up! very difficult to get working from there, any way jnlp webstart is really good though!
princec pointed me to JSmooth and I did the latest FlyingGuns filedownloads with it. Really smooth, cool tool!
I use Launch4j:
http://launch4j.sourceforge.net/
Jsmooth has the benefit of be able to pack more JAR’s into the EXE, but i had a problem with it (it does not find Java on every computer succesfully).
Is there any way to make a batch file so that it doesn’t pop up a dos window?
use javaw, not java.
Then you need to launch it correctly from the batch file. I think the command is “call javaw…” and it make take some parameters to be windowless…
EDIT: The command is "start /B javaw … " look here: http://www.computerhope.com/starthlp.htm
Awesome! Thank you!
no! dont do it! thats all correct, but its a horrible way to do things :(. making an exe that contains an entire JVM is one thing (IMHO not the nicest, but practicality is sometimes more important), but distributing batch files is simply unforgivable - Use the JAR, Luke!
I ended up using JSmooth! It’s a pretty nifty tool!
@blah^3 I know that you thing jars are perfect, but I still think it looks better to give out an exe on a windows platform, but I will agree with you that webstart is good too!
[quote]distributing batch files is simply unforgivable
[/quote]
If I have to download a jar which doesn’t come with some sort of launcher (be it a script or an exe), it just won’t work with me: It will open my zip tool, and most probably I won’t bother trying to boot the jar. You may never trust that .jar is associated with java.
So what makes .bat and .sh files so unforgivable? I agree it isn’t the nicest way of doing things and you depend on the user having a correct java version installed, but other than that it works, doesn’t it…
It does, I think that his objection is a question of elegance! ;D
So what makes .bat and .sh files so unforgivable? I agree it isn’t the nicest way of doing things and you depend on the user having a correct java version installed, but other than that it works, doesn’t it…
[/quote]
Mainly that 4 out of 5 of those shell scripts, and 2 out of 5 of those batch files are broken IME (have seen circa 50 different games use them by now). When I say “broken” I mean “wont work at all on many systems because the author just copy/pasted a complex command line wihtout knowing how batch / shell scripts work and the things that would be likely to make them go wrong”.
Often it’s a case of assuming a certain JVM version and using CLI options taht are version specific.
Often it’s HARD-CODING the location of the JVM executble (including version number in the path!).
For shell scripts, it’s usually makign use of unix tools that are often not installed on other people’s unix boxes. Things that will be on any kernel dev’s machine, but not on a normal desktop.
So many problems, so little benefit…