How to setup java on freebsd?
I have both Java JRE and Java JDK on a FreeBSD 7.2 box (running PFSense) from http://www.freebsdfoundation.org/downloads/java.shtml
find / -name gives 开发者_StackOverflowme output like:
/usr/local/diablo-jre1.6.0/bin/java
/usr/local/diablo-jdk1.6.0/bin/java
/usr/local/diablo-jdk1.6.0/jre/bin/java
so I make a link to /usr/local/bin like so:
ln /usr/local/diablo-jre1.6.0/bin/java /usr/local/bin/java
and now I get
# rehash
# java
Error: could not find libjava.so
Error: could not find Java 2 Runtime Environment.
SOOOOOO, I'm wondering if there is some tool I can use to turn on a particular java vm similar to Ubuntus' /etc/jvm?
The /usr/local/diablo-jre1.6.0/bin/java
application probably locates libjava.so
relative to the location of the java
application itself. By creating a hard link to java
and executing it via that hard link, you've probably broken that mechanism.
Suggestions:
- Put
/usr/local/diablo-jre1.6.0/bin
on your search path. - Create an alias for
java
instead of a link. - Replace the hard link with a symbolic link; i.e. use
ln -s
to create it.
The FreeBSD packages should have installed a wrapper-script in /usr/local/bin/java that knows about the different installed JVMs, and their JAVA_HOMEs etc. Did you by chance accidentally download the tarball instead of the package?
What does pkg_info | grep jdk
yield?
If this is in a jail, you may need to move /proc temporarily so it doesn't try to use it to find out where the Java libraries are. Got bitten by this one!
精彩评论