Jump to content


This topic is now archived and is closed to further replies.


Configure: error: Unable to locate /usr/local/java/bin

Recommended Posts

I am trying to upgrade php and have two questioins.

1) Do I need  to uninstall my current installation of php before upgrading, or can I just overwrite the current installation?

2) I have so far managed to download and unzip the source for php4.4.4.  However, when I try to configure my installation using the command line

'./configure' '--with-apxs=/usr/sbin/apxs' '--enable-safe-mode' '--with-zlib-dir=/usr/local/phplibs' '--with-curl=/usr/local/phplibs' '--with-dom' '--enable-ftp' '--with-gd=/usr/local/phplibs' '--with-jpeg-dir=/usr/local/phplibs' '--with-png-dir=/usr/local/phplibs' '--with-ttf=/usr/local/phplibs' '--with-freetype-dir=/usr/local/phplibs' '--with-t1lib=/usr/local/phplibs' '--with-iconv=/usr/local/phplibs' '--with-kerberos' '--with-ldap' '--enable-mbstring' '--with-mcrypt=/usr/local/phplibs' '--with-mysql=/usr/local/mysql' '--with-pgsql=/usr/local/phplibs' '--with-regex=system' '--with-pear' '--enable-memory-limit' '--enable-bcmath' '--enable-calendar' '--enable-dbase' '--enable-exif' '--with-zlib-dir=/usr/local/phplibs' '--with-gmp=/usr/local/phplibs' '--with-mhash=/usr/local/phplibs' '--with-gettext' '--enable-mbregex' '--disable-mbstr-enc-trans' '--enable-track-vars' '--enable-xml' '--with-xmlrpc' '--enable-xslt' '--with-xslt-sablot=/usr/local/phplibs' '--with-iconv-dir=/usr/local/phplibs' '--with-expat-dir=/usr/local/phplibs' '--enable-zend-multibyte' '--enable-dba' '--with-db4=/usr/local/phplibs' '--with-bz2' '--enable-dbx' '--with-mcal=/usr/local/phplibs' '--with-java=/usr/local/java' '--with-imap=/usr/local/phplibs/imap-2004f' '--with-openssl' '--with-magickwand=/usr/local/phplibs' '--with-imap-ssl'

(I obtained this from phpinfo()), it fails with the error messages

checking for Java support... yes
checking Java Jar location... configure: error: Unable to locate /usr/local/java/bin

The 'directory' /usr/local/java is a sym link to /usr/local/jre1.5.0_01/ which in turn has a subdirectory bin

How do I fix this problem?


Share this post

Link to post
Share on other sites
As far as question 1 is concerned. I don't know. I don't like compiling and installing anything from source to the standard locations. That includes "/usr/local". I usually use another prefix, for example "/opt/php-version".

I'm not usually comfortable telling anyone where to install anything from source because installing in non default/standard locations has its own disadvantages if you don't know certain things (not that I'm an expert) and installing in the default locations, also has disadvantages/problems IMO.

I assume from your post that your original installation is from a binary package. I'd recommend that you try to find an update from your distro.

You might want to try a linux forum for general opinions on installing from source. Especially over binary packages.

question 2) I don't have experience compiling PHP with JAVA support but a look in the configure script shows the following.
if test -x $PHP_JAVA/bin/jar; then
    JAVA_JAR="$PHP_JAVA/bin/jar cf"
    { echo "configure: error: Unable to locate $PHP_JAVA/bin" 1>&2; exit 1; }

Another section below that looks for "javac". You need to find out where the JDK base installation directory is.
[quote=./configure --help]
--with-java[=DIR]      Include Java support. DIR is the JDK base install directory.
The symlink points to the /usr/local/jre1.5.0_01/ which seems to only be the JRE.

Do a
locate -r '/javac$'
Use the directory you find it in as the argument to configure "./configure --with-java=/dir/path/".

If you see "javac" and "jar" in "/usr/local/jre1.5.0_01/bin/" then try using "--with-java=/usr/local/jre1.5.0_01" to avoid the symlink all together.

Share this post

Link to post
Share on other sites
Would have been useful if the error message was "Unable to locate /usr/local/java/bin/jar" instead ;-)

For some reason the java installation on my host does not include javac or jar, so I'll have to investigate that.


Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.