-1

I have code of a research project managed by datalad (which is a frontend for git and git-annex). It contains my code together with a Singularity container for reproducibility.

I installed java manually into this directory. I could run java -version initially but once I have committed my changes using git annex add <java_dir>, git add . and git commit, I cannot start java anymore. I get the following error message:

Error: could not find libjava.so
Error: Could not find Java SE Runtime Environment.

How can I avoid this incompatibility between java and git-annex?

(Annex: how I installed java)

mkdir lib
cd lib
wget https://javadl.oracle.com/webapps/download/AutoDL?BundleId=246799_424b9da4b48848379167015dcc250d8d -O jre_8_341.tgz
tar -xf ./jre_8_341.tgz # creates jre1.8.0_341/
rm jre_8_341.tgz
cd jre1.8.0_341/bin
akraf
  • 2,965
  • 20
  • 44

1 Answers1

0

Turns out that the java binary tries to find its own path, as can be seen by calling strace java -version:

< ... lots of strace output... >
readlink("/proc/self/exe", "/proj/.git/annex/objects/X5/f3/M"..., 4096) = 120
< ... more strace output ...>

The readlink syscall leads into the .git/annex/objects directory where git-annex saves big files. Thus, java gets the wrong answer what is its installation directory and thus fails.

The solution is to git annex unlock $JAVA_HOME/bin/java (where $JAVA_HOME is the folder you extracted java to). The same must be done with $JAVA_HOME/lib/amd64/server/libjvm.so which tries the same manoever.

Finally, the files must be committed in unlocked state. In effect, the files must not be symlinks into the git-annex object storage but regular files.

akraf
  • 2,965
  • 20
  • 44