File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Linux / UNIX and the fly likes Finding the right JRE in Ubuntu Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Finding the right JRE in Ubuntu" Watch "Finding the right JRE in Ubuntu" New topic

Finding the right JRE in Ubuntu

Eric Barnhill

Joined: Feb 25, 2000
Posts: 233


I am having trouble finding the JRE my Ubuntu box is actually using to add some memory to it. The instructions for how to are clear enough, but I'm lost among all the folders in my /usr/lib/jvm :

$ cd /usr/lib/jvm/
$ ls

A lot of these have JRE folders. How do I know which one to add memory to?

Many thanks, Eric
Koen Aerts
Ranch Hand

Joined: Feb 07, 2012
Posts: 344

Ubuntu itself doesn't use any JRE. So I assume you're looking at a specific Java app that uses one of the JREs installed on your system. You can use the ps command (for instance something like "ps -ef" or "ps -efo") to find which processes are running, including the entire command line used to launch the app.
Eric Barnhill

Joined: Feb 25, 2000
Posts: 233

Thanks for the reply -- this worked.

I didn't mean to imply Ubuntu was running off a JVM. It is the program ImageJ that is running out of memory and the instructions are to allocate more memory to the JRE.

I entered ps -ef | grep ericbarnhill and this line came up:

1000 2725 2683 1 17:49 pts/1 00:00:00 /usr/lib/jvm/java-1.6.0-openjdk-amd64/bin/java -mx500m -cp /usr/share/java/ij.jar ij.ImageJ -ijpath /home/ericbarnhill/.imagej -port6

So I changed the -mx argument and entered

/usr/lib/jvm/java-1.6.0-openjdk-amd64/bin/java -mx1024m -cp /usr/share/java/ij.jar ij.ImageJ -ijpath /home/ericbarnhill/.imagej -port6

Success. Is that what you're suggesting I do as I rule to extend the memory? Is there a way to get a config file to do this for me?

Thanks, Eric

Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 17255

I don't think that you'll find a global default memory config for Java. It would infringe on the "write once, run anywhere" paradigm by making it uncertain whether a given system could properly run random apps without overrides of their own. And, truthfully, overriding the global memory defaults on account of a single application's needs is a little rude to all the other apps, anyway.

It would make more sense to run the affected command in a shell script with appropriate options set in the java command in the script, especially since the non-memory parts of that particular command line aren't exactly easy either.

An IDE is no substitute for an Intelligent Developer.
I agree. Here's the link:
subject: Finding the right JRE in Ubuntu
It's not a secret anymore!