Reputation: 43
I'm running the docker command in windows command line successfully but when I run the same command in windows-subsystem-for-linux it shows class not found exception.
windows: docker run -it --cpus 4 -v ${PWD}:/app --workdir /app adoptopenjdk/openjdk11 java -cp C:\path\to\class Helloworld.java
WSL: docker run -it --cpus 4 -v ${PWD}:/app --workdir /app adoptopenjdk/openjdk11 java -cp /path/to/class Helloworld.java
Expected output:
Hello world!!
Error:
Could not find or load main class Helloworld.java
Caused by: java.lang.ClassNotFoundException: Helloworld.java
Upvotes: 0
Views: 268
Reputation: 89
It seems like the path may be wrong
You can also access your local machine’s filesystem from within the Linux Bash shell – you’ll find your local drives mounted under the /mnt folder. For example, your C: drive is mounted under /mnt/c:
-- https://learn.microsoft.com/en-us/windows/wsl/faq#what-can-i-do-with-wsl
Upvotes: 0