launching jar files in windows

T

travel2light

Hi
I've created a java game that is wrapped in a jar file. Because it
uses large images it needs to run with increased memory; but for
distribution reasons I don't want to have to use a windows batch file
to do this. Is there any free software available that I can
distribute with my program, that will allow me to do this? I have
thought about creating a simple program that can be run to write a
batch file, but I'm still not sure if windows will still not figure
out what is going on and block it; and anyway I would rather find a
more elegant solution to the problem. Thank you for any advice.

Michael
 
T

Thomas Kellerer

travel2light wrote on 08.03.2008 14:59:
Hi
I've created a java game that is wrapped in a jar file. Because it
uses large images it needs to run with increased memory; but for
distribution reasons I don't want to have to use a windows batch file
to do this. Is there any free software available that I can
distribute with my program, that will allow me to do this? I have
thought about creating a simple program that can be run to write a
batch file, but I'm still not sure if windows will still not figure
out what is going on and block it; and anyway I would rather find a
more elegant solution to the problem. Thank you for any advice.

Check out launch4j. It creates an exe wrapper for your jar file, and you can
specify JVM parameters. You can even embed the jar file in the exe if you want
to. The exe will still require a JRE to be installed!

http://launch4j.sourceforge.net/

Thomas
 
T

thenerdwonder

You can make a .jar file executable. Just set the Main-Class attribute
in the manifest. After that, double-clicking the .jar should execute
whatever class you specified there.
 
T

travel2light

You can make a .jar file executable. Just set the Main-Class attribute
in the manifest. After that, double-clicking the .jar should execute
whatever class you specified there.

Hi
The Jar file is already exucutable, but I don't think it is possible
to set the heap size in the manifest. I tried sending the game to a
friend using a batch file (using parameters 'java -jar -mx256m
mygame.jar' to run it, but windows was suspicious of it, and wouldn't
unpack it from a zip file.

Michael
 
L

Lew

travel2light said:
Hi
The Jar file is already exucutable, but I don't think it is possible
to set the heap size in the manifest. I tried sending the game to a
friend using a batch file (using parameters 'java -jar -mx256m
mygame.jar' to run it, but windows was suspicious of it, and wouldn't
unpack it from a zip file.

Is Windows the master or the servant?

Isn't there a way for your friend to overcome Windows's suspicion, and command
its compliance with their will?

Failing that, couldn't your friend simply enter the 'java' command on their
own command console?
 
T

travel2light

travel2light wrote on 08.03.2008 14:59:


Check out launch4j. It creates an exe wrapper for your jar file, and you can
specify JVM parameters. You can even embed the jar file in the exe if you want
to. The exe will still require a JRE to be installed!

http://launch4j.sourceforge.net/

Thomas

It works great. Thank you!
 
T

travel2light

Is Windows the master or the servant?

Isn't there a way for your friend to overcome Windows's suspicion, and command
its compliance with their will?

Failing that, couldn't your friend simply enter the 'java' command on their
own command console?

Yes indeed, they can do this. Or they can create their own batch file.
But I am looking for ways to make my game more accessible than that.
 
R

Roedy Green

I've created a java game that is wrapped in a jar file. Because it
uses large images it needs to run with increased memory; but for
distribution reasons I don't want to have to use a windows batch file
to do this. Is there any free software available that I can
distribute with my program, that will allow me to do this? I have
thought about creating a simple program that can be run to write a
batch file, but I'm still not sure if windows will still not figure
out what is going on and block it; and anyway I would rather find a
more elegant solution to the problem. Thank you for any advice.

you could write a microscopic "kicker" program in C that execs
Java.exe.

see http://mindprod.com/project/kicker.html

I know of no way to put command line arguments destined for java.exe
inside the jar in the manifest. However, if you use JAWS, you can put
them in the JNLP file which lives outside the jar. The reason for this
is, by the time the java.exe JVM gets around to looking inside jars,
it has already cast in stone everything it learned from the command
line.
 
T

travel2light

Java Web Start can reserve extra memory for an app.

Can I run stand alone applications using Java Web start? I think I
need to install my program on a web server to do this right?

Please forgive my ignorance about the technical stuff. I'm a self-
taught computer programmer + I do this for fun. Although I hope one
day to make some cash doing this, I'm not holding my hopes too high!

Michael
 
A

Arne Vajhøj

travel2light said:
The Jar file is already exucutable, but I don't think it is possible
to set the heap size in the manifest. I tried sending the game to a
friend using a batch file (using parameters 'java -jar -mx256m
mygame.jar' to run it, but windows was suspicious of it, and wouldn't
unpack it from a zip file.

There are no real solution but some workarounds:

1) create a link to javaw -Xmx256m -jar mygame.jar to run your app
2) change the jar command associated with .jar to have -Xmx256m
3) rename the file to .bigjar and associate that file extension
with a javaw command with -Xmx256m

Arne
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,581
Members
45,057
Latest member
KetoBeezACVGummies

Latest Threads

Top