I am getting this error on the following code (note that this does not happen on my local machine, only on my build server):
Files.readAllBytes(Paths.get(get
Generally, it is not correct to assume that every resource is a file. Instead, you should obtain the URL/InputStream for that resource and read the bytes from there. Guava can help:
URL url = getClass().getResource("/elasticsearch/segmentsIndex.json");
String content = Resources.toString(url, charset);
Another possible solution, with the InputStream and apache commons: Convert InputStream to byte array in Java .
From a byte[], simply use the String constructor to obtain the content as a string.