由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - jar file question
相关主题
Re: Out of memory, Java heap space 的问题怎么解决? (转载)求教有没有好的查memory leak的工具?
[转载] 有用Eclipse的嘛?array 在java里 是一定放在heap 吗?
Jar questionJava Object 一定在 Heap 里吗
Ant and Netbeans help被面how to manage heap in java jvm
请问在Java中有没有停止一切的命令Where I can find comparison of JVMs
入门Java CLASSPATH问题:Re: help! how to make jar work?
garbage collection issuejar 的问题, 路径有问题? 大家帮忙看看是啥毛病?
OutofMemoryError: Java Heap SpaceHow to filter out *.java from jar file?
相关话题的讨论汇总
话题: jar话题: file话题: heap话题: mx300mb话题: size
进入Java版参与讨论
1 (共1页)
c*****t
发帖数: 1879
1
I have a jar file which I need to run with
java -mx300mb -jar mycode.jar
-mx300mb is needed to increase the heap size. Are there anways to
avoid this flag at run time w/o using shell script/batch files and
have this option build into the jar file?
I was looking at the menifest file but found no clues. Anyone
can help?
Thanks
m**c
发帖数: 90
2

Should it be "-Xmx300m"? It is not for increasing the heap size, it is
actually for limiting the heap size (maximum heap size). If you want to
increase initial heap size (minimum heap size), you need "-Xms128m". I don't
think you can build "-Xmx300m" option into either JVM or JAR files.

【在 c*****t 的大作中提到】
: I have a jar file which I need to run with
: java -mx300mb -jar mycode.jar
: -mx300mb is needed to increase the heap size. Are there anways to
: avoid this flag at run time w/o using shell script/batch files and
: have this option build into the jar file?
: I was looking at the menifest file but found no clues. Anyone
: can help?
: Thanks

k*****c
发帖数: 6
3
Can you write a bootstrap class to create a new process, and in that new
process, you can run whatever you want.
And in the manifest file, you can set the bootstrap class as the startup class
for the jar file.

【在 c*****t 的大作中提到】
: I have a jar file which I need to run with
: java -mx300mb -jar mycode.jar
: -mx300mb is needed to increase the heap size. Are there anways to
: avoid this flag at run time w/o using shell script/batch files and
: have this option build into the jar file?
: I was looking at the menifest file but found no clues. Anyone
: can help?
: Thanks

c*****t
发帖数: 1879
4
Could you give an example? I didn't quite understand...
Thanks

【在 k*****c 的大作中提到】
: Can you write a bootstrap class to create a new process, and in that new
: process, you can run whatever you want.
: And in the manifest file, you can set the bootstrap class as the startup class
: for the jar file.

e***e
发帖数: 351
5
public class Test {
public static void main(String[] args) {
try {
Runtime.getRuntime().exe("javaw -Xmx800m -Djava.library.path=xxx -cp xxxx
abc");
} catch(Exception ex) {
ex.printStackTrace();
}
}
}
Do you mean by that?

【在 c*****t 的大作中提到】
: Could you give an example? I didn't quite understand...
: Thanks

g*****g
发帖数: 34805
6
Of course you can do this, but i can't find a case you should do this.
A shell/batch is 1000 times more convenient.

xxxx
class

【在 e***e 的大作中提到】
: public class Test {
: public static void main(String[] args) {
: try {
: Runtime.getRuntime().exe("javaw -Xmx800m -Djava.library.path=xxx -cp xxxx
: abc");
: } catch(Exception ex) {
: ex.printStackTrace();
: }
: }
: }

m******t
发帖数: 2416
7
Note this relies on what's on the user's path and can get you in trouble
sometimes.
I would still suggest to provide shell scripts for the major platforms you
need to support. one cmd and one sh should take care of Windows and *nix
which account for about 99% of the cases.

【在 e***e 的大作中提到】
: public class Test {
: public static void main(String[] args) {
: try {
: Runtime.getRuntime().exe("javaw -Xmx800m -Djava.library.path=xxx -cp xxxx
: abc");
: } catch(Exception ex) {
: ex.printStackTrace();
: }
: }
: }

1 (共1页)
进入Java版参与讨论
相关主题
How to filter out *.java from jar file?请问在Java中有没有停止一切的命令
stupid questions:XP中,双击.jar文件,为什么不运行入门Java CLASSPATH问题:
多个文件如何编译?garbage collection issue
java 还在改进吗?OutofMemoryError: Java Heap Space
Re: Out of memory, Java heap space 的问题怎么解决? (转载)求教有没有好的查memory leak的工具?
[转载] 有用Eclipse的嘛?array 在java里 是一定放在heap 吗?
Jar questionJava Object 一定在 Heap 里吗
Ant and Netbeans help被面how to manage heap in java jvm
相关话题的讨论汇总
话题: jar话题: file话题: heap话题: mx300mb话题: size