Java-Gaming.org Hi !
Featured games (83)
games approved by the League of Dukes
Games in Showcase (538)
Games in Android Showcase (132)
games submitted by our members
Games in WIP (600)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  running a jar with java arguments?  (Read 2349 times)
0 Members and 1 Guest are viewing this topic.
Offline Kommi

Junior Devvie




All opinions will be lined up and shot!


« Posted 2005-12-26 19:38:56 »

What if I wanted to execute a jar file with -Xms256m -Xmx256m flags? How is this possible. I have an app that requires a lot of memory to be avaliable, how can I set it up to run outside the IDE? Can I config an executable jar file? Do I use a batch file? Can I set those flags some other way in my code?

Kommi
Offline Jeff

JGO Coder




Got any cats?


« Reply #1 - Posted 2005-12-26 20:05:05 »

What if I wanted to execute a jar file with -Xms256m -Xmx256m flags?

java -Xms256m -Xmx256m -jar <jarfile>


Quote
Do I use a batch file?

yes

Quote
Can I set those flags some other way in my code?

No.  The only other options is an executable launcher as this needs to be set when the Vm is launched.  The various installer generators generally can do this.


Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline Kommi

Junior Devvie




All opinions will be lined up and shot!


« Reply #2 - Posted 2005-12-26 20:30:49 »

Thanks Jeff

Kommi
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Kommi

Junior Devvie




All opinions will be lined up and shot!


« Reply #3 - Posted 2005-12-27 15:58:40 »

Hum... im looking at this tutorial http://today.java.net/pub/a/today/2004/04/30/cmdline.html?page=2 but the C code makes very little sense to me.  All I want to achieve is a batch file that will execute the following command: -Xms256m -Xmx256m WindowClass. Can anyone help me with this?

Kommi
Offline Jeff

JGO Coder




Got any cats?


« Reply #4 - Posted 2005-12-27 18:56:57 »

Just put the line I gave you above in a batchfile,.


Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Offline blahblahblahh

JGO Coder


Medals: 1


http://t-machine.org


« Reply #5 - Posted 2005-12-27 19:33:42 »

What if I wanted to execute a jar file with -Xms256m -Xmx256m flags?

java -Xms256m -Xmx256m -jar <jarfile>


Quote
Do I use a batch file?

yes

Quote
Can I set those flags some other way in my code?

No.  The only other options is an executable launcher as this needs to be set when the Vm is launched.  The various installer generators generally can do this.



You can do these as part of a standard java bundle if you use webstart (these are two of the very very small number of command-line-args that webstart allows you to specify) - technically speaking, it's just a particular form of "executable launcher", but it's also the way you're supposed to package java apps.

malloc will be first against the wall when the revolution comes...
Offline Kommi

Junior Devvie




All opinions will be lined up and shot!


« Reply #6 - Posted 2005-12-27 21:03:18 »

got it, thanks

Kommi
Offline Bombadil

Senior Devvie





« Reply #7 - Posted 2005-12-28 08:58:05 »

If you really hate batch files and know your user (or you) can always start a JAR by double clicking it, you could use a mini JAR file to start your big JAR file with the needed memory parameters.

There's been a small thread about the topic a long time ago, which I started and with the help of some good forum people it worked very well then.
Offline f.l.x

Senior Devvie


Projects: 3


there is no place like 127.0.0.1


« Reply #8 - Posted 2005-12-28 11:58:55 »

you can set some vm args inside your code with System.setProperty(), for example, you can set the opengl pipeline on, if any component is visible yet, if you call
1  
System.setProperty("sun.java2d.opengl", "True");

Litterarum radices amaras, fructus dulces
http://flx.proyectoanonimo.com
figth spam!
Offline Bombadil

Senior Devvie





« Reply #9 - Posted 2005-12-28 13:57:13 »

you can set some vm args inside your code with System.setProperty(), for example, you can set the opengl pipeline on, if any component is visible yet, if you call
1  
System.setProperty("sun.java2d.opengl", "True");


That's a good hint and keyword.

In the same way it's possible to set most (all?) of the Swing switches when your main class does it before any visual component is being created.

For example my typical main class loads some prefs and then issues:
1  
System.setProperty("swing.aatext", "true");

... and then creates the JFrame and so on.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Jeff

JGO Coder




Got any cats?


« Reply #10 - Posted 2005-12-28 22:21:47 »

you can set some vm args inside your code with System.setProperty(), for example, you can set the opengl pipeline on, if any component is visible yet, if you call
1  
System.setProperty("sun.java2d.opengl", "True");


Actually to be correct youcan set NO VM arguments from inside the program.

You can set properties.  if those properties are read by the APIs libs after the point in your program where you set them, they will have an effect.


Got a question about Java and game programming?  Just new to the Java Game Development Community?  Try my FAQ.  Its likely you'll learn something!

http://wiki.java.net/bin/view/Games/JeffFAQ
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

rwatson462 (29 views)
2014-12-15 09:26:44

Mr.CodeIt (20 views)
2014-12-14 19:50:38

BurntPizza (40 views)
2014-12-09 22:41:13

BurntPizza (75 views)
2014-12-08 04:46:31

JscottyBieshaar (37 views)
2014-12-05 12:39:02

SHC (50 views)
2014-12-03 16:27:13

CopyableCougar4 (46 views)
2014-11-29 21:32:03

toopeicgaming1999 (113 views)
2014-11-26 15:22:04

toopeicgaming1999 (100 views)
2014-11-26 15:20:36

toopeicgaming1999 (30 views)
2014-11-26 15:20:08
Resources for WIP games
by kpars
2014-12-18 10:26:14

Understanding relations between setOrigin, setScale and setPosition in libGdx
by mbabuskov
2014-10-09 22:35:00

Definite guide to supporting multiple device resolutions on Android (2014)
by mbabuskov
2014-10-02 22:36:02

List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50
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
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!