Can not get file path from resource folder - Java

I try to automate a page that I have. In the page I need to upload a PDF file. The problem is that I want selenium via java will get the file from the resource of the project and not hard coded. (since some have windows and some mac and some ubonto so the solution is to get the path dynamically).

I manually hard coded I enter the path it worked and return the path, however to let java return the path it crash. this is my code:

  /******* test *******/
    public  void testFileUpload() throws Exception {
        WebDriver deiver2 = getWebDriver();


        ClassLoader classLoader = getClass().getClassLoader();
        String path = classLoader.getResource("TAX12.pdf").getPath();
        System.out.println("\n\n path is  " + path);



I want in the send keys to send the file, the exists however it is not worked. get null exception

the file exists in the folder and worked if manually set the path, but not locate the file if I want it to do it by himself (for win / mac / linux etc)

enter image description here