Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
Hi guys,
the following code is giving me the above exception at run-time and for some reason I cen't run it from the console-another exception NoClassDefFounder or something appear if I try to run it from the console by increasing the heap to the max.
I want to run it from my Netbeans5 IDE from where I am building it,but have no idea from where/how to incerase the heap size. There's nothing in the Options of the IDE, nor inthe Controlpanel/java , see the heap in jconsole can't change it though.
Any suggestions?
Thanks
import java.io.*;
import java.awt.*;
import java.lang.*;
import java.util.*;
import java.awt.event.ActionListener;
import java.awt.event.ActionEvent;
public class TheStuModMain {
static public BufferedReader keyboard =
new BufferedReader(new InputStreamReader(System.in));
public static Vector v1 = new Vector();
public static Vector v2 = new Vector();
public static UndModule undmod1 = new UndModule(8001,"IntroComp"); //Modules initial loading/instantiation & storage into the vector v2
public static UndModule undmod2 = new UndModule(8003,"OOP");
/** Creates a new instance of TheStuModMain */
public TheStuModMain() {
}
/*public Object SrchMod(int modn) {
for(int i=0;i<v2.size();i++) {
UndModule undmod;
undmod = (UndModule) v2.elementAt(i);
if ( modn == undmod.getModNumber() )
}
}*/
public static void AddUndStudentRecord(int stnumber) {
Undergraduate undstu = new Undergraduate(stnumber);
v1.add(undstu);
int sizeInV = v1.size();
undmod1.enrol(undstu);v2.add(undmod1);
undmod2.enrol(undstu);v2.add(undmod2);
//undmod1.enrol(stnumber);
int intv;
for(int i=2;i<=4;i++) {
System.out.print("Add module no. :");
intv = Text.ReadInt(keyboard);
for(int j=0;j<v2.size();j++) {
UndModule undmod;
undmod = (UndModule) v2.elementAt(j);
if ( intv == undmod.getModNumber() )
undmod.enrol(undstu);v2.add(j,undmod);
//if (j==4) System.out.println("No such module....");
}
}
}
public static void main(String[] args) {
//TheStuModMain tsmm = new TheStuModMain();
v1 = new Vector(); // vector for students
v2 = new Vector(); // vector for modules
v2.add(undmod1);
v2.add(undmod2);
UndModule undmod3 = new UndModule(8005,"AI");v2.add(undmod3);
UndModule undmod4 = new UndModule(8006,"Math");v2.add(undmod4);
UndModule undmod5 = new UndModule(8007,".NET framework");v2.add(undmod5);
UndModule undmod6 = new UndModule(8008,"Java+Oracle");v2.add(undmod6);
UndModule undmod7 = new UndModule(8009,"Compiler Construction");v2.add(undmod7);
UndModule undmod8 = new UndModule(8010,"Internet Commerce Technology");v2.add(undmod8);
AddUndStudentRecord(56789);
//undmod1.enrol( new Undergraduate(1111));
v1.add(undmod1.students[0]);
//Members = new Vector();
//undstu.modulest[0].modnumber=11;
System.out.println(v2.elementAt(0).toString());
//System.out.println(v2.elementAt(1).toString());
//undstu1 = (Undergraduate) undstu;
// System.out.println(undstu1.Modules_Taken());
}
}>

