I am running this code below and I have tried to use the stockfish exe. When running with file path it works although not in jar file. When I use a URL it does not work. My other file paths work just this does not. I think it has to do with it being an exe and using processbuilder.
public Engine()
{
builder = new ProcessBuilder(getClass().getResource("/cpt_chess/sf.exe"));
builder.redirectErrorStream(true);
}
public void start_process()
{
try
{
process = builder.start();
}
catch (IOException e)
{System.out.print("error");
}
}
public void read ()
{
BufferedReader stdInput = new BufferedReader(new InputStreamReader(process.getInputStream()));
new Thread ()
{
public void run ()
{
try {
String line = stdInput.readLine();
while (line != null)
{
if (line.contains("bestmove"))
{
test_chess.engine_move = line;
}
line = stdInput.readLine();
}
} catch (IOException ex) {
Logger.getLogger(Engine.class.getName()).log(Level.SEVERE, null, ex);
}
}
}.start();
}