How to run a java chess program in windows

Discussion of anything and everything relating to chess playing software and machines.

Moderator: Ras

Ferdy
Posts: 4852
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

How to run a java chess program in windows

Post by Ferdy »

I have windows 10 how do you setup a java program in cutechess for example.

Java program:
https://github.com/sandermvdb/chess22k/ ... s/tag/1.14
tmokonen
Posts: 1365
Joined: Sun Mar 12, 2006 6:46 pm
Location: Kelowna
Full name: Tony Mokonen

Re: How to run a java chess program in windows

Post by tmokonen »

You can use a batch file, same as you would in Arena.

I have the Java bin folder in my path, and my batch file contains one line:

java -Xmx1024M -jar chess22k-1.14.jar

Usually when you install Java, it places the Java bin folder in your path. If you don't have the Java bin folder in your path, your batch file would look more like:

"C:\Program Files\Java\jdk-14.0.1\bin\java.exe" -Xmx1024M -jar chess22k-1.14.jar

substituting C:\Program Files\Java\jdk-14.0.1\bin\ with wherever your Java executable is located.

Since the full path has spaces, I had to use the quotes. I usually configure engines to use 256MB of hash memory. You may have to increase the amount of memory specified in the -Xmx1024M command line parameter (here, a maximum of 1024 MiB of memory usage) if you want the engine to use more hash. You'd probably have to put quotes around the name of the .jar file, if the jar filename contains spaces.

And from within the CuteChess GUI:

Image
Ferdy
Posts: 4852
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: How to run a java chess program in windows

Post by Ferdy »

tmokonen wrote: Thu Jan 07, 2021 9:52 am You can use a batch file, same as you would in Arena.

I have the Java bin folder in my path, and my batch file contains one line:

java -Xmx1024M -jar chess22k-1.14.jar

Usually when you install Java, it places the Java bin folder in your path. If you don't have the Java bin folder in your path, your batch file would look more like:

"C:\Program Files\Java\jdk-14.0.1\bin\java.exe" -Xmx1024M -jar chess22k-1.14.jar
Thanks that one worked.

BTW what is "-Xmx1024M"?
tmokonen
Posts: 1365
Joined: Sun Mar 12, 2006 6:46 pm
Location: Kelowna
Full name: Tony Mokonen

Re: How to run a java chess program in windows

Post by tmokonen »

Ferdy wrote: Thu Jan 07, 2021 10:04 am Thanks that one worked.

BTW what is "-Xmx1024M"?
That's the maximum amount of memory that Java will use, technically the maximum heap size. It doesn't necessarily have to be included in the batch file, but in the past I had problems with some engines unless I explicitly included that option with a large enough amount of memory. Some engines are memory hogs, even beyond hash/opening book/neural net usage. Honestly, I'm a bit lazy, and I just copy batch files and change paths whenever I use a new Java program. When I run Chess22k using 256MB of hash, it uses 295,408K when I look at memory usage in the task manager, so 1024M is plenty in this case.

https://alvinalexander.com/blog/post/ja ... e-control/

Edit: Now that I've looked it up, it appears that 64MB is the default heap size, so you'll probably need it, unless you use a tiny hash table size.
Ferdy
Posts: 4852
Joined: Sun Aug 10, 2008 3:15 pm
Location: Philippines

Re: How to run a java chess program in windows

Post by Ferdy »

tmokonen wrote: Thu Jan 07, 2021 10:19 am
Ferdy wrote: Thu Jan 07, 2021 10:04 am Thanks that one worked.

BTW what is "-Xmx1024M"?
That's the maximum amount of memory that Java will use, technically the maximum heap size. It doesn't necessarily have to be included in the batch file, but in the past I had problems with some engines unless I explicitly included that option with a large enough amount of memory. Some engines are memory hogs, even beyond hash/opening book/neural net usage. Honestly, I'm a bit lazy, and I just copy batch files and change paths whenever I use a new Java program. When I run Chess22k using 256MB of hash, it uses 295,408K when I look at memory usage in the task manager, so 1024M is plenty in this case.

https://alvinalexander.com/blog/post/ja ... e-control/

Edit: Now that I've looked it up, it appears that 64MB is the default heap size, so you'll probably need it, unless you use a tiny hash table size.
Ok I keep it there, I run engine only at 128MB for bullet tests.