Application plugin breaks file path

I am writing a command line application that reads a file provided by the user. When I was having trouble I wrote the following test program to find out why. The problem seems to be that the script generated by the application plugin is giving the wrong file path.

Correct

$ java -jar NetBeansProjects/UserFileTest/build/libs/UserFileTest.jar test.txt
File:
/Users/ccordero/test.txt

Wrong

$ UserFileTest/bin/UserFileTest test.txt
File:
/Users/ccordero/UserFileTest/bin/test.txt

userfiletest.Main:

package userfiletest;

import java.io.File;

public class Main {
    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        String fileName = args[0];
    
        System.out.println("File:");
        File file = new File(fileName);
        System.out.println(file.getAbsolutePath());
    }
}

build.gradle:

apply plugin: 'java'
apply plugin: 'application'

mainClassName = "userfiletest.Main"

jar {
    manifest {
        attributes 'Main-Class': 'userfiletest.Main'
    }
}

settings.gradle:

rootProject.name = 'UserFileTest'