• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Junilu Lacar
  • Liutauras Vilda
Sheriffs:
  • Paul Clapham
  • Jeanne Boyarsky
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Piet Souris
  • Carey Brown
Bartenders:
  • Jesse Duncan
  • Frits Walraven
  • Mikalai Zaikin

Command line options in TextPad

 
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,
I am trying to process an audio file,but the size of the music file about 72.3Mb,when i am trying to run it, it displays: java.lang.OutOfMemoryError:
java heap space.So what is the problem,Can't I process this much amount of data size.
Thanks

[ EJFH: Changed subject line. ]
[ May 18, 2006: Message edited by: Ernest Friedman-Hill ]
 
author and iconoclast
Posts: 24204
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Java's heap is of a fixed size determined at launch time. Use the -XmxNNm switch to increase the available memory, where NN is the heap size in megabytes. The default is 64MB for most of Sun's JVMs.
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
By default, Java usually runs with a maximum heap size of 64 MB. You can increase this using the -Xmx option, for example:

java -Xmx256m MyClass

runs MyClass with a maximum heap size of 256 MB. Note that depending on how your program handles the file, you may well need more than just 72.3 MB.

Also, I don't know what sort of processing you're doing, or what APIs you're using, but it would quite possibly be a good idea to find a way to process the data a little bit at a time, so that you aren't forced to load the entire file into memory at once. A streaming solution would be nice. It's something to think about, anyway...
 
wondwosen Getachew
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thank you for your reply,
But where am i supposed to write java-XmxNNm option to increase the heap space,can u give me a full path to increase the heap size
Thanks u
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24204
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When you start your program, you likely say something like

java MyClassName

Instead, you'd want to say something like

java -Xmx200m MyClassName

I'm going to move this to Java in General (Beginner).
 
wondwosen Getachew
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Where should I put this :java -Xmx256m ,pls if u can show me with example,
Thanks
 
Jim Yingst
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Well, um... EFH just gave you an example. Let's try this. You say you are "trying to process an audio file". Are you using the Java programming language to do this? How do you start this program or application or whatever it is? Is it something you wrote youself, or did you get it from somewhere? If it's some commercial software - what's it called? If you wrote it in Java - are you using an IDE, such as IntelliJ, Eclipse, WSAD, JDeveloper, JBuilde, or something else? This information will (hopefully) help us to answer your question in terms that will make better sense for you.
 
Ranch Hand
Posts: 257
Hibernate Firefox Browser Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by wondwosen Getachew:
Hello,
I am trying to process an audio file,but the size of the music file about 72.3Mb,when i am trying to run it, it displays: java.lang.OutOfMemoryError:
java heap space.So what is the problem,Can't I process this much amount of data size.
Thanks



Well,

See, you have 72.5 Mb file now and getting problem , you can solve this by increaing the heap. But what, in future if you need 1000Mb what will you do?

So the best solution is packet method or divide and get. Let one thread play the song and another thread assist in getting the data in packets to play.

Make any solution KISS (keep it simple).

Thank you.

 
wondwosen Getachew
Greenhorn
Posts: 7
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Ok,let me do things clear, I am working on digital audio watermarking as my final year project,and I am using java,JDK1.5,and TextPad,And while I am processing the audio data,The above run time problem is displayed,So plseas tell me where should I put Xmx256m to increase heap size, plase give me a concreat solution for this problem ok.
Thanks alot.
 
Ernest Friedman-Hill
author and iconoclast
Posts: 24204
44
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
So what you're saying is that when you run your program, it's via a TextPad command, yes? So now your question is "How do I add Java switches to the command line used by TextPad to run my Java program?"

My first recourse here would be TextPad's online help. I'm going to move this thread now to our IDEs forum. If you can't find the info you need in the online help, then perhaps someone who uses TextPad can give you some advice in that forum.
 
pie. tiny ad:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
reply
    Bookmark Topic Watch Topic
  • New Topic