File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Engineering » Linux / UNIX
Bookmark "Finding the right JRE in Ubuntu" Watch "Finding the right JRE in Ubuntu" New topic
Author

Finding the right JRE in Ubuntu

Eric Barnhill
Rancher

Joined: Feb 25, 2000
Posts: 233

Hi,

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
default-java
java-1.6.0-openjdk-amd64
java-7-openjdk-amd64
java-1.5.0-gcj
java-6-openjdk
java-gcj
java-1.5.0-gcj-4.6
java-6-openjdk-amd64
java-gcj-4.6
java-1.6.0-openjdk
java-6-openjdk-common
$

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
Rancher

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: 16303
    
  21

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.


Customer surveys are for companies who didn't pay proper attention to begin with.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Finding the right JRE in Ubuntu