MacOS – Java 100 % CPU usage

activity-monitorjavamacbook promacos

I am using IntelliJ IDEA compiler for Java programming on my MacBook Pro 2015 Retina (Yosemite). When I run some Java program in my activity monitor appears Java process and takes 100+% of CPU. The fans start to run loud since it's starting to heat up. Sometimes there are 5 and more same Java processes and couple of them are using 100%. Those processes are turned off when I quit IntelliJ or when I quit them manually.

Can somebody tell me why is this happening, or how to fix this if it is possible to fix?

Best Answer

You're running a program. It's using resources. If you want a program to run, it runs using any resources it needs as available. This is the intended behavior.

If you want to limit the resources available to your IDE, you can do that. Limiting the resources provided is pretty easy (provided you're willing to work with a little bit of third-party software.) You can use cputhrottle to limit the usage at the system level (better explained here.)