I have Apache Solr Server installed and the apachesolr module enabled. I downloaded Tika 0.4 source and built it. I moved the tika-core-0.4.jar into sites/all/modules/apachesolr_attachments/tika. In the admin/settings/apachesolr/attachments I really wasn't sure the path I was supposed to put so I tried it a couple of different ways.
- C:\wamp\www\repo\sites\all\modules\apachesolr_attachments\tika
- sites/all/modules/apachesolr_attachments/tika
When Look at Status Report, I have a Red section that reads the following:
Java executable not found
Could not execute a java command. You may need to set the path of the correct java executable as the variable 'apachesolr_attachments_java' in settings.php.
So I placed the apachesolr_attachments_java' in settings.php two different ways:
$apachesolr_attachments_java = 'C:\wamp\www\repo\sites\all\modules\apachesolr_attachments\tika\tika-core-0.4.jar';$apachesolr_attachments_java = 'sites/all/modules/apachesolr_attachments/tika/tika-core-0.4.jar';
Just so there isn't a question about it, I did run Tika after I built it to make sure it works and it did exactly what it was supposed to do so I know it isn't Tika (at least nothing obvious anyway).
Also, on line 36 in the apachesolr_attachments.install file:
$java = variable_get('apachesolr_attachments_java', 'java');
When I look at the $java variable, it contains the default, not the variable from the settings.php file.
Nothing I have done so far has worked and I continue to get the "Java executable not found" error on the Status Report page. The instructions for putting this together are very limited and I can't seem to find anything very complete on how to make this work. Can anyone help with this? I figure it is just the way I am referencing the jar file or something really easy that I am just missing but can't seem to figure it out.
Thanks in advance for the help :)
Comments
Comment #1
pobster commentedThe answer is in your settings.php file;
So to set a variable you simply need to use;
Pobster
Comment #2
pobster commentedComment #3
pwolanin commentedthis variable should hold the path to java itself - NOT to tika. not sure why the above is working for you, but that is the general method of overriding a variable.
Comment #4
pobster commentedApologies, my answer was simply to specify the correct way to override a variable. Afraid I don't even use this module and like the original poster, I hadn't read the status message clearly enough - I just noted what the poster was trying to do unsuccessfully and thought to give them a little direction. I just stumbled here by accident and saw a old(-ish) unanswered query I could answer easily enough.
Thanks,
Pobster
Comment #5
grÖs commentedHello,
I actually get the same issue, but this error message stay in the report status :/
I got tika 0.7 and compile it with maven succesfully. I tested with command lines and it works well.
I put tika files in "./sites/all/modules/apachesolr_attachments/tika/" as you did (the four .jar files).
I set the variable :
$conf = array(
'apachesolr_attachments_java' => './sites/all/modules/apachesolr_attachments/tika/tika-core-0.7.jar'
in the settings.php file.
);
It don't work yet ... always the same issue. I verify that the variable is read without problems.
I see you fixed this issue, can you help me please ?
Comment #6
pobster commentedAs per the comment above which you obviously didn't read; http://drupal.org/node/784612#comment-2974762
Use the path to your own java executable.
Pobster
Comment #7
grÖs commentedhello,
Thanks for answering so quickly.
I just find why it didn't work : my Wamp Server was installed at "C:/Program Files/wamp".
I think that the white space " " was not interpreted.
I re-installed it at "C:/Wamp" and it works well.
Bye
Comment #9
jsmoorejr commentedHoping this is the correct thing to do here by re-opening this thread...if not I apologize.
So here is my issue. I have followed post #6 and it still shows that the Java executable not found problem in the status report.
I am using Windows (please no comments about switching to Linux, lol) and the code I placed in the settings.php file are as follows:
I have restarted my web server and cleared the cache, but still nothing has changed. Apache Solr is running on my server and I have no issues with it at all, just the Apache Solr Attachments.
The status report shows my site has contacted the Apache Solr server with the following settings:
Apache Solr - Your site has contacted the Apache Solr server.
Host: localhost
Port: 8080
Path: /apache-solr-1.4.0
Has anyone had the same troubles and been able to fix it?
Comment #10
pobster commentedI would assume it's necessary to add the executable to the path, i.e.
...C:\Java\jre6\bin\java.exePobster
Comment #11
jsmoorejr commentedHAHA, yep that was it. I wasn't thinking about it that way. I was thinking about it similar to creating an environment variable; giving it a path to the executable.
Thanks much, that really helped. I tried everything but that. It didn't even occur to me to try that, lol.
Comment #12
pwolanin commentedComment #14
m2011 commentedMy path in settings.php is:
How do I verify that the path is correct? I am using the path that displays when I enter "/usr/sbin/alternatives --java config" but am still receiving the following error:
Are there any other files I should check?
Comment #15
pobster commentedMy advice is to go to the top of this thread and start reading... If you really can't work out how to find out where your java executable is then use;
# which javaPobster
Comment #16
rbryer commentedThis thread is a little misleading in places. If you get this error it can be caused but several things.
1. It can't find the java executable
2. It can't run the java executable
By default it will just run the command 'java' - try on the command line? Does it work? If not you can force Drupal to the correct path as stated in #9.
However, you may find that even when you specify the path you still get the same error in Drupal. Again try it on the command line, run {path}/java and see what happens. On any sort of memory constraint hardware you may we get the following error.
This is caused by java being memory hungry by default. This is also easy to fix in the same location. You can add the memory switches to the command line you enter in settings.php. The example below set the initial heap to 20Mb and a max of 64Mb. You can tweak these to fit you environment, you can start with 256K if necessary.
Again, test it out on the command line and add the -version tag e.g. java -version ...you should get a response like
The key here is that it must include the phase "Runtime Environment" as this is what the code is actually looking for .. see line 43 here
Hope that help someone.
Comment #17
pwolanin commentedThanks - a good explanation of the possible problem - can I add that to the README?
Comment #18
jpmckinney commentedComment #19
ericmulder1980 commentedIf adding the following code to your settings.php doesn't help perhaps you are using MAMP. This is because of a bug in the PHP stack MAMP.
more info : http://stackoverflow.com/questions/278868/calling-java-from-php-exec
Go to your apachesolr_attachments module en locate thee apachesolor_attachments.install file. In this file locate the hook_requirements function.
Replace the following line:
with this line:
This solved the problem for me and a lot of other colleagues working on Mac.
Comment #20
jh81 commentedTried all the steps above but still would not work. I have Drupal running in Windows 2003 Server under IIIS. I was also getting a warning on the status report page as follows.
Warning: exec() [function.exec]: Unable to fork [C:\Progra~1\Java\jre6\bin\java.exe -version > H:\Inetpub\wwwroot\drupal\temp\apa123.tmp 2>&1] in apachesolr_attachments_requirements() (line 50 of H:\Inetpub\wwwroot\drupal\modules\apachesolr_attachments\apachesolr_attachments.install).
Searched on unable to fork and found out you need to give the ISUR account read rights to cmd.exe. See http://www.somacon.com/p255.php for details. Once I did that the warning went away.
Comment #21
nick_vhComment #22
deanflory commentedInstructions that worked as of 2012-10-06 after receiving the "Java executable not found" error, which are FAR less complex and non-omission laiden like pretty much all others on the Web that I could easily find. Please note I have no idea if this set of instructions has any drawbacks, but it worked for me to remove that error but I have yet to test if the installed Java actually functions correctly yet other than using "java" and "java -version" ssh commands to verify it was installed.
In order to perform the following, you'll need root access to your server through SSH, using a built-in SSH app in your server software's GUI, or a separate applicatin/program like I use on Mac OS X called "Terminal" (Terminal.app). If you don't understand, ask your hosting provider about root access via a SSH terminal and see what they say. Shared hosting likely won't allow that level of access.
Instructions for Installing Java on CentOS 5
Instructions Dean followed and modified to get this customized set of steps below, THANKS CHRIS CHULD!:
http://chrisschuld.com/2008/10/installing-sun-java-on-centos-5-2/
Download the NON-RPM, non-64bit, Linux x86, Java SE 7u7 JDK (Java Development Kit which includes the JRE) file and upload it to another server since Sun's/Oracle's server would NOT allow a direct wget (only downloaded a fail.html file due to having to check a damn license agreement radio button I'm guessing, argh, time-waster for nothing):
http://www.oracle.com/technetwork/java/javase/downloads/index.html
http://www.oracle.com/technetwork/java/javase/downloads/jdk7u7-downloads-1836413.html
Now we'll upload it to the server in the /opt folder:
Now even though the other instructions try to uncompress a binary, the only packages available on Sun's/Oractle's site were either .rpm's (not using) or tar.gz (yes using), which need to be untarred and ungzipped:
tar zxvf jdk-7u7-linux-i586.tar.gzLet's see what files are in that folder with a directory listing ("LS" lowercase):
lsA resulting folder "jdk1.7.0_07" was created.
Now we'll remove the tar.gz downloaded/uploaded file since we don't need it anymore:
rm -rf jdk-7u7-linux-i586.tar.gzWe now need to install it and setup the alternatives correctly (these steps make it easier and faster than other sets of instructions that require changing symbolic links all over the place):
This pulls up an option menu choice between installed java packages and in my case there wasn't another (this is the time-saver from using "alternatives --"):
Hit enter or follow the instructions to choose by number if you have more than one java package installed.
Now we must check to make sure the install was a success:
java -versionWhich displays:
Now let's see that location where it was installed:
"java" is now in the list and I'm guessing from other instructions across the Web, it's only a symbolic link to the /opt... location where we uncompressed it. Others said this was a problem for developers but it seems that the "alternatives --" method allowed us to choose and thus bypass various additional install steps to set that correctly, which may be the better path and a workaround to problems others had when developing on a server with multiple version of java installed in various locations.
Now we can look into what our new Java install has to offer, type:
javaWhich shows:
Far more simple, and far faster than others right? And it works to remove the "Java executable not found" without any modifications to any Drupal-related or site-related file.
Some keywords and phrases to help others find this:
Install Java for Drupal 7.15
Install Java for CentOS 5
Java executable error
Status Report error Java
install java 2012
install java drupal
install java centos
ssh java
easy instructions to install java on centos
java install instructions that work
Comment #23
Cristobal Wetzig commentedComment #24
Cristobal Wetzig commentedThank you, #19 worked for me in a mac MAMP setup.
Comment #25
aronne commentedTher's a typo in #19.. $temp instead of $tmp, so this is the full working function for MAMP setup
Comment #26
ericmulder1980 commentedHi aronne,
It wasn't a typo, the variable name used to be $tmp, they probably changed it to $temp in a later version. I will change my comment to prevent people from using the wrong code.
Comment #28
nikus85 commentedI have no idea WHY, but variable $conf['apachesolr_attachments_java'] which was set in settings.php could not be read in apachesolr_attachments.index.inc (it returned 'java' instead of my custom jre executable path).
I tried ClearindAllCaches & turning off/on the module apachesolr_attachments. I have seen from code that module's .install should warn when java executable could not be accessed, but there were no warnings.
So far, I open my main custom module for the site, and put 1 more string in hook_init() function:
variable_set('apachesolr_attachments_java', "/my/custom/path/bin/java -Xms20m -Xmx64m");