This week's giveaway is in the EJB and other Java EE Technologies forum.
We're giving away four copies of EJB 3 in Action and have Debu Panda, Reza Rahman, Ryan Cuprak, and Michael Remijan on-line!
See this thread for details.
The moose likes Java in General and the fly likes how to increase jvm heap size in jdk1.5.0 Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "how to increase jvm heap size in jdk1.5.0" Watch "how to increase jvm heap size in jdk1.5.0" New topic
Author

how to increase jvm heap size in jdk1.5.0

durgaprasad ganji
Greenhorn

Joined: Mar 01, 2007
Posts: 7
Hi all,

I am getting java.lang.OutOfMemoryError: Java heap space Exception ,

when running below java class in eclipse editor by configuring JVM of JDK1.5.0 within eclipse (or at command prompt) on windows platform

by using below class I am merging two Index Directories(one is 1.87 GB of size and other one is 522 MB of size) into new one using Lucene API
import java.io.File;
import org.apache.lucene.analysis.standard.StandardAnalyzer;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.store.Directory;
import org.apache.lucene.store.FSDirectory;
import org.apache.lucene.store.RAMDirectory;
public class MergeIndex {


private MergeIndex (){

}
public static void main(String arg[]) throws InvalidDocDBXMLFormatException {

try{
mergeIndexes();

}catch(Exception e){
e.printStackTrace();
}


}


public static void mergeIndexes() {

try {
System.out.println("before add indexwriter");
IndexWriter writerDisk = new IndexWriter(FSDirectory.getDirectory(new File("D:\\DocServerData\\MergedIndexes\\DocDB1_Category1_Index"), true),new StandardAnalyzer(),true);
long l1 = System.currentTimeMillis();
System.out.println("before addIndexes method>>>>"+l1);
writerDisk.addIndexes(new Directory[]{FSDirectory.getDirectory(new File("E:\\1lac-7mar\\DocDB1_Category1_Index"), false),FSDirectory.getDirectory(new File("E:\\2lacs-19feb\\DocDB1_Category1_Index"), false)}) ;
long l2 = System.currentTimeMillis();
System.out.println("before Optimize method>>>"+ (l2-l1));
writerDisk.optimize();
System.out.println("after Optimize method"+System.currentTimeMillis());
writerDisk.close();
System.out.println("after add indexwriter");
}catch(Exception e){
System.out.println("Exception Occured>>>>>>" +e);
}

}
}


below is snapshot of my java class

Call tree (all threads together)
Name Time (ms)
All Threads
831,735 100 %
MergeIndex .main(String[])
831,563 100 %
java.lang.ClassLoader.loadClassInternal(String)
171 0 %

Generated by YourKit Java Profiler 6.0.12 Mar 9, 2007 10:34:49 AM


It would be appreacited if any body tell me how to increase JAva heap size
in jvm on windows paltform
Wiyanto Ngasinur
Ranch Hand

Joined: Dec 11, 2006
Posts: 34
run your java class with command line :
java -Xmx1G [class]

this code set maximum heap 1 Giga
Deepak Bala
Bartender

Joined: Feb 24, 2006
Posts: 6657
    
    5

Again. Not SCJP


SCJP 6 articles - SCJP 5/6 mock exams - More SCJP Mocks
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 13868
    
  10

You already asked the same question, have a look at the answers there.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 7 API documentation
Scala Notes - My blog about Scala
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: how to increase jvm heap size in jdk1.5.0
 
Similar Threads
Linked List equals method
Java Intermediate Queries....
Mapping DB columns to Object
Getting a problem while using database connectivity
Where is the Context Switch Effect in Java?