Adam
Adam

Reputation: 6122

cygwin bash: java: command not found

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.

Upvotes: 2

Views: 10604

Answers (2)

Viorel Mirea
Viorel Mirea

Reputation: 399

If it doesn't work using the path to java/bin then you can try to
- create symbolic link: ln -s /cygdrive/c/Program\ Files/Java/jre1.8.0_102/bin/java.exe /usr/bin/java
- create an alias: alias java="/cygdrive/c/Program\ Files/Java/jre1.8.0_102/bin/java.exe"
- add the java path to the paths: export JAVA_HOME="/cygdrive/c/Program\ Files/Java/jre1.8.0_102"
export PATH="$PATH:$JAVA_HOME/bin"

Upvotes: 0

Yogendra Singh
Yogendra Singh

Reputation: 34367

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.

Upvotes: 4

Related Questions