|
-
October 13th, 2009, 10:33 PM
#1
Java.lang.OutOfMemoryError
"Exception in thread "AWT-EventQueue-0" java.lang.OutOfMemoryError: Java heap space"
Ok, so I have a problem that is giving me this error and I am hoping that there might be someone who could help me out.
Code:
private String CalcFileSize(){
System.out.println("Calculating Size of File");
File _tempFile = new File (fileName.getText());
System.out.print(_tempFile.length());
byte [] _fileSizeGetter = new byte [(int)_tempFile.length()];
_fileSizeToSend = _fileSizeGetter.length;
String _sendFileSize = Integer.toString(_fileSizeToSend);
System.out.println("File Size Calculated");
return _sendFileSize;
}
Ok, this function basically creates a File called _tempFile and loads something into it (for example, if fileName.getText() == "source.pdf" then it will grab that file and throw it into _tempFile). The problem occurs when I use a large file. Particularly something like a 200meg file. Anyone have a suggestion on a possible way around this?
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|