Results 1 to 4 of 4
  1. #1
    thewonkits is offline Member
    Join Date
    Aug 2011
    Posts
    1
    Rep Power
    0

    Default Could not find the main class: java. Program will exit

    I'm attempting to allocate more RAM for the hit game Minecraft, and I've made a batch file which is
    Java Code:
    @ECHO OFF
    "C:\Program Files\Java\jre6\bin\javaw.exe" java -Xmx1024M -Xms1024M -jar "C:\Program Files\Minecraft\Server\minecraft_server.jar"
    But I get the error above when I attempt to run it. Is it not able to find Java? Not recognizing it as a command? What's the deal?
    I'm running 64-bit Windows 7.

  2. #2
    JeffGrigg is offline Member
    Join Date
    Aug 2011
    Posts
    95
    Rep Power
    0

    Default

    Use "javaw" or "java", not both. (So drop "java" from the command line.)

  3. #3
    Thunderpork is offline Member
    Join Date
    Jan 2012
    Posts
    1
    Rep Power
    0

    Default Re: Could not find the main class: java. Program will exit

    Quote Originally Posted by JeffGrigg View Post
    Use "javaw" or "java", not both. (So drop "java" from the command line.)
    What do you mean? I had the same problem as the OP. So I removed 'java' and it is now:

    @ECHO OFF
    "C:\Program Files (x86)\Java\jre6\bin\javaw.exe" -Xmx2048M -Xms2048M -jar "C:\Users\Jay\Downloads\minecraft.exe"

    or should it be

    @ECHO OFF
    "C:\Program Files (x86)\Java\jre6\bin\javaw.exe" java -Xmx2048M -Xms2048M -jar "C:\Users\Jay\Downloads\minecraft.exe"?

    when I do take out the java, I get a new error 'Could not create the Java virtual machine'.

  4. #4
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,224
    Rep Power
    20

    Default Re: Could not find the main class: java. Program will exit

    You're using a 32 bit java, so 2048 is more than it can allocate.

Similar Threads

  1. Replies: 4
    Last Post: 05-28-2011, 08:29 PM
  2. Could not find the main class, program will exit.
    By CourseLanguage in forum New To Java
    Replies: 18
    Last Post: 05-03-2011, 11:14 PM
  3. Could not find the main class, program will exit.
    By aryubi in forum New To Java
    Replies: 39
    Last Post: 02-19-2010, 11:02 AM
  4. Could not find the main class. Program will exit.
    By XSROSSITER in forum New To Java
    Replies: 0
    Last Post: 01-30-2010, 05:17 AM
  5. Could not find the main class. Program will exit.
    By Carrier in forum New To Java
    Replies: 1
    Last Post: 04-22-2009, 03:27 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •