Cassandra - "The system cannot find the file specified"

After looking at the file it seems, powershell script cassandra-env.ps1 executes following function:

if (Test-Path Env:\JAVA_HOME)
{
    $env:JAVA_BIN = "$env:JAVA_HOME\bin\java.exe"
}
elseif (Get-Command "java.exe")
{
    $env:JAVA_BIN = "java.exe"
}
else
{
    echo "ERROR!  No JAVA_HOME set and could not find java.exe in the path."
    exit
}

I'm not an expert on Cassandra stuff, but if I were you I would run this script and make sure $env:JAVA_BIN is set correctly, and from there I would follow its trail and check ParseJVMInfo function in the conf\cassandra-env.ps1 file which is throwing error in your setup.

Update: Check JAVA_HOME environment variable and see if it is setup such that [JAVA_HOME]\bin\java.exe exists.


Don't install Cassandra into directory where the name has space in it. Startup script for Windows has problems with such names.

Update after an additional investigation:

Looking more precisely into the code, it looks like it can't start Java with the given command-line switches: -d64 -version - either Java executable isn't in the PATH, or the -d64 switch isn't supported for your version of Java - for example, if you installed 32-bit version of Java. Please try to run the java -d64 -version from the command line to check that it works


In my case I updated my java version and added latest version in system environment and run this command as administrator in cassandra specieid path(C:\Program Files\apache-cassandra-3.11.6\bin).

cassandra.bat -f

its running perfactly!!

and also make sure You must allow the execution of PowerShell Scripts. for this check out this one https://www.howtogeek.com/106273/how-to-allow-the-execution-of-powershell-scripts-on-windows-7/