File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Finding the right JRE in Ubuntu

 
Eric Barnhill
Rancher
Posts: 233
Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 344
Java Linux Oracle
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 233
Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 17616
39
Android Eclipse IDE Linux
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic