Daml sandbox failed to start Java

I am trying to run the Wallet sample app on Windows. Cloned it from Git, and then ran the following command from the project root:

daml sandbox --dar main/Asset/asset.dar --dar main/User/user.dar --dar main/Account/account.dar 

I get the following error:

Starting Canton sandbox.
Listening at port 6865
Uploading main/Asset/asset.dar to localhost:6865
Failed to start java. Make sure it is installed and in the PATH.
daml-helper: main/Asset/asset.dar: openBinaryFile: does not exist (No such file or directory)

But Java is very much installed.

java -version
java version "17.0.3" 2022-04-19 LTS
Java(TM) SE Runtime Environment (build 17.0.3+8-LTS-111)
Java HotSpot(TM) 64-Bit Server VM (build 17.0.3+8-LTS-111, mixed mode, sharing)

Any suggestions?

The suggestion from the error is misleading (but happens to be helpful in the vast majority of cases :wink: ).

If you look closely, though, it appears that main/Asset/asset.dar does not exist. Can you double check that path? From the README for the Wallet app it looks like the step you’re going through requires to run a Make file right before that. Did that step complete successfully?

No it didn’t. Since the readme gives an option to either run ‘make sandbox’ or ‘daml sandbox…’ posted above, I thought it is a workaround. The make sandbox instruction gives the following error:

'cut' is not recognized as an internal or external command,
operable program or batch file.
daml sandbox --dar main/Asset/asset.dar --dar main/User/user.dar --dar main/Account/account.dar --port-file ./canton-port.txt
Starting Canton sandbox.
Listening at port 6865
Uploading main/Asset/asset.dar to localhost:6865
Failed to start java. Make sure it is installed and in the PATH.
daml-helper: main/Asset/asset.dar: openBinaryFile: does not exist (No such file or directory)
make: *** [Makefile:26: sandbox] Error 1

I am trying to see how to make the wallet-app run on Windows. I installed chocolatey to get the dev tools. It gives ‘make’ and ‘grep’, but gets stuck at ‘cut’ as in the case above.

Apologies, I read it a bit in a rush and didn’t realize that using make was an alternative. Then if the file doesn’t exist it’s probably because you didn’t build the project in the step above, which is covered in the section above. It looks like you are supposed to run make build, which in turn seems to call build.sh. You can probably run the steps therein manually to obtain the same result.

Alternatively for an easy way to work around the lack of native Windows support you might want to consider the possibility of using the Windows Subsystem for Linux (WSL), which allows you to effectively run a fully fledged Linux distribution on top of your Windows box.

Thanks @stefanobaghino-da ! Running individual commands from build.sh creates the dar files. After that, the Daml Sandbox command works.

1 Like