I have a ProcessBuilder that executes a shell script, it worked fine until I wanted to add an argument to the shell script from a variable.
Exception in thread "main" java.lang.NullPointerException
at testOne.main(testOne.java:10)
Line 9:
String myarg = "testarg";
Line 10 (the one that gives me the error):
final ProcessBuilder processBuilder = new ProcessBuilder("/bin/bash", "-c",
testOne.class.getResource("/test.sh " + myarg).getPath());
I understand that I have have concatenated the /test.sh with the String and that it would be treated as filename now which is why it gives me the error. I am however clueless how I could solve it.