执行错误:java -Xms512M -Xmx1024M

时间:2010-08-23 12:42:24

标签: java memory-leaks

$ java -Xms512M -Xmx1024M

运行上述命令时,我收到以下错误。请帮我看看如何在AIX框中设置JVM堆内存。我在这里使用java 5.

Usage: java [-options] class [args...]
           (to execute a class)    or  java -jar [-options] jarfile [args...]
           (to execute a jar file)

where options include:
    -cp -classpath <directories and zip/jar files separated by :>
              set search path for application classes and resources
    -D<name>=<value>
              set a system property
    -verbose[:class|gc|jni]
              enable verbose output
    -version  print product version
    -showversion  print product version and continue
    -? -help  print this help message
    -X        print help on non-standard options

3 个答案:

答案 0 :(得分:12)

好吧,你必须执行一些java程序,而不仅仅是JVM。选项本身很好。试试java -Xms512M -Xmx1024M -cp somejar.jar mystuff.Main或其他什么。

答案 1 :(得分:0)

如何导出JAVA_OPTS =“ - Xms512M -Xmx1024M”(unix)或设置JAVA_OPTS = -Xms512M -Xmx1024M(windows)?

答案 2 :(得分:0)

也可以尝试以下方法:

java -Xms512M -Xmx1024M -classpath jar1.jar:jar2.jar packageName.YourMainClassName Arguements