-1

I am working on homework where I have to show runtime of a java program and have to disable java optimization. The teacher has shown how to do it with notepad ++, but I need to disable optimization in netbeans. How can I do this?

  • Please edit the question to limit it to a specific problem with enough detail to identify an adequate answer. – Community Sep 21 '22 at 14:46

1 Answers1

0

You should be able to modify the "VM Options" in the Netbeans "Project > Run > Properties" dialog. You can add the -Xint option to turn off JIT compilation, so that the JVM will only interpret the bytecodes.

There are many other options that can select the JIT compiler used and adjust various optimization settings. However (AFAIK) there is nothing that allows you to JIT compile without doing any optimization.

Note: JIT compilation is an optimization.

You could also learn to run your application from the command prompt. And I think you probably ought to read this How do I write a correct micro-benchmark in Java? which explains the problems of getting reliable benchmark results for Java code.

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