Minecraft won't run after updating Java?

My mother downloaded the newest version of java and now it wont run.

Here is the error message:

[18:15:59 ERROR]: Couldn't launch game
java.io.IOException: Cannot run program "C:\Program Files\Java\jre7\bin\javaw.exe" (in directory "C:\Users\Sarina\AppData\Roaming\.minecraft"): CreateProcess error=2, The system cannot find the file specified
    at java.lang.ProcessBuilder.start(Unknown Source) ~[?:1.7.0_55]
    at com.mojang.launcher.game.process.direct.DirectGameProcessFactory.startGame(DirectGameProcessFactory.java:14) ~[launcher.jar:?]
    at net.minecraft.launcher.game.MinecraftGameRunner.launchGame(MinecraftGameRunner.java:205) [launcher.jar:?]
    at com.mojang.launcher.game.runner.AbstractGameRunner.onDownloadJobFinished(AbstractGameRunner.java:177) [launcher.jar:?]
    at com.mojang.launcher.updater.download.DownloadJob.popAndDownload(DownloadJob.java:122) [launcher.jar:?]
    at com.mojang.launcher.updater.download.DownloadJob.access$000(DownloadJob.java:12) [launcher.jar:?]
    at com.mojang.launcher.updater.download.DownloadJob$1.run(DownloadJob.java:86) [launcher.jar:?]
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.7.0_55]
    at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.7.0_55]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:1.7.0_55]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:1.7.0_55]
    at java.lang.Thread.run(Unknown Source) [?:1.7.0_55]
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
    at java.lang.ProcessImpl.create(Native Method) ~[?:1.7.0_55]
    at java.lang.ProcessImpl.<init>(Unknown Source) ~[?:1.7.0_55]
    at java.lang.ProcessImpl.start(Unknown Source) ~[?:1.7.0_55]
    ... 12 more
[18:15:59 INFO]: Deleting C:\Users\Sarina\AppData\Roaming\.minecraft\versions\1.7.4-mcpatcher\1.7.4-mcpatcher-natives-35438263712980

Solution 1:

It seems as though Java is not included in your PATH variables.

What is PATH?

PATH is a list of directories (or paths) in which your OS is supposed to look for executable files (like *.exe) when running things via the command line, if it is not in the current working directory.

In this case, the minecraft launcher needs to execute javaw.exe from the minecraft directory, rather than the java installation folder, something like:

C:\Users\[user]\AppData\roaming\.minecraft> javaw.exe [more stuff that makes javaw run minecraft]

The java installation folder needs to be in PATH for this to work. Normally that is the case automatically, but something might have gone wrong somewhere.

Adding Java to PATH manually

There's an explanation as to how to do it manually on the java website for the most common operating systems:

It seems you are using Windows 7 or 8, so I will copy the corresponding segments here (You will need Administrator rights for this):

Windows 7

  • Select Computer from the Start menu
  • Choose System Properties from the context menu
  • Click Advanced system settings > Advanced tab
  • Click on Environment Variables, under System Variables, find PATH, and click on it.
  • In the Edit windows, modify PATH by adding the location of the class to the value for PATH. If you do not have the item PATH, you may select to add a new variable and add PATH as the name and the location of the class as the value.
  • Reopen Command prompt window, and run your java code.

Windows 8

  • Drag the Mouse pointer to the Right bottom corner of the screen
  • Click on the Search icon and type: Control Panel
  • Click on -> Control Panel -> System -> Advanced
  • Click on Environment Variables, under System Variables, find PATH, and click on it.
  • In the Edit windows, modify PATH by adding the location of the class to the value for PATH. If you do not have the item PATH, you may select to add a new variable and add PATH as the name and the location of the class as the value.
  • Close the window.
  • Reopen Command prompt window, and run your java code.

Editing PATH in this case means to add C:\Program Files\Java\jre7\bin to the list of values, separated from the other entries by a ;. Here's a picture showing it in Windows 7 (click to enlarge), but 8 should be mostly identical in this case.

Editing PATH

Solution 2:

