In our company we are using Jira Server and Scriptrunner. Currently, I'm trying to read a file using a script in the script console. The file should be stored in a working directory on e.g. "C:/Users/<myname>/Desktop".
Up to now I didn't get access to a file which is stored in the given directory. I'm able to list the content of the current working directory (which is located at the server) but I'm not able to change the path to "C:/Users/<myname>/Desktop". The system always throws an java.io.FileNotFoundException (no such file or directory). Here a snapshot of the script:
def a1 = new File("C:/Users/Name/Desktop").path
log.debug "path a1: "+a1
def a2 = new File(a1,"hello.txt")
log.debug"The file ${a2.absolutePath} has ${a2.length()} bytes"
a2.eachLine {
line -> log.debug "line : $line";
}
I tried the script on my own local version of Jira and Scriptrunner and there it is no problem to read a file of my desktop.
Any idea?