[opensuse] JAVA_HOME and cron scripts
I'm trying to run a Java program from a cron job and have discovered that JAVA_HOME and friends aren't set. What's the best way to set them for cron jobs? I'm presently on 9.3 but will be moving to 10.2 shortly. Cheers, Dave -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On 6/4/07, Dave Howorth
I'm trying to run a Java program from a cron job and have discovered that JAVA_HOME and friends aren't set. What's the best way to set them for cron jobs?
I'm presently on 9.3 but will be moving to 10.2 shortly.
Cheers, Dave --
Once you update to 10.2 and install Java 1.5 then your JAVA_HOME and friends will be set. For 9.2 you have to set the environment variables in your .bashrc or your .profile. -H -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Monday 04 June 2007 12:43:09 Dave Howorth wrote:
I'm trying to run a Java program from a cron job and have discovered that JAVA_HOME and friends aren't set. What's the best way to set them for cron jobs?
I'm presently on 9.3 but will be moving to 10.2 shortly.
Cheers, Dave
On >= 9.3, execute source /usr/share/java-utils/java-functions to set $JAVA_HOME prior versions had a script called setJava <options> to set this variable. Regards, Daniel -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Hugo Garcia wrote:
On 6/4/07, Dave Howorth
wrote: I'm trying to run a Java program from a cron job and have discovered that JAVA_HOME and friends aren't set. What's the best way to set them for cron jobs?
I'm presently on 9.3 but will be moving to 10.2 shortly.
Once you update to 10.2 and install Java 1.5 then your JAVA_HOME and friends will be set. For 9.2 you have to set the environment variables in your .bashrc or your .profile.
Thanks for the reply but I don't think it answers my question. On 9.3 (and also on 9.2 since you mention it) the Java environment variables are set automatically by /etc/profile.d/alljava.sh. There's no need to set them manually in individual profiles. But that's not what I'm asking. I'm asking specifically about the environment used by cron jobs. The JAVA_* variables are not set in the environment cron uses and neither does it read .bashrc or .profile Obviously, I could source one or other of these scripts in my cron job, but I'm wondering what the best/accepted method of doing this is? Cheers, Dave -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Daniel Bornkessel wrote:
On Monday 04 June 2007 12:43:09 Dave Howorth wrote:
I'm trying to run a Java program from a cron job and have discovered that JAVA_HOME and friends aren't set. What's the best way to set them for cron jobs?
I'm presently on 9.3 but will be moving to 10.2 shortly.
On >= 9.3, execute source /usr/share/java-utils/java-functions to set $JAVA_HOME
Thanks, I'll try that. Of course you can't source it in the crontab and adding it to every cron job is a royal pain :( I was hoping there was a nicer idiom.
prior versions had a script called setJava <options> to set this variable.
On my 9.2 systems setJava just prints a message saying that it's been replaced. The systems have /usr/share/java-utils/java-functions. Cheers, Dave -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
* Dave Howorth
I'm trying to run a Java program from a cron job and have discovered that JAVA_HOME and friends aren't set. What's the best way to set them for cron jobs?
I'm presently on 9.3 but will be moving to 10.2 shortly.
see: http://www.unixgeeks.org/security/newbie/unix/cron-1.html
crontab -e
at the top you will probably see: MAILTO=root or MAILTO=<username>
add: JAVA_HOME=
Patrick Shanahan wrote:
* Dave Howorth
[06-04-07 06:46]: I'm trying to run a Java program from a cron job and have discovered that JAVA_HOME and friends aren't set. What's the best way to set them for cron jobs?
I'm presently on 9.3 but will be moving to 10.2 shortly.
add: JAVA_HOME=
Thanks. I was trying to avoid hardwiring and instead would like to make
use of the Suse-defined Java configuration mechanisms if I can.
i.e.
On Monday 04 June 2007 15:52:59 Dave Howorth wrote:
Patrick Shanahan wrote:
* Dave Howorth
[06-04-07 06:46]: I'm trying to run a Java program from a cron job and have discovered that JAVA_HOME and friends aren't set. What's the best way to set them for cron jobs?
I'm presently on 9.3 but will be moving to 10.2 shortly.
add: JAVA_HOME=
Thanks. I was trying to avoid hardwiring and instead would like to make use of the Suse-defined Java configuration mechanisms if I can.
i.e.
is not something I invent, it's something the system invents, but it fails to let cron know. Cheers, Dave
Since we switched to jpackage-style packaging, the currently used JRE is always located at: /usr/lib/jre (/usr/lib64/jre on x86_64 and ppc64) and the JDK at: /usr/lib/jvm/java (/usr/lib64/jvm/java on x86_64 and ppc64) those are symbolic links to the chosen JRE/JDK and changed by calling: update-alternatives --config java and update-alternatives --config javac ... so setting them is not a big problem, since they should always work. Best, Daniel -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
Daniel Bornkessel wrote:
On Monday 04 June 2007 15:52:59 Dave Howorth wrote:
Patrick Shanahan wrote:
* Dave Howorth
[06-04-07 06:46]: I'm trying to run a Java program from a cron job and have discovered that JAVA_HOME and friends aren't set. What's the best way to set them for cron jobs?
I'm presently on 9.3 but will be moving to 10.2 shortly. add: JAVA_HOME=
Thanks. I was trying to avoid hardwiring and instead would like to make use of the Suse-defined Java configuration mechanisms if I can. i.e.
is not something I invent, it's something the system invents, but it fails to let cron know. Cheers, Dave
Since we switched to jpackage-style packaging, the currently used JRE is always located at: /usr/lib/jre (/usr/lib64/jre on x86_64 and ppc64) and the JDK at: /usr/lib/jvm/java (/usr/lib64/jvm/java on x86_64 and ppc64)
Ahh, that's good to know :) I've got some 64-bit and some 32-bit boxes, so it's also one more thing to have to remember :( Thanks, Dave -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Monday 04 June 2007 16:57:39 Dave Howorth wrote:
Daniel Bornkessel wrote:
On Monday 04 June 2007 15:52:59 Dave Howorth wrote:
Patrick Shanahan wrote:
* Dave Howorth
[06-04-07 06:46]: I'm trying to run a Java program from a cron job and have discovered that JAVA_HOME and friends aren't set. What's the best way to set them for cron jobs?
I'm presently on 9.3 but will be moving to 10.2 shortly.
add: JAVA_HOME=
Thanks. I was trying to avoid hardwiring and instead would like to make use of the Suse-defined Java configuration mechanisms if I can.
i.e.
is not something I invent, it's something the system invents, but it fails to let cron know. Cheers, Dave
Since we switched to jpackage-style packaging, the currently used JRE is always located at: /usr/lib/jre (/usr/lib64/jre on x86_64 and ppc64) and the JDK at: /usr/lib/jvm/java (/usr/lib64/jvm/java on x86_64 and ppc64)
Ahh, that's good to know :) I've got some 64-bit and some 32-bit boxes, so it's also one more thing to have to remember :(
Take /etc/alternatives/jre and /etc/alternatives/java_sdk ... those point to the right directories and don't differ depending on the architecture :)
Thanks, Dave
-- ------------------------------------- SUSE LINUX Products GmbH - Nürnberg - AG Nürnberg - HRB 16746 - GF: Markus Rex ------------------------------------- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Dave Howorth wrote:
Daniel Bornkessel wrote:
On Monday 04 June 2007 15:52:59 Dave Howorth wrote:
Patrick Shanahan wrote:
* Dave Howorth
[06-04-07 06:46]: I'm trying to run a Java program from a cron job and have discovered that JAVA_HOME and friends aren't set. What's the best way to set them for cron jobs?
<snip>
Cheers, Dave Since we switched to jpackage-style packaging, the currently used JRE is always located at: /usr/lib/jre (/usr/lib64/jre on x86_64 and ppc64) and the JDK at: /usr/lib/jvm/java (/usr/lib64/jvm/java on x86_64 and ppc64)
Ahh, that's good to know :) I've got some 64-bit and some 32-bit boxes, so it's also one more thing to have to remember :(
Thanks, Dave
Something to watch out for is the java 1.4.x version from 9.3 seems to have been 32 bit (I do not work with code on that machine so the Java aetup was a little basic), and the update installation from 9.3 retained the 32 bit stuff, I recently upgraded to 1.5.x on 10.2 which is 64 bit java and result was a little messy, not everything adjusted to the change in setup. With odd and sods linking into the 32bit library structure. I think I have fixed it, but I did not take notes on what ended up being not quite right.... -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.5 (GNU/Linux) Comment: Using GnuPG with SUSE - http://enigmail.mozdev.org iD8DBQFGZE4KasN0sSnLmgIRAnDvAKC1vhWQkSU/maPvlxetxhXLXxmt9wCfW/3i 143giANGaiEC8wa4HIZEF4c= =Rv9S -----END PGP SIGNATURE----- -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
On Mon, 2007-06-04 at 18:38 +0100, G T Smith wrote:
Something to watch out for is the java 1.4.x version from 9.3 seems to have been 32 bit (I do not work with code on that machine so the Java aetup was a little basic), and the update installation from 9.3 retained the 32 bit stuff,
Yes, I have both 1.4.2 and 1.5 on the 9.3 - packman IIRC. Amazingly, it all seems to work in normal use. And yes, I think it is 32-bit.
I recently upgraded to 1.5.x on 10.2 which is 64 bit java and result was a little messy, not everything adjusted to the change in setup. With odd and sods linking into the 32bit library structure. I think I have fixed it, but I did not take notes on what ended up being not quite right....
I belong to the "don't upgrade a Suse system, do a clean install" school of thought, so hopefully that's one problem I won't hit. It's one thing I miss from using Debian, where I did trust the upgrade process, but there were so many other things I didn't like :( OTOH, I did select the "install the 32 bit stuff as well" option when I installed 10.2 on my test system, so I'll have to see what Java packages that has translated into. Cheers, Dave -- To unsubscribe, e-mail: opensuse+unsubscribe@opensuse.org For additional commands, e-mail: opensuse+help@opensuse.org
participants (6)
-
Daniel Bornkessel
-
Dave Howorth
-
Dave Howorth
-
G T Smith
-
Hugo Garcia
-
Patrick Shanahan