I stumbled onto this question trying to resolve it myself. I only play minecraft every few months or so and things change rapidly these days. I found the real answer on my own and posted it here.

The Problem

The problem is that the "answers" here don't actually answer the question. First, I am a Java developer and an Android developer. I know, without a doubt, that my Java is properly configured and that there is nothing wrong with my path. The Minecraft Launcher was even able to successfully identify the Java on my system:

[13:34:34 INFO]: Minecraft Launcher 1.5.1 (through bootstrap 5) started on windows...
[13:34:34 INFO]: Current time is Aug 9, 2014 1:34:34 PM
[13:34:34 INFO]: System.getProperty('os.name') == 'Windows 7'
[13:34:34 INFO]: System.getProperty('os.version') == '6.1'
[13:34:34 INFO]: System.getProperty('os.arch') == 'amd64'
[13:34:34 INFO]: System.getProperty('java.version') == '1.8.0_05'
[13:34:34 INFO]: System.getProperty('java.vendor') == 'Oracle Corporation'
[13:34:34 INFO]: System.getProperty('sun.arch.data.model') == '64'
[13:34:34 INFO]: JFX is already initialized
[13:34:34 INFO]: Refreshing local version list...
[13:34:34 INFO]: Refreshing remote version list...
[13:34:36 INFO]: Refresh complete.
[13:34:37 INFO]: Loaded 4 profile(s); selected 'mawcs'
[13:34:37 INFO]: Refreshing auth...
[13:34:37 INFO]: Logging in with access token

And yet, I still get this error when I try to hit the "Play" button:

[13:42:04 ERROR]: Couldn't launch game
java.io.IOException: Cannot run program "D:\Program Files\Java\jre7\bin\javaw.exe" (in directory "C:\Users\<user>\AppData\Roaming\.minecraft"): CreateProcess error=2, The system cannot find the file specified
    at java.lang.ProcessBuilder.start(Unknown Source) ~[?:1.8.0_05]
    at com.mojang.launcher.game.process.direct.DirectGameProcessFactory.startGame(DirectGameProcessFactory.java:14) ~[launcher.jar:?]
    at net.minecraft.launcher.game.MinecraftGameRunner.launchGame(MinecraftGameRunner.java:208) [launcher.jar:?]
    at com.mojang.launcher.game.runner.AbstractGameRunner.onDownloadJobFinished(AbstractGameRunner.java:185) [launcher.jar:?]
    at com.mojang.launcher.updater.download.DownloadJob.popAndDownload(DownloadJob.java:122) [launcher.jar:?]
    at com.mojang.launcher.updater.download.DownloadJob.access$000(DownloadJob.java:12) [launcher.jar:?]
    at com.mojang.launcher.updater.download.DownloadJob$1.run(DownloadJob.java:86) [launcher.jar:?]
    at java.util.concurrent.Executors$RunnableAdapter.call(Unknown Source) [?:1.8.0_05]
    at java.util.concurrent.FutureTask.run(Unknown Source) [?:1.8.0_05]
    at java.util.concurrent.ThreadPoolExecutor.runWorker(Unknown Source) [?:1.8.0_05]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(Unknown Source) [?:1.8.0_05]
    at java.lang.Thread.run(Unknown Source) [?:1.8.0_05]
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
    at java.lang.ProcessImpl.create(Native Method) ~[?:1.8.0_05]
    at java.lang.ProcessImpl.<init>(Unknown Source) ~[?:1.8.0_05]
    at java.lang.ProcessImpl.start(Unknown Source) ~[?:1.8.0_05]
    ... 12 more

The story in screen shots:

Minecraft can see Java on my Path

I still can't launch the game

The Solution

I knew something other than the launcher was looking for Java elsewhere. It turns out, my "profile" was pointing to a specific Java version because I'd overridden the memory settings in a previous play session. To fix this problem, simply edit your profile or create a new one. If you choose edit, at the bottom of the screen is a selection for the Java executable (see screen shots). The simplest solution is to create a new profile.

Profile selection; editing and creating can be done here.

If you edit your profile, this is where the bad path comes from. You can fix it here.