Search code examples
powershellclasspathjavacseparator

javac powershell classpath separator


So I'm aware that different operating systems require different classpath separators. I'm running a build of windows where CMD has been replaced with Powershell which is causing problems when using the semi-colon separator.

The command I'm trying to run begins with cmd /c to try and get it to run in command prompt instead but I think when PowerShell is parsing the whole command it sees the semi-colon and thinks that is the end!

My whole command is:

cmd /c javac -cp PATH1;PATH2 -d DESTINATION_PATH SOURCE_PATH

I have tried using a space, colon and period to no avail. Can anybody suggest a solution?

This is my first question on stackoverflow, hope the community can help and that it will eventually help others. :)


Solution

  • I suggest you start the process in the following way using Powershell

    Start-Process cmd.exe -ArgumentList "/c javac -cp PATH1;PATH2 -d DESTINATION_PATH SOURCE_PATH" -NoNewWindow