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 894447
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T14:23:20+00:00 2026-05-15T14:23:20+00:00

I have a .JAR that apparently uses up too much memory, and throws an

  • 0

I have a .JAR that apparently uses up too much memory, and throws an exception “Java heap space” (or something similar).

So I tried running the .JAR via the CMD like this:

C:\MyFolder>javaw -jar MyJar.jar -Xms64m -Xmx128m

That did not solve the problem. Same error.
Now, when I checked the Processes tab in the windows task manager, I noticed that the process of my jar has a lot less memory than what i asked for (same as running it without the parameters).

Why is it ignoring the parameters?

Also, I think the exception is thrown around the time the process reaches 100mb of memory usage. Is it possible that the GC is trying to free up the memory and that’s what causes the problem? Is there any parameter I can set for the GC to prevent that?

Thanks, Malki 🙂

  • 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-15T14:23:21+00:00Added an answer on May 15, 2026 at 2:23 pm

    The Command

    javaw -jar MyJar.jar -Xms64m -Xmx128m
    

    will use -Xms… and -Xmx… as parameters to the “main(String[] args)” method.
    Parameters to the JVM must be passed before the -jar part:

    javaw -Xms64m -Xmx128m -jar MyJar.jar
    

    The reason for that can be seen when we execute “java -version” :

    Usage: java [-options] class [args...]
               (to execute a class)
       or  java [-options] -jar jarfile [args...]
               (to execute a jar file)
    

    Where your parameters -Xms… and -Xmx… are options to the JVM.

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

Sidebar

Related Questions

I have a java JAR file that is triggered by a SQL server job.
If I have a jar that I need to run using java -jar FOO.jar
I have a JAR file that contains an API that uses external model files.
I have plain Jar Project that reference by android application. Then, I have Functions.java
I have an application called Update.jar that I'm trying to use with the java
I have a .jar file that i've placed in my D:\Coldfusion8\wwwroot\web-inf\lib\ directory. The file
I have a jar file that has a file named client.ts in (when viewing
I have a jar file that I would like to execute using PHP, but
I have an executable jar Client.jar that requires jndi.properties file. Since the jndi properties
I have a 3rd party JAR that I have converted to an OSGI bundle

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.