Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / March 2008

Tip: Looking for answers? Try searching our database.

launching jar files in windows

Thread view: 
travel2light - 08 Mar 2008 13:59 GMT
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
Thomas Kellerer - 08 Mar 2008 14:05 GMT
travel2light wrote on 08.03.2008 14:59:
> Hi
> I've created a java game that is wrapped in a jar file. Because it
[quoted text clipped - 6 lines]
> 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
travel2light - 08 Mar 2008 16:14 GMT
> travel2light wrote on 08.03.2008 14:59:
>
[quoted text clipped - 16 lines]
>
> Thomas

It works great. Thank you!
thenerdwonder - 08 Mar 2008 14:20 GMT
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
> I've created a java game that is wrapped in a jar file. Because it
[quoted text clipped - 8 lines]
>
> Michael
travel2light - 08 Mar 2008 14:31 GMT
> 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
Lew - 08 Mar 2008 15:48 GMT
>> You can make a .jar file executable. Just set the Main-Class attribute
>> in the manifest. After that, double-clicking the .jar should execute
[quoted text clipped - 6 lines]
> 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?

Signature

Lew

travel2light - 08 Mar 2008 16:19 GMT
> >> You can make a .jar file executable. Just set the Main-Class attribute
> >> in the manifest. After that, double-clicking the .jar should execute
[quoted text clipped - 17 lines]
> --
> Lew

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.
Arne Vajhøj - 09 Mar 2008 05:10 GMT
> 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
Andrew Thompson - 08 Mar 2008 23:32 GMT
> ...it needs to run with increased memory;

Java Web Start can reserve extra memory for an app.

--
Andrew T.
PhySci.org
travel2light - 09 Mar 2008 00:45 GMT
> > ...it needs to run with increased memory;
>
[quoted text clipped - 3 lines]
> Andrew T.
> PhySci.org

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
Mark Space - 09 Mar 2008 01:29 GMT
> 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?

I think so.  JWS can do an install from a CDROM, or other media.  Do a
Google search for JWS CDROM, I think there's a fair amount of stuff out
there.

Here's one link I found:

<http://java.sun.com/j2se/1.5.0/docs/guide/javaws/developersguide/cdinstall.03.06.html>
Andrew Thompson - 09 Mar 2008 02:14 GMT
> > 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?
>
> I think so.  ...

Correct.  I had been meaning to test offline
install myself, but have not gotten around
to it.

--
Andrew T.
PhySci.org
Roedy Green - 09 Mar 2008 00:00 GMT
On Sat, 8 Mar 2008 05:59:13 -0800 (PST), travel2light
<everything2light@yahoo.co.uk> wrote, quoted or indirectly quoted
someone who said :

>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
[quoted text clipped - 5 lines]
>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.
--

Roedy Green Canadian Mind Products
The Java Glossary
http://mindprod.com


Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.