Unrecognized VM option 'AggressiveOpts'
Asked Answered
C

2

9

I'm trying to run my gatling project in intelliJ using Java 8. I know that the VM option 'AggressiveOpts' is deprecated in Java 11 and removed in Java 12, but I was wondering why I am getting this error in Java 8?

I have updated my project SDK to be java 8 as well as updating my intelliJ boot runtime to also be Java 8 but this doesn't seem to work.

I have uninstalled Java and IntelliJ and clean installed them both again but that did not resolve the issue.

I have also tried using a different IDE which is VSC (Visual Studio Code) but I get the same errors as I did in intelliJ.

Unrecognized VM option 'AggressiveOpts'
Error: Could not create the Java Virtual Machine.
Error: A fatal exception has occurred. Program will exit.

My current version of Java is 1.8.0_181

My current version of Gatling is 3.3.1

If it helps I am using gradle and the version is 4.8.1

Can anyone help resolve this issue?

Edit: Added build.gradle code

please see the build.gradle here: https://pastebin.com/MigH0Gxz

Capitalization answered 3/7, 2020 at 12:18 Comment(7)
hi, can you share your build.gradle?Killebrew
You have to share your build files so that others can understand the issueMohenjodaro
1) The option is "-XX:+AggressiveOpts" or "-XX:-AggressiveOpts". Did you include the -XX: prefix? 2) Are you sure that you are compiling with Java 8? What does gradle -V say about it?Gundry
@TomasZezula I have updated the initial question and included the build.gradle fileCapitalization
@Mohenjodaro I have updated the initial question and included the build.gradle fileCapitalization
What Run Configuration do you use to run the application? What Gradle JVM do you have set in Settings (Preferences on macOS) | Build, Execution, Deployment | Build Tools | Gradle | Gradle JVM?Pretend
Please include relevant parts of the build file in your question. The pastebin link is not working any more.Josephina
T
3

The only possible explanation is that you have multiple JDK version installed on your machine and that gradle doesn't pick 1.8.0_181 but 12+ when creating the forked Gatling process. Do you have JAVA_HOME env var defined and where does it point to?

Tish answered 4/7, 2020 at 15:30 Comment(0)
G
2

If what you showed us was accurate (and we can't resolve the pastebin link anymore), you didn't mention AggressiveOpts at all in the Gradle file.

I found an issue in the Gatling issue tracker that mentions this is a problem when you try to run Gatling on newer JVMs. The implication of the issue is that Gatling is supplying the JVM option itself.

However:

  • The issue was apparently fixed in Gatling 3.3.0 (see issue 3807)
  • It should only affect you if Gatling is being run using a Java 12+ JVM.

This implies that (despite what you say!) Gatling is actually using a later version of Java.

For what it is worth, the changeset that fixes this problem simply removes the unknown flag from the gatling.bat and gatling.sh files. You could find and check whichever of those files is relevant to your platform and remove the unsupported option by hand. Or you could try to figure out how Gatling is deciding which JVM to use.

Gundry answered 3/7, 2020 at 17:33 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.