my dog learned polymorphism*
The moose likes Beginning Java and the fly likes jar and JVM variables when packing Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "jar and JVM variables when packing" Watch "jar and JVM variables when packing" New topic
Author

jar and JVM variables when packing

Saeed Anwar
Greenhorn

Joined: Nov 17, 2008
Posts: 5
Is there anyway to configure/pass JVM runtime variables to jar when packing a jar file?

I don't want user to type
java -Xmx512m -jar MyApplication.jar

instead, I want to pass on this info when packing jar file so that when user double clicks on MyApplication.jar JVM knows that it needs 512M of memory.

Thanks for your help.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 38025
    
  22
Don't know. Look at this and this, but neither seems to mention JVM arguments like Xmx and Xms.
BV Boose
Ranch Hand

Joined: Jul 26, 2008
Posts: 33
run it from a script?
Henry Wong
author
Sheriff

Joined: Sep 28, 2004
Posts: 18532
    
  40

I don't want user to type ...


Generally, when you don't want a user to type, the best options are either a shellscript (unix) or batch file (windows).

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
Saeed Anwar
Greenhorn

Joined: Nov 17, 2008
Posts: 5
Thanks a lot everybody.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: jar and JVM variables when packing
 
Similar Threads
packing java file into JAr file
Creating an installer
Set library classpath inside runnable JAR file
how to pack everything within jar file in netbeans
Inserting into a jar file