2

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.

0

2 Answers 2

4

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.

Sign up to request clarification or add additional context in comments.

2 Comments

+1 it could be in your CMD's path but not for bash. Try running java under bash and see what you get. If that doesn't work, use the full path to java instead.
On my system (Cygwin under Windows 7), type java says java is /cygdrive/c/Windows/system32/java; it's a Windows installation, not part of Cygwin. I have /cygdrive/c/Windows/system32 in my Cygwin $PATH. Note that Cygwin's $PATH is (at least partly) independent of the Windows %PATH%.
0

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"

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.