PaperMC / Paperclip

Bootstrap utility and launcher for the Paper Minecraft server
MIT License
120 stars 51 forks source link

Cannot run mvn command with ProcessBuilder on Windows #24

Closed chrisgdt closed 3 years ago

chrisgdt commented 4 years ago

Description

When I run java -Dpaperclip.install=true -jar paperclip.jar :

$ java -Dpaperclip.install=true -jar paperclip.jar
Maven must be installed and on your PATH.
java.io.IOException: Cannot run program "mvn": CreateProcess error=2, Le fichier spécifié est introuvable
        at java.lang.ProcessBuilder.start(Unknown Source)
        at io.papermc.paperclip.Paperclip.mavenInstall(Paperclip.java:260)
        at io.papermc.paperclip.Paperclip.setupEnv(Paperclip.java:103)
        at io.papermc.paperclip.Paperclip.main(Paperclip.java:48)
Caused by: java.io.IOException: CreateProcess error=2, Le fichier spécifié est introuvable
        at java.lang.ProcessImpl.create(Native Method)
        at java.lang.ProcessImpl.<init>(Unknown Source)
        at java.lang.ProcessImpl.start(Unknown Source)
        ... 4 more

It seems to be a problem with java + Windows.

This guy got the same issue : https://stackoverflow.com/questions/7966194/running-mvn-using-processbuilder

When I tried to test new ProcessBuilder("mvn.cmd", "-version").start(), it worked perfectly. So if mvn.cmd can be automatically used instead of mvn for windows users, it would fix the thing I think.

Thank you in advance ! :D

Additional Information

System path is correctly set for the maven bin so I can run mvn -version in console without any issues.

System information

Java : jdk 1.8_0_201 OS : Windows 10 version 19041.450 16Go RAM, x64