I am not clear on the following: A class is loaded by JVM when needed, like lazy initialization, right? Now if class A does an import of class B which class B actually is not in the file system (e.g. B.class was deleted or not delivered or any reason) then does class A get loaded and runs if no method
Tag: jvm
Difference between sampling and profiling in jVisualVM
VisualVM has two separate tabs for sampling and profiling. What is the difference between sampling and profiling in VisualVM? Answer Sampling means taking lots of thread dumps and analyzing stack traces. This is usually faster, does not require runtime changes in your bytecode (which may break it), but is also less accurate. Profiling means instrumenting your classes and methods, so
How do I solve javax.net.ssl.SSLHandshakeException on Heroku?
I faced SSLHandshakeException on Heroku. This app was not SSL app. But this app called a ssl-based web api from inside of the app. Usually, using keytool to adopt SSL cert to JVM solves this kind of problem. But how do I this on Heroku? logs here: Answer When you are making a SSL connection to a server, you should
is there a way to know which objects are in “old” area of Heap
I have long cycles of GC. from checks I saw there are too many objects in the tenured (old) area of the Heap. Is there any utitlity to know which objects are in which area of the heap, or any staticstics about these objects. I am using Sun/Oracle HotSpot JVM (Java 6). EDIT: little bit more details about my problem:
JAVA_OPTS for increasing heap size
I want to increase my Heap size. How can I use JAVA_OPTS for doing so.I am getting the following error may be this is because of low heap size Answer You should be able to use the information found in this post. where zzz is your minimum size. where zzz is your maximum size. You can find more info on
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 which fails but -Xmx800m works. I could understand on a 1gb machine, even a 2gb machine, but
Failed to locate method JNI_GetCreatedJavaVMs in the libjvm.dylib (Mac OS)
I am trying to embed java virtual machine in my program but I libjvm.dylib lacks JNI_GetCreatedJavaVMs. The program works fine both on Windows and on Linux platforms. However, when running on Mac OS I’m getting: exception. I use libjvm.dylib located in /System/Library/Frameworks/JavaVM.framework/Versions/1.6.0/Libraries directory. I think the issue is in using the wrong libjvm however, I was unable to find it
How to calculate HashMap memory usage in Java?
I was asked in an interview to calculate the memory usage for HashMap and how much estimated memory it will consume if you have 2 million items in it. For example: The mapping is like this. How would I estimate the memory usage of this HashMap Object in Java? Answer The short answer To find out how large an object
Java implementation of a… JVM?
Some time ago I found the MJVM project. Sadly, this project has been abandoned by it author (I asked Igor via email). I wonder if there is a (continued) open source project of a full implementation of a JVM in Java like this one. By “full”, I mean, not only to emulate mobile devices. Answer The Jikes RVM is probably
How to find out what algorithm [ encryption ] are supported by my JVM?
I am using Jasypt for encryption. This is my code: Uncomment the setAlgorithm line and it will throw an exception org.jasypt.exceptions.EncryptionOperationNotPossibleException: Encryption raised an excep tion. A possible cause is you are using strong encryption algorithms and you have not installed the Java Cryptography Ex tension (JCE) Unlimited Strength Jurisdiction Policy Files in this Java Virtual Machine api says: Sets