Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

javac set default heap size for java permanently

Tags:

java

javac

I'm trying to set the javac heap size for it's java vm permanently. I have set my JAVA_OPTS to -Xmx64m which works great when I call java but not javac. I still get heap size issues. Is there a different variable I can set in my .bashrc to change is permanently?

When I run javac -J-Xmx64m it works great. So I just need a way to make that -J-Xmx64m option permanent.

FYI - I'm running Ubuntu 11.10 with OpenJDK 1.7

like image 878
Chris Kdon Avatar asked Jul 29 '13 13:07

Chris Kdon


1 Answers

Very pragmatic solution (assuming you use bash):

# find out where javac lives, and note the path
$ which javac
/path/to/javac
$ vi ~/.bash_aliases
alias javac='/path/to/javac -J-Xmx64m'
like image 83
Ingo Avatar answered Sep 25 '22 10:09

Ingo