Question : java.lang.OutOfMemoryError<wbr />: Java heap space in Eclipse using CPLEX

I am getting a memory error while building an IP model with Eclipse. I am calling CPLEX solver.
The exception that I get is
Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
      at ilog.cplex.CpxQExpr.(CpxQExpr.java:36)
      at ilog.cplex.CpxQextractor.visitNegative(CpxQextractor.java:52)
      at ilog.cplex.CpxNegative.accept(CpxNegative.java:23)
      at ilog.cplex.CpxQextractor.visitLinkedExpr(CpxQextractor.java:80)
      at ilog.cplex.CpxLinkedExpr.accept(CpxLinkedExpr.java:46)
      at ilog.cplex.CpxRange.(CpxRange.java:1334)
      at ilog.cplex.IloCplexModeler.addRange(IloCplexModeler.java:4043)
      at ilog.cplex.IloCplexModeler.addEq(IloCplexModeler.java:4173)
      at model.BalanceHindsightTimeBucketsv15.solveModel(BalanceHindsightTimeBucketsv15.java:322)
      at model.BalanceHindsightTimeBucketsv15.(BalanceHindsightTimeBucketsv15.java:146)
      at test.DBTest.main(DBTest.java:31)

The line that I am getting the exception is in the code. This constraint is added successfully for almost half of the model, then it gives this error. When I run the model for shorter time horizon(i.e., smaller model) it works.

I tried increasing the JVM memory to 768MB that eclipse is using via eclipse.ini file. It didn't work. I found in many websites that JVM memory can be altered for a class with running
java -jar myJar.jar -Xmx768M. I tried running myJar.jar this way via command prompt, it gave some other error related to CPLEX.

So, my question is:

How do I increase the default heap size of eclipse or JVM for all the projects?
Code Snippet:
1:
2:
//add x=y+z constraint	
cplex.addEq(chassis[index][t], cplex.sum(chassisImb[index][t],converted[index][t]),myLaneVector.get(index).getMyLane()+" at time "+ t+ " x=y+z constraint for that lane ");

Answer : java.lang.OutOfMemoryError<wbr />: Java heap space in Eclipse using CPLEX

try setting the runtime parameters from the Java tab
Random Solutions  
 
programming4us programming4us