Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6727705
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T10:04:51+00:00 2026-05-26T10:04:51+00:00

While running the following code i am getting the error java.lang.OutOfMemoryException : java heap

  • 0

While running the following code i am getting the error java.lang.OutOfMemoryException : java heap space

My code is:

public class openofficeupdate {
String databaseurl="C:\\mydbdir\\location\\salesforce"; // Path of the base after renaming and extraction
openofficeupdate() throws ClassNotFoundException, SQLException{
    System.out.println("Entered into constructor");
    Connection connection=null;
    Statement statement=null;
   try{
    Class c=openofficeclass();
    System.out.println("Class name set");

    Connection cntn=createConnection(databaseurl);
    connection=cntn;
    System.out.println("connection created");

    Statement stmt=createStatement(cntn);
    statement=stmt;
    System.out.println("Statement created");

    executeQueries(stmt);
    System.out.println("Query executed");

    closeStatement(stmt);
    System.out.println("Statement closed");

    closeConnection(cntn);
    System.out.println("Connection closed");

    }catch(Exception e){
        System.out.println(e);

        closeStatement(statement);
        System.out.println("Statement closed");

        closeConnection(connection);
        System.out.println("Connection closed");
    }
}
public static void main(String args[]) throws ClassNotFoundException, SQLException{
    new openofficeupdate();
}

private Class openofficeclass() throws ClassNotFoundException {
    return Class.forName("org.hsqldb.jdbcDriver");
}

private Connection createConnection(String databaseurl) throws SQLException{
    return DriverManager.getConnection("jdbc:hsqldb:file:" +databaseurl,"sa","");
}

private Statement createStatement(Connection cntn) throws SQLException{
    return cntn.createStatement();
}

private void closeStatement(Statement stmt) throws SQLException{
    stmt.close();
}

private void closeConnection(Connection cntn) throws SQLException{
    cntn.close();
}

private void executeQueries(Statement stmt) throws SQLException{
    System.out.println("Going to execute query");
    int status=stmt.executeUpdate("insert into \"Mobiles\" values(9874343210,123,'08:30:00','09:30:06')");
          12','2010-12-14','c','Casula')");
    System.out.println("Query executed with status "+status);
 }
}

I am using NetBeans IDE… Is there any option there to control this kind of errors?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T10:04:52+00:00Added an answer on May 26, 2026 at 10:04 am

    In Netbeans 7.0:

    • You can right click on the project, and select Properties.

    • Click on Run category and insert you configuration in VM Options

    • For instance, in your case, paste: -Xmx512m (512Mb) as suggested by rm5248

    You can read Playing with JVM / Java Heap Size for further information.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I am getting the following error while running my MVC application, which uses the
I am getting the following error while running my android project in which I
Im getting invalid argument error when running the following code. Im trying to change
I am getting following error while running the application on the device: Command /Developer/Platforms/iPhoneOS.platform/Developer/usr/bin/gcc-4.2
I am getting he following Exception while running my Quartz Schdular program. Below is
hi i am getting the following exception while running my application and my applicationContext.xml
I'm getting an Undefined Instruction error while running an embedded system, no coprocessor, no
I am getting following exception while running BIRT from a Linux OS. Caused by:
I am getting the following Warnings while running tests using cc.net c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\Microsoft.Common.targets (,): warning
I am getting following error while trying to connect to a sftp server:- ncftpput:

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.