Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 4 of 4

Thread: Java heap space error

  1. #1
    Junior Member
    Join Date
    Jan 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Talking [Solved] Java heap space error

    I'm working on a runescape private server and I recently coded it to preload the world map in order to keep NPCs from "no-clipping" through objects. After I set up the code and went to run the server, I get this error message:

    Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
    	at config.WorldMap.loadWorldMap(WorldMap.java:60)
    	at org.skillmenation.server.Server.main(Server.java:58)

    I found a link and this is what it says:

    How to set java heap size in Eclipse?
    You have 2 options:
    1. Edit eclipse-home/eclipse.ini to be something like the following and restart Eclipse.
     
    -vmargs
    -Xms64m
    -Xmx256m

    I changed my eclipse.ini to:

    -vmargs
    -Dosgi.requiredJavaVersion=1.5
    -Xms64m
    -Xmx512m

    But I'm still getting the same error. Do I need to up the Xmx some more?

    Solved:

    Quote Originally Posted by copeg View Post
    In my version of Eclipse there is a Program Arguments and VM arguments box. If you have these two add it to the VM arguments
    Last edited by Loki; January 27th, 2010 at 10:51 PM.


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: Java heap space error

    While I'm unfamiliar with 'runescape', it seems to me you are setting the heap size for an IDE (Eclipse) and not the program you are running. You should set the heap size using Xmx via a command line when you run the program you want to run (in Eclipse, go to Run -> Run Configurations -> Arguments )

  3. #3
    Junior Member
    Join Date
    Jan 2010
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: Java heap space error

    So I should add:

    java -Xms<initial heap size> -Xmx<maximum heap size>

    in Program Arguments?

    EDIT:
    "Extra Notes: You need to be running windows xp or higher to really try this is loads 213mb worldmap files which in theory means you need to ahve 256mb ram at least to run this without any connections so you probalyl need 512mb ram"

    -http://www.rune-server.org/showthread.php?t=70232
    Last edited by Loki; January 27th, 2010 at 10:17 PM.

  4. #4
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: Java heap space error

    In my version of Eclipse there is a Program Arguments and VM arguments box. If you have these two add it to the VM arguments

Similar Threads

  1. Replies: 15
    Last Post: February 28th, 2010, 10:30 PM
  2. Out of memory - Java heap space
    By fraxx in forum Java Theory & Questions
    Replies: 4
    Last Post: November 24th, 2009, 05:26 AM
  3. OutOfMemoryError (Java heap space)
    By chronoz13 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: November 21st, 2009, 11:56 AM
  4. how do you leave a line space in java?
    By ss7 in forum Java Theory & Questions
    Replies: 7
    Last Post: November 5th, 2009, 08:20 AM
  5. Replies: 4
    Last Post: April 29th, 2009, 10:53 AM