Java – cygwin bash: java: command not found

cygwinjava

So I had to re-install my system.
I installed Cygwin in C:\cygwin\bin

And I used the batch file that worked on my previous installation:
"start_cygwin.bat"

@echo off  
C:  
chdir C:\cygwin\bin  
bash -c "cd /cygdrive/e/apache-solr-3.5.0/example/;java -Dsolr.solr.home="./example-DIH/solr/" -jar start.jar" 

But after running this command:

bash -c "cd /cygdrive/e/apache-solr-3.5.0/example/;java -Dsolr.solr.home="./example-DIH/solr/" -jar start.jar" 

I get the error:

bash: java: command not found

I thought it had something to do with java, but I installed the java jdk 6.27 (which worked fine before) and when I type "java" in my command prompt I see a list of possible java commands.

Best Answer

Its not able to locate your java.exe file.

To resolve the issue, you have two options:

  1. Add Java installed folder in your PATH

  2. Use full path of java.exe in the above command i.e. in place of java, use /home/../jdk.../bin/java.

One of the tow options, should help resolving your issue.