Questions tagged [jvm-arguments]

Command-line options and environment variables that can affect the performance characteristics of the Java Virtual Machine

There are several categories of JVM arguments:

  1. Standard options recognized by the Java application launcher (e.g. -client, -classpath, ...)
  2. Options that begin with -X which are non-standard (not guaranteed to be supported on all VM implementations) and are subject to change without notice in subsequent releases of the JDK (e.g. -Xbootclasspath, -Xms, -Xloggc, ...)
  3. Options that are specified with -XX are not stable and are subject to change without notice (e.g. -XX:+PrintGCDetails, -XX:-UseParallelGC, ...)

References:

703 questions
8
votes
2 answers

How to determine which GC I use?

I didn't specify any GC, and I think my JVM have not any GC be enabled by default. Of course I know that OpenJDK8 use ParallelGC by default, but I think it should can print by command line, like this: java -XX:+PrintFlagsFinal|grep Use|grep GC I…
lianej
  • 83
  • 1
  • 3
8
votes
1 answer

Java - Invalid maximum heap size

When running project from IntelliJ IDEA I set VM options -XX:MaxPermSize=512m -Xmx=256m -Xms=256m and get the following error Error: Could not create the Java Virtual Machine. Error: A fatal exception has occurred. Program will exit. Invalid…
naXa stands with Ukraine
  • 35,493
  • 19
  • 190
  • 259
8
votes
1 answer

Unclear intrinsic behaviour in Java9

Suppose I have this code (it really does not matter I think, but just in case here it is): public class AtomicJDK9 { static AtomicInteger ai = new AtomicInteger(0); public static void main(String[] args) { int sum = 0; …
Eugene
  • 117,005
  • 15
  • 201
  • 306
8
votes
5 answers

Why are JVM memory parameters usually in multiples of 256?

I have seen almost all of the JVM memory parameters usually in multiples of 256 or a round binary value - e.g. 256m, 512m, 1024m etc. I know, it may be linked to the fact that physical memory (RAM) is usually a binary number, such as 256 MB, 1 GB…
Pat
  • 2,223
  • 4
  • 19
  • 25
8
votes
2 answers

Why do you remove .class when executing on the JVM?

Example: I have some source code, FooBar.java javac FooBar.java that gives me FooBar.class. Why does the JVM command line API take FooBar instead of FooBar.class (working on UNIX FYI)?
user2563044
8
votes
1 answer

JVM option XX:UseFastEmptyMethods/XX:UseFastAccessorMethods

While looking at possible JVM flags for optimizing launching startup time of my RCP product, I found these attractively-named -XX:UseFastEmptyMethods and -XX:UseFastAccessorMethods. It seems that those flags were available on JDK-6 (and on by…
guido
  • 18,864
  • 6
  • 70
  • 95
8
votes
2 answers

How to set default parameters to jvm?

I'd like to know how I can pass parameters to JVM before it is started. For example, I think I need to modify JVM timezone parameter. I use eclipse with windows 7.
iceberg
  • 1,951
  • 1
  • 22
  • 26
8
votes
3 answers

what is the right way to set JVM param's in eclipse

i am using eclipse 4.2 to execute a junit test. the test uses a lot of memory so what i want to do is to enlarge the memory allocated to the jvm. i wanted to know if there is a differences between setting the heap memory param's in the eclipse ini…
Raven
  • 713
  • 2
  • 10
  • 21
7
votes
3 answers

Appropriate JVM/GC tuning for 4GB JVM with 3GB cache

I am looking for the appropriate settings to configure the JVM for a web application. I have read about old/young/perm generation, but I have trouble using those parameters at best for this configuration. Out of the 4 GB, around 3 GB are used for a…
Matthieu Napoli
  • 48,448
  • 45
  • 173
  • 261
7
votes
2 answers

Why does setting the -Xmx too high sometimes cause the JVM to fail, even if there's available RAM?

Basically we've noticed that on some computers setting the JVM option -Xmx (max heap size) sometimes cause the JVM to fail to initialize, even if there's more than adequate RAM on the system. So for example, on a 4gb machine, we have -Xmx1024m…
Stephane Grenier
  • 15,527
  • 38
  • 117
  • 192
7
votes
4 answers

Run Java console app as a daemon (background)

I've developed a Java console application that when start, open a console window and remain in foreground, i want to start that application in background . Now i launch the application by this command line : java -jar myapp.jar Is there a way to…
aleroot
  • 71,077
  • 30
  • 176
  • 213
7
votes
2 answers

How to set JVM settings in Dockerfile

I have a Dockerfile looks like below: FROM tomcat:9.0.12-jre8 EXPOSE 8080 COPY app.war "$CATALINA_HOME"/webapps I need to set some JVM properties as below: -DTOMCAT=Y -Doracle.server=1234 -Doracle.url=1234 -Doracle.password=1234 ... How do I add…
PPCC
  • 189
  • 1
  • 5
  • 12
7
votes
2 answers

How to pass JVM options to jshell while starting it

I want to do the following : jshell -v -Duser.country=FR -Duser.language=fr So as to get for example a personalized Locale.getDefault().
HPH
  • 388
  • 2
  • 11
7
votes
1 answer

How to set both VM Params and Program args using exec-maven-plugin?

I am using exec-maven-plugin to run java app. I need to pass both JVM params and program arguments. I am setting JVM params like this: exec-maven-plugin 1.6.0
7
votes
5 answers

How can I add timestamps GC log file names in a Java Service under Windows?

I've got a Java Application running against Apache Tomcat, under Windows. There are two ways of running this application - either as a Windows Service, or from a batch file to invoke Tomcat manually. When I start the application via the batch file,…
EvilChookie
  • 563
  • 3
  • 14
  • 31