Search code examples
javaspring-batchcloud-foundry

Using SystemCommandTasklet to split a large file in Windows


I am trying to split a large flat file into multiple files using SystemCommandTasklet in Spring Batch. I am retrieving the large file from scality and storing it in the temp directory.

I'm getting the below error: Cannot run program "split" (in directory "C:\Users\myuser\AppData\Local\Temp"): CreateProcess error=2, The system cannot find the file specified

This is a duplicate of the question Using SystemCommandTasklet to split file. But I'm still unable to implement this.

Split works fine in Unix/Linux.

I'm using a windows machine, so does split using SystemCommandTasklet work in windows machine?


Solution

  • This is not a Spring Batch issue. It is because the split command is not available on windows. That's why it works on unix/linux but not on MS windows.

    You need to find an equivalent command on windows and pass it to your SystemCommandTasklet. Otherwise you have to write some portable code to split a file (in Java for instance) that would work on all platforms.