<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>http://wsn.cse.wustl.edu/index.php?action=history&amp;feed=atom&amp;title=Locate-jre</id>
	<title>Locate-jre - Revision history</title>
	<link rel="self" type="application/atom+xml" href="http://wsn.cse.wustl.edu/index.php?action=history&amp;feed=atom&amp;title=Locate-jre"/>
	<link rel="alternate" type="text/html" href="http://wsn.cse.wustl.edu/index.php?title=Locate-jre&amp;action=history"/>
	<updated>2026-11-18T16:51:55Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.34.4</generator>
	<entry>
		<id>http://wsn.cse.wustl.edu/index.php?title=Locate-jre&amp;diff=702&amp;oldid=prev</id>
		<title>Liangfok: New page: &lt;pre&gt; #!/bin/sh # This script attempts to locate the jre directory of the current # Java installation, even when java is not in the path  # We only support it for Sun's Java on Windows and...</title>
		<link rel="alternate" type="text/html" href="http://wsn.cse.wustl.edu/index.php?title=Locate-jre&amp;diff=702&amp;oldid=prev"/>
		<updated>2008-04-07T16:25:36Z</updated>

		<summary type="html">&lt;p&gt;New page: &amp;lt;pre&amp;gt; #!/bin/sh # This script attempts to locate the jre directory of the current # Java installation, even when java is not in the path  # We only support it for Sun&amp;#039;s Java on Windows and...&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;pre&amp;gt;&lt;br /&gt;
#!/bin/sh&lt;br /&gt;
# This script attempts to locate the jre directory of the current&lt;br /&gt;
# Java installation, even when java is not in the path&lt;br /&gt;
&lt;br /&gt;
# We only support it for Sun's Java on Windows and IBM's Java on Linux&lt;br /&gt;
&lt;br /&gt;
# We require an option to specify which directory is desired:&lt;br /&gt;
# --java: directory with java executable&lt;br /&gt;
# --javac: directory with javac executable&lt;br /&gt;
# --jni: directory where JNI code is placed&lt;br /&gt;
&lt;br /&gt;
if [ &amp;quot;$1&amp;quot; = &amp;quot;--jni&amp;quot; ]; then&lt;br /&gt;
  jni=yes&lt;br /&gt;
elif [ &amp;quot;$1&amp;quot; = &amp;quot;--java&amp;quot; ]; then&lt;br /&gt;
  java=yes&lt;br /&gt;
elif [ &amp;quot;$1&amp;quot; = &amp;quot;--javac&amp;quot; ]; then&lt;br /&gt;
  javac=yes&lt;br /&gt;
else&lt;br /&gt;
  echo &amp;quot;Usage: locate-jre --java|--javac|--jni&amp;quot; &amp;gt;&amp;amp;2&lt;br /&gt;
  exit 2&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
if [ -f /usr/bin/regtool ]; then&lt;br /&gt;
  # Hopefully this will always work on cygwin with Sun's Java&lt;br /&gt;
  jversion=`regtool -q get '\HKLM\SOFTWARE\JavaSoft\Java Development Kit\CurrentVersion'`&lt;br /&gt;
  if [ $? != 0 ]; then&lt;br /&gt;
    exit 1&lt;br /&gt;
  fi&lt;br /&gt;
  jhome=`regtool -q get '\HKLM\SOFTWARE\JavaSoft\Java Development Kit\'$jversion'\JavaHome'`&lt;br /&gt;
  if [ $? != 0 ]; then&lt;br /&gt;
    exit 1&lt;br /&gt;
  fi&lt;br /&gt;
  jhome=`cygpath -u &amp;quot;$jhome&amp;quot;`&lt;br /&gt;
else&lt;br /&gt;
  # On Linux, we first try to find it from the rpm&lt;br /&gt;
  j=`rpm -ql IBMJava2-SDK | grep -m 1 'bin/javac$'`&lt;br /&gt;
  if [ $? != 0 ]; then&lt;br /&gt;
    # Next we try the path. But a nasty rpm may have removed them, so we&lt;br /&gt;
    # recreate our default path...&lt;br /&gt;
    PATH=`bash --login -c 'echo $PATH'`&lt;br /&gt;
    j=`which javac 2&amp;gt;/dev/null`&lt;br /&gt;
    if [ $? != 0 ]; then&lt;br /&gt;
      exit 1&lt;br /&gt;
    fi&lt;br /&gt;
  fi&lt;br /&gt;
  jbin=`dirname &amp;quot;$j&amp;quot;`&lt;br /&gt;
  jhome=`dirname &amp;quot;$jbin&amp;quot;`&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# These are correct for Sun's Window java and IBM's Linux java&lt;br /&gt;
if [ &amp;quot;$jni&amp;quot; = &amp;quot;yes&amp;quot; ]; then&lt;br /&gt;
  dir=&amp;quot;$jhome/jre/bin&amp;quot;&lt;br /&gt;
elif [ &amp;quot;$javac&amp;quot; = &amp;quot;yes&amp;quot; ]; then&lt;br /&gt;
  dir=&amp;quot;$jhome/bin&amp;quot;&lt;br /&gt;
elif [ &amp;quot;$java&amp;quot; = &amp;quot;yes&amp;quot; ]; then&lt;br /&gt;
  dir=&amp;quot;$jhome/jre/bin&amp;quot;&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
# Check that what we found actually exists&lt;br /&gt;
if [ -d &amp;quot;$dir&amp;quot; ]; then&lt;br /&gt;
  echo $dir&lt;br /&gt;
else&lt;br /&gt;
  exit 1&lt;br /&gt;
fi&lt;br /&gt;
&lt;br /&gt;
&amp;lt;/pre&amp;gt;&lt;/div&gt;</summary>
		<author><name>Liangfok</name></author>
		
	</entry>
</feed>