Java uses all CPU while playing Minecraft

I am using Ubuntu too here are a couple of questions and suggestions ...

1) Are you using the open JDK? If you install sun's JDK and run the command sudo update-alternatives --config java and select Sun's JDK.

2) What speed is your processor and how many cores and how much RAM do you have? You might to specficy some command parameters when you run minecraft. Try giving minecraft more RAM by using the -Xmx and -Xms to give Minecraft more RAM at startup. You can read more about that here. For example the command I use is java -Xmx5000m -Xms5000m -jar minecraft.jar

3) Try turning down your video settings. Turn down the render distance and switch the graphics settings to Fast.


I just had this exact problem with a fresh 11.04, setting up the Sun JDK was a doozie, and even then my CPU was spiking over 100% usage, whoa! I could hear the clock in my headphones

Here where my steps to solve it:

  1. Go to synaptic, enable the Canonical Partners repos (the two unchecked boxes)
  2. completely remove the open jdk and jre.
    • You should be prompted to mark the Sun JDK/JRE for install
  3. Install
  4. java -version in a terminal you should get: Java(TM) SE Runtime Environment instead of the OpenJDK
  5. Try to fire up minecraft with java -Xmx1024M -Xms512M -cp minecraft.jar net.minecraft.LauncherFrame
  6. At this point I was noticing the insane CPU usage when adding multiplayer servers (weird). On the main menu in options -> Video Settings change performance to Power Saver

I was stunned that this worked. I remember my old dell laptop had a CPU clock issue where I could hear the high freq in my headphones, the solution was to underclock the processor to get rid of the noise. Pretty cool, it's like underclocking the JVM or telling it to be more sparring with the CPU (which in this case solved made everything run smoothly)

Hope this helps someone