jvm-arguments

Speed tradeoff of Java's -Xms and -Xmx options

痴心易碎 提交于 2019-11-27 17:09:42
Given these two commands A: $ java -Xms10G -Xmx10G myjavacode input.txt B: $ java -Xms5G -Xmx5G myjavacode input.txt I have two questions: Since command A reserves more memory with its parameters, will A run faster than B? How do -Xmx and -Xms affect the running process and the output of my program? It depends on the GC your java is using. Parallel GCs might work better on larger memory settings - I'm no expert on that though. In general, if you have larger memory the less frequent it needs to be GC-ed - there is lots of room for garbage. However, when it comes to a GC, the GC has to work on

Could not initialize class sun.awt.X11GraphicsEnvironment on Solaris

孤街醉人 提交于 2019-11-27 15:50:41
问题 I am running into this error while running my installer on a Solaris machine: Installing... ------------- [==================|==================|==================|==================] [---Invocation of this Java Application has caused an InvocationTargetException. This application will now exit. (LAX) Stack Trace: java.lang.NoClassDefFoundError: Could not initialize class sun.awt.X11GraphicsEnvironment at java.lang.Class.forName0(Native Method) at java.lang.Class.forName(Class.java:186) at

JVM -XX:+StringCache argument?

*爱你&永不变心* 提交于 2019-11-27 15:49:12
问题 I was recently reading about all the JVM arguments available in JRE 6 [Java VM Options] and saw this : -XX:+StringCache : Enables caching of commonly allocated strings. Now I was always under the impression that Java kept a pool of interned (correct word?) Strings and when doing something like String concatenation with literals it was not creating new objects, but pulling them from this pool. Has anyone ever used this argument, or can explain why it would be needed? EDIT: I attempted to run a

Duplicated Java runtime options : what is the order of preference?

て烟熏妆下的殇ゞ 提交于 2019-11-27 13:50:32
Considering the following command line java -Xms128m -Xms256m myapp.jar Which settings will apply for JVM Minimum memory ( Xms option) : 128m or 256m ? Depends on the JVM, perhaps the version...perhaps even how many paper clips you have on your desk at the time. It might not even work. Don't do that. If it's out of your control for some reason, compile and run this the same way you'd run your jar. But be warned, relying on the order of the options is a really bad idea. public class TotalMemory { public static void main(String[] args) { System.out.println("Total Memory: "+Runtime.getRuntime()

Run Java console app as a daemon (background)

試著忘記壹切 提交于 2019-11-27 13:19:12
问题 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 achieve this behaviour ? It's enough change the command line parameter or i need to do some change on my code ? 回答1: The answer is operating system dependent. *nix: <your command> & Windows: (opens a new console): start <your command> Windows: (doesn

Encourage the JVM to GC rather than grow the heap?

天涯浪子 提交于 2019-11-27 12:48:29
(Note that when I say "JVM", I really mean "Hotspot", and I'm running the latest Java 1.6 update.) Example situation: My JVM is running with -Xmx set to 1gb. Currently, the heap has 500mb allocated, of which 450mb is used. The program needs to load another 200 mb on the heap. Currently, there is 300mb worth of "collectable" garbage in the heap (we'll assume it's all in the oldest generation.) Under normal operation, the JVM will grow the heap to 700 mb or so, and garbage collect when it gets around to it. What I would like in that situation is for the JVM to gc first, then allocate the new

Java 8 reserves minimum 1G for Metaspace despite (Max)MetaspaceSize

泪湿孤枕 提交于 2019-11-27 10:01:42
问题 Java 8 reserves 1G for Metaspace just after it starts. It means that minimum metaspace size is 1G. But I set up MetaspaceSize to 300m and MaxMetaspaceSize to 400m. Why Java reserves more then I allow? Java Version $ java -version java version "1.8.0_45" Java(TM) SE Runtime Environment (build 1.8.0_45-b14) Java HotSpot(TM) 64-Bit Server VM (build 25.45-b02, mixed mode) VM Flags $ jcmd 21689 VM.flags 21689: -XX:CICompilerCount=3 -XX:ConcGCThreads=1 -XX:G1HeapRegionSize=1048576 -XX

JVM Options List - still being maintained post Oracle?

て烟熏妆下的殇ゞ 提交于 2019-11-27 09:29:42
问题 Is the JVM Options List still being maintained anywhere? It seems to have disappeared from Oracle's website, but luckily the Wayback Machine has a copy. 回答1: Use java -XX:+PrintFlagsFinal to print available -XX options. More diagnostic and experimental options can be added to list with following options: -XX:+UnlockDiagnosticVMOptions -XX:+UnlockExperimentalVMOptions (for Sun) -XX:+UnlockInternalVMOptions (for JRockit) NOTE : Current version of javac docs for Java 8 contains list of most -XX

How to set a java system property so that it is effective whenever I start JVM without adding it to the command line arguments

孤人 提交于 2019-11-27 06:53:34
There was a change in Java 1.7 in the way the default Locale is get from the OS. There are methods of restoring the old behaviour e.g. by setting the flag -Dsun.locale.formatasdefault=true when starting a JVM instance. I would like to set this flag permanently so that I don't have to specify it in command line arguments each time when I start a JVM instance. Is there a file or any other possibility to change the default settings for JVM? Something like the Eclipse.ini file but for the JVM itself? a_horse_with_no_name You can set set environment variable JAVA_TOOL_OPTIONS in your OS. All Java

Default values for Xmx, Xms, MaxPermSize on non-server-class machines

痞子三分冷 提交于 2019-11-27 05:24:03
问题 What are the default values for the following options in Java 6 on a non-server-class machine ? -Xmx -XX:MaxPermSize Oracle's documentation states that: On server-class machines running the server VM, the garbage collector (GC) has changed from the previous serial collector (-XX:+UseSerialGC) to a parallel collector (-XX:+UseParallelGC). and On server-class machines running either VM (client or server) with the parallel garbage collector (-XX:+UseParallelGC) the initial heap size and maximum