7

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

MxTxx
  • 71
  • 1
  • 1
  • 3
  • 1
    hi, can you share your build.gradle? – Tomas Zezula Jul 03 '20 at 13:36
  • You have to share your build files so that others can understand the issue – kaushik Jul 03 '20 at 14:34
  • 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? – Stephen C Jul 03 '20 at 14:58
  • @TomasZezula I have updated the initial question and included the build.gradle file – MxTxx Jul 03 '20 at 16:28
  • @kaushik I have updated the initial question and included the build.gradle file – MxTxx Jul 03 '20 at 16:28
  • 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**? – Andrey Jul 04 '20 at 08:29
  • Please include relevant parts of the build file in your question. The pastebin link is not working any more. – ventiseis Jul 26 '20 at 20:10

2 Answers2

2

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?

Stéphane LANDELLE
  • 6,076
  • 2
  • 10
  • 12
1

If what you have shown us is accurate, you don'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 run using a Java 12+ JVM.

The latter suggests that (despite what you say that you are running your Gradle build using Java 8) 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.

Stephen C
  • 698,415
  • 94
  • 811
  • 1,216