0

I must be overlooking something, but I've tried several ways to get this to work.

I'm working on a super computer without admin rights. I need to use a specific java version for a particular program, but I don't want to make this the default java for everything.

Steps taken: I downloaded the appropriate jre and added the following lines at the beginning of my script:

export PATH="/path/to/jre/bin/:$PATH"
export JAVA_HOME="/path/to/jre"
echo $PATH
echo ""
echo $JAVA_HOME

I get the appropriate paths when I echo during the script and, as expected, $PATH and $JAVA_HOME return to original values after the script finishes. The problem is that the programs called during the script aren't using the java I need them to (and thus fail for incorrect java version). If I run the same export commands in the shell before running the script, the programs run as expected.

I also don't have control over how java is called because I'm using a program (PBcR) that calls a series of other programs. Here's the only call in my script:

/path/to/bin/PBcR \
-length 500 \
-partitions 200 \
-l lambda \
-s pacbio.spec \
-fastq pacbio.filtered_subreads.fastq \
genomeSize=50000

Questions:

  1. Why don't all programs running during the script use the $PATH and $JAVA_HOME I export during the script?
  2. How can I get all programs called during the script to use the correct environment variables?

I've also tried putting the export commands in a separate file and calling source on that file, but that doesn't appear to change anything.

I really appreciate your help.

Running on CentOS 6.6; bash shell;

2
  • How do you call the programms in that script?
    – chaos
    Commented Dec 18, 2015 at 8:12
  • Thanks for your response. I added the call in my script. I don't have control over how java is called. Commented Dec 18, 2015 at 15:44

2 Answers 2

0

I'm not sure why those aren't working but this is how a jar file is scheduled on one of my servers:

/path/to/jre/bin/java -jar yourjavaprogram.jar
1
  • Thank you for the response. Unfortunately, I'm making a single call to a program that calls all other programs, so how it calls java is beyond my control. I'll add this information to my question. Commented Dec 18, 2015 at 15:40
0

Turned out to be a silly mistake. I was setting my $PATH and $JAVA_HOME using ~ rather than a full path (e.g., ~/path/to/java instead of /path/to/java like I put in my original question). I obviously overlooked that "minor" detail when posting my original question.

While trying to debug this, I learned that the "program" calling java was actually a perl script, and perl doesn't resolve ~ like bash would.

I appreciate your help.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .