Java – Running Bash on Windows 7 (.sh)

Running Bash on Windows 7 (.sh)… here is a solution to the problem.

Running Bash on Windows 7 (.sh)

This is a GUI java application,
I have a run.sh file and I want to run it on Windows 7 (x64).
How is it done?

The file has these lines:

#!/bin/bash

java -Xmx2048m -classpath ./lib/*: com.jweb2.JWMainWindow  &> out.txt

I installed JDK, JRE, and Cygwin from Java ( http://www.cygwin.com/ )
But nothing helps.

Who knows?

Solution

It’s just a java command. Convert it to a Windows batch (.bat) file.

The run.bat file should contain:

SET CPATH=""
FOR /F %%r in (.\lib\*) DO SET CPATH="%CPATH; %%r"
java -Xmx2048m -classpath %CPATH com.jweb2.JWMainWindow  > out.txt 2>&1

If your java command is in %PATH%, it should work

I can’t access Windows machines right now. So there may be errors.

Related Problems and Solutions