Search code examples
javaanacondapicard

How does one set the RAM and CPU parameters for java programs running in an anaconda environment?


In a standard Linux environment with java installed, I can run the any java program using the command:

java -jar path/to/picard.jar

Where picard is an example of a java program. I can also specify how many CPU threads or RAM the JVM should use using this way:

java -XX:ParallelGCThreads=5 -Xms900m -jar path/to/program.jar

That JVM will get 5 threads and and 900 MB of RAM. All quite straight forward.

However, when I run java programs in an anaconda (conda) environment, which has it's own installation of java, I can run the software simply by typing it:

picard

How do I pass the resource parameters to anaconda? What are the default parameters?


Solution

  • My solution is to first, find where Conda installed Picard within your environment and then give a full path to picard.jar while passing memory arguments to java:

    java -Xms4G -jar path_to/picard.jar [your_picard_command]