How To Increase The Heap Size More Than 1024m

Sep 29, 2014

When I try to write the .xlsx file using apache POI,  XSSFWorkbook API and run this program in Eclipse STS, I am getting the java.lang.OutOfMemoryError: Java heap space error. Then I searched the net and add these -Xms512m -Xmx1024m in the eclipse VM arguments. Even though I am getting the same error. Again i increase heap size but i am getting the different error like "occurred during initialization of VM, Could not reserve enough space for object heap". how to increase the heap size or any other API to read, delete and write the .xlsx file. I am having 4GB ram in my machine. Apache POI is very good for .xls but if it is .xlsx performance wise it is very slow.

View Replies


ADVERTISEMENT

Applet Out Of Memory Error / How To Increase Available Heap Space

Jul 7, 2014

I was wondering where is the memory allocated for an applet; by the browser; by the JVM; some applet specific java option? I get an out of memory error when running my applet (loading pictures).

View Replies View Related

Increase Size Of Array But Getting Null Values

Dec 3, 2014

I'm working on a program to create a blackjack game using objects (one for card, deck. and hand). Withing my hand object I am trying to add cards to the hand but it is only adding the last card i try to add and giving null values for the the ones before.

class BlackJackHand {
private BlackJackCard [] hand;
public void addToHand(BlackJackCard c) {
if (hand == null) {
BlackJackCard [] tempHand = new BlackJackCard[1];
tempHand[0] = c;
hand = tempHand;

[Code] ....

What I want this section to do is add cards to the current hand. I was intending for it the hand to be null at first and the if(hand == null) piece to add the card the first time and then the else piece would be used when the hand already has at leas one card. I want the else section to create a temporary array that is one larger than my current hand, copy the cards from the old hand to the new hand, and then add a new card to the last space before rewriting the old hand as what the temporary hand is.

The code I am using to test if the addToHand() is working is

class BlackJackTest
{
public static void main (String[]args) {
BlackJackCard c1= new BlackJackCard(1,0);
BlackJackCard c2= new BlackJackCard(1,4);
BlackJackCard c3= new BlackJackCard(1,5);
BlackJackHand h1 = new BlackJackHand();

[Code] .....

BlackJackCard has the parameters (int suit, int value)

This should print:
ace of clubs
4 of clubs
5 of clubs

but instead prints:
null
null
5 of clubs

View Replies View Related

Increasing Java Heap Size

Nov 21, 2013

I am using a 64 bit Win 7 Pc with 64-bit JVM and we get the error: Java heap space. So we want to increase the Java heap size but not for one application but for every application or in general.

We tried with the java -xmx command but it didn't work...

We tried setting the system variable JAVA_OPTS but again it didn't work...

View Replies View Related

Sales Tax Increase At 6% Not Working

Feb 8, 2015

import java.util.Scanner;
public class SalesTax {
public static void main(String [] args) {
Scanner input = new Scanner(System.in);
 
double total = 0;
double currentTax = 0;

[Code] .....

View Replies View Related

MouseListener - How To Increase A Value By Clicking It

Dec 25, 2014

I want to make a simple game and learn java by experimenting with it.I don't know how to increase a value by clicking it.I know how to make my objects move in my small game with mouse or keys, but I also got a score var that I want to increase per click. I can increase it over time, but after 2 hours of trying I couldn't progress any further.This is the piece of code I used, I imported the class, got getters n setters and all of that...

if(e.getButton() == MouseEvent.BUTTON3) hud.setScore(hud.getScore() + 555);
Whenever I click I get an error, if I remember right "NullPointerException" is when something is missing I'm probably not targeting the value correctly...
Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
at com.tutorial.main.MouseListens.mouseClicked(MouseListens.java:22)
at java.awt.Component.processMouseEvent(Unknown Source)

[code]...

View Replies View Related

Increase Counter When A Post Is Made?

May 15, 2015

I was wondering what the easiest way would be to keep track of everytime someone makes a new post on reddit (social media site, for those who don't know). I want the program to keep track of the number of posts made with a counter, but that's the easy part. How do I set up a program to actually communicate with and monitor reddit's servers in this manner?

View Replies View Related

How To Increase Hours Of Employee At Given Index

Oct 7, 2014

Basically I need to increase the hours of an employee at the given index. Index is the position of the employee in the array, and amount is how many hours you will be increasing by.

This is what I have so far,

public void increaseHours(int index, double amount){
for(Employee e: employees){
if(e instanceof HourlyEmployee){
HourlyEmployee he = (HourlyEmployee)e
he.increaseHours(amount);
}
}
}
}

I'm not sure how to use the index to do this correctly, all it's doing right now is adding hours to every hourly employee

View Replies View Related

How To Increase Hours Of Employee At Given Index

Oct 7, 2014

Basically I need to increase the hours of an employee at the given index.Index is the position of the employee in the array, and amount is how many hours you will be increasing by.

This is what I have so far,

public void increaseHours(int index, double amount){
for(Employee e: employees){
if(e instanceof HourlyEmployee){
HourlyEmployee he = (HourlyEmployee)e
he.increaseHours(amount);
}
}
}
}

View Replies View Related

How To Increase Memory So That Xml File Will Get Loaded

May 19, 2015

While loading very huge xml file i m getting heap space error in myeclipse. So I wanted how to increase memory so that xml file will get loaded?

View Replies View Related

Unable To Increase Tvalue Of Number By One After Each New Runner Added

May 6, 2014

I have been playing around all day trying to get this to increase the value of number by one after each new runner is added. How to get the value of number to increase after each record is added?

public class Runner
{
/* static variables */
/* instance variables */
private int number; // runner's number
private String name; // runner's name
private String ageGroup; // standard, junior or senior
private int time; // runner's marathon time in minutes

[Code]...

View Replies View Related

How To Make Pong Ball Slowly Increase Speed

Apr 11, 2013

I was making a pong game, part copied code off the internet, part my own code, part my friends code. It works well enough, but the ball starts at one speed, and stays the same. I would like to know how to make the ball slowly increase.

It is a java applet, which shouldn't casue any harm right?

My code:

Pong Applet
 
import java.applet.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
 public class Pong extends Applet implements MouseMotionListener, KeyListener {
 
[Code] .....

View Replies View Related

Live Bytes For Object Instance In JVisualVM Increase On Every Operation

May 5, 2014

Whenever i perform any operation in my application Live Bytes of a particular Instance of a class increases by 1000.Although i perform the same operation everytime it always increases by 100 or 1000.Is this a memory leak or does these instances increase everytime we perform an operation.

View Replies View Related

Create Circular Array Which Prints Out 8 Numbers That Increase By One And Don't Exceed 9

Jan 31, 2015

I'm trying to create a circular array which prints out 8 numbers that increase by one and don't exceed 9. If they do, the remaining numbers are printed from 0 on-wards. I have code below which does this job, but it doesn't really use an array to loop back.

Java Code:

package Practice;

public class Practice
{
public static void main(String[] test)
{
number(7);
number(9);

[code]...

View Replies View Related

Array Not Updating As A Heap?

Sep 25, 2014

When I add an element to my array, I have to make sure that it stays a heap, ie every child is smaller than its parent. However the method that I am using for this, trickling up, is not updating the elements properly, it pretty much just leaves is as is.

Here is the relevant code:

public class MaxIntHeap {
int[] array;
int actualSize = 0;
public MaxIntHeap(){
array = new int[20];

[code].....

View Replies View Related

Implementing Heap From ArrayList

Nov 25, 2014

in my class is implement a heap and use some of the methods we were provided. The methods I was provided to code and use are "siftDown", "isEmpty" and "heapify". I'm pretty sure the code I have written for "heapify" and "isEmpty" is correct, where I think I am finding fault is the code for my "siftDown". Would you mind taking a look at my code and see why when adding integers to the heap object that I have created in the main code, that they are not being output correctly?

public class Tester {
public static void main(String[] args) {
Heap myHeap = new Heap();
myHeap.insert(9);
myHeap.insert(15);
myHeap.insert(6);
myHeap.insert(4);
myHeap.insert(10);
myHeap.insert(9);
myHeap.insert(3);

[code]....

View Replies View Related

Priority Queue Implementation Using Heap / BST

Dec 4, 2014

I am in the process of implementing Priority queue, as I understand that there are many data structures you could use to implement. I implemented it with the an array, which it works absolutely fine. However I have limitations on what collections I can use from the collections classes. I fact I cant use any of the collections classes. Meaning I cant use array.

I’m trying to implement Priority Queue using heap. And implementing heap using binary trees. But however I have a few questions which I need to clarify and I cant think of any other way of resolving it. Ofcourse I can implement my own simple array class using linked list.

Inserting into heap would be quite simple, as I just need to find the right last position from left to right leaf to insert the node into the tree. However after inserting, you may want to make sure that leaf node values are > than root node. Therefore, the root node will always be with the highest priority.

I call these steps where you compare from top down as bubbledown and bubbleup. To do this I really need a for each node within the treee node to have attribute pointing to its root node. So in case of bubbleup I always have a pointer for a given node to its root, without it would mean I would to traverse through the entire tree to identify its root. Which I believe is very inefficient.

Or have I taken this completely wrong? Or is it the case that heap are only best with arrays and therefore use array (by implement it using linked list?)

View Replies View Related

Application Hanging But No Heap Exhaustion?

Jul 3, 2014

maximum heap size is set at 1.5GB and consumption of memory at peak load is about 1.1GB. when it reaches 1.1GB, application starts to hang. what could be the problem? shouldn't it be hanging at the point where memory is about equal to the max heap setting? no heap dumps were generated. is this due to server hardware or something? already got the garbage collection data and nothing seemed unusual.

View Replies View Related

Using Min-heap To Sort List Of Words

May 5, 2015

I am learning to use heaps and as an exercise I am trying to write a program using a heap class I have created to sort words. I have read in words from a file and added them to the heap successfully. I am having some trouble figuring out how I can print out a sorted list of the words. From my understanding of how a min-heap works, if I remove from the min/root node they will always be removed in sorted order. So far I have tried out to do a simple for loop but, only half of the heap is being removed. Not sure if my logic is incorrect of there is an error somewhere in my removeMin() function specifically in the while loop.

public static void main(String[] args) {
Heap heap = new Heap();
heap = read( heap );
for( int i = 0; i < heap.getSize(); i++){
heap.removeMin();

[Code] ....

View Replies View Related

Ratio Of Memory (RAM) To Heap Space?

Nov 10, 2013

What is the ratio of Memory(RAM) to heap space ? ie: When JVM will throw OutOfMemoryError based on heap available to JVM ?

OutofMemoryError - Memory:RAM size

View Replies View Related

Heap Memory Consumed By Solaris JVM

Dec 16, 2013

I have two unix systems in which on one system I installed sun solaris jdk and on another system I installed IBM jdk.
 
Java programs which consume more heap memory are getting failed on sun solaris jdk system where as same programs are successfully getting executed on IBM jdk system .
 
My question is does sun solaris 64 bit jdk needs more heap than IBM 64 bit jdk ??

View Replies View Related

Computing New String - Memory Out Of Heap Error

Sep 28, 2014

Given a string, compute a new string where identical chars that are adjacent in the original string are separated from each other by a "*". My implementation :

package com.tcs.dash;
public class StringBuild {
public String edit(String userIp){
StringBuilder builder = new StringBuilder(userIp);
String replaceText = "";
for(int i = 0; i < builder.length() - 1; i++){
if(builder.charAt(i) == builder.charAt(i+1)){
replaceText = builder.charAt(i) + "*" + builder.charAt(i+1);
builder = builder.replace(i, i+1, replaceText);
}
}
return builder.toString();
}
}

I am getting error at line 13. An exception actually.

I/P given = aaaa

Console:

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at java.util.Arrays.copyOf(Unknown Source)
at java.lang.AbstractStringBuilder.expandCapacity(Unknown Source)
at java.lang.AbstractStringBuilder.ensureCapacityInternal(Unknown Source)
at java.lang.AbstractStringBuilder.replace(Unknown Source)
at java.lang.StringBuilder.replace(Unknown Source)
at com.tcs.dash.StringBuild.edit(StringBuild.java:13)
at com.tcs.dash.StringBuildExample.main(StringBuildExample.java:14)

View Replies View Related

JavaFX 2.0 :: Objects Don't Free Heap Memory

Apr 9, 2014

I have a simple JavaFX Application that open a Browser and shows google page. After exit the Application and free all objects, I can see that the JavaFX objects like Scene, Stage, WebView and WebEngine are alive in the heap memory after call GC. I can see this objects with JProfiler and other Profiler tools.

This is my Test code:
import java.awt.FlowLayout;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
import javafx.application.Application;
import javafx.application.Platform;

[Code] .....

And my JavaFX Application:

import javafx.application.Application;
import javafx.geometry.HPos;
import javafx.geometry.VPos;
import javafx.scene.Scene;
import javafx.scene.layout.Region;import javafx.scene.paint.Color;

[Code] .....

To test the application click on Start Button to show google web page, click on Stop Button to stop the application, run a Profiler tool, and call gc, the JavaFX classes are alive. I am using java version "1.7.0_51" and windows 8.1 Is there something wrong in my code? Or this is the normal behavior?

View Replies View Related

JDBC By Using Properties Objects Show Password In Heap

May 4, 2015

Properties info = new Properties( );
info.put( "user", "username" );
info.put( "password", "password" );

Connection conn = DriverManager.getConnection(URL, info);

I am using simple jdbc connection to connect to Sybase as shown above , problem is security team is able to see password as clear text in heap, How to avoid it.

View Replies View Related

Return Height Of Heap Of Sand In Bottom Of Hourglass

Nov 18, 2014

I am working on program and have been struggling to get around step 5 and 6 given below.

I have got on with the first couple of points. Where to begin with steps 5 and 6.

Java Code:

class Hourglass {
int height;
int bottomHalf;
public Hourglass (int h) {
height =h;
}
public Hourglass (){
height=3;
}

/*Write a method dropGrain that simulates one grain of sand falling into the bottom half of the Hourglass. If all the sand is already at the bottom before a grain is dropped, this method should cause the hourglass to be flipped, meaning that all the sand will be in the top again. Then, one grain of sand should fall. */

//Hint: this method can be quite short. All you need to do is update one attribute.

public void dropGrain(){
}

/*Write a method getHeapHeight() which returns the height of the heap of sand in the bottom of the hourglass.

Hint: a triangle of height h contains h*h grains (=1+3+5+...+h).

So determining the height when the amount of sand in the bottom half is a square (1,4,9,16,...) is easy. Think about what happens if the amount of sand is not exactly a square.*/

public int getHeapHeight() {
} mh_sh_highlight_all('java');

View Replies View Related

Facing OutOfMemory Java Heap Space Error

Jun 21, 2014

I am not a java developer, but I am using a java code that was available online to convert a large XML file to CSV file. The input file size is big, it is around 3GB. I got an error that it is out of memory, it is expectedly due to the large input file that i am trying to convert. Splitting of this file is not possible,

This is what I ran : xml2csv-conv data.xml data.csv

Error:

Exception in thread "main" java.lang.OutOfMemoryError: Java heap space
at com.sun.org.apache.xerces.internal.dom.DeferredDoc umentImpl.createChunk(Unknown Source)
at com.sun.org.apache.xerces.internal.dom.DeferredDoc umentImpl.ensureCapacity(Unknown Source)
at com.sun.org.apache.xerces.internal.dom.DeferredDoc umentImpl.createNode(Unknown Source)
at com.sun.org.apache.xerces.internal.dom.DeferredDoc umentImpl.createDeferredTextNode(Unknown Source)
at com.sun.org.apache.xerces.internal.parsers.Abstrac tDOMParser.character

[code]....

Additional information: I am running this from a Windows8 64 bit machine with 8GB physical RAM.

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved