Redefinition failed with error 62 while trying to profile an application
JavaVisualvmJava Problem Overview
If I try to profile application, (which is prepared under Eclipse, but running from command line) with the help of VisualVM, I get the following error message
Simultaneously, the project folder is fouled with newly created class files. Although they are already existing in target/classes
.
The project structure is Maven's, i.e. there is a foder target/classes
in current directory and I us the following command to run the application
java -Xmx16g -cp target/classes tests.Runner01
How to fix?
UPDATE
The same occurs with conventional java project too.
Below it the picture of populated class files, which located where they should not
Java Solutions
Solution 1 - Java
Here https://netbeans.org/bugzilla/show_bug.cgi?id=191297 appears a workaround: run profiled application with -Xverify:none
Solution 2 - Java
According to this GitHub issue, it's been fixed. Updating to version 1.4 solved the problem for me.
Solution 3 - Java
If you are using eclipse, then go to Run/Debug configuration. Select your application from left side and click on Arguments.
Here you will see two text boxes.
1. Program Arguments
2. VM Arguments
In VM arguments, enter below commands. -Xverify:none
Click on apply and then Run/Debug.
Solution 4 - Java
The workaround I found using IntelliJ is to compile to Java 1.6 byte code. The menu option to do so is: File - Project Structure, then set Project language level to 6.
This precludes you from using Java features only available with Java 7 or 8.
Solution 5 - Java
For IntelliJ, you can set -Xverify:none
as follows:
Run > Edit Configurations... > Modify options (Alt + M) > Add VM options.
This should reveal a new field VM options, to which you can write -Xverify:none
.