LinuxQuestions.org
Visit Jeremy's Blog.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 12-06-2006, 12:43 PM   #1
elviswarhol
LQ Newbie
 
Registered: Dec 2006
Posts: 2

Rep: Reputation: 0
Setting default parameters for commands


Hi.
I'm quite new to linux and am trying to set up java (JDK) on a virtual server via SSH.
Although I've installed the JDK, I need to limit it's memory whenever it's run from the ssh terminal window AND by other applications.
To do this I need the parameters '-server -Xms16m -Xms32m' to be automatically included whenever java is run.
I've tried setting JAVA_HOME and JAVA_OPTS variables via editing ~/.profile however this has no effect.
I also tried renaming the executable and creating an alias, which worked fine for when I ran java from ssh terminal, however when apache ant tried to use java it looks directly for the java executable (alias doesn't work).
I'd really appreciate any help that can be given, as it seems like it should be a relatively easy thing to do (?)
The version of linux being run is Red Hat enterprise 3.
Thanks
josh
 
Old 12-06-2006, 12:59 PM   #2
acid_kewpie
Moderator
 
Registered: Jun 2001
Location: UK
Distribution: Gentoo, RHEL, Fedora, Centos
Posts: 43,417

Rep: Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985Reputation: 1985
if this is when the "java" command itself is run, you can always just use an alias:

alias java='java -server -Xms16m -Xms32m'

in your ~/.profile or ~/.bashrc

but there may be a more java specific way to achieve this.
 
Old 12-06-2006, 01:05 PM   #3
matthewg42
Senior Member
 
Registered: Oct 2003
Location: UK
Distribution: Kubuntu 12.10 (using awesome wm though)
Posts: 3,530

Rep: Reputation: 65
You could write a wrapper script and call that instead of java directly. It might contain something like this:
Code:
#!/bin/bash

exec java.orig -server -Xms16m -Xms32m "$@"
Rename the original java to java.orig, and put this script where the original was...
 
Old 12-06-2006, 05:18 PM   #4
elviswarhol
LQ Newbie
 
Registered: Dec 2006
Posts: 2

Original Poster
Rep: Reputation: 0
Thank you both for your suggestions.
I had tried to create an alias before - and as pointed out, it only worked from the command line.
Writing the wrapper script has enabled me to do what I was after.
Thanks again
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Editing default module parameters at boot time icpsvt Linux - General 3 02-11-2006 07:03 PM
Default Boot Parameters in GRUB? JoshArldt SUSE / openSUSE 9 01-30-2006 02:48 AM
eth0 losing link shortly after 'setting network parameters' on boot scylla Linux - Networking 1 04-13-2005 09:11 AM
Use parameters as default? krock923 Linux - General 2 09-10-2004 05:20 PM
setting default page size and default tray lived4eva Linux - General 1 11-04-2003 02:39 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 10:06 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration