w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
this.getClass().getResource("").getPath() returns an incorrect path

Try this.

import java.io.File;

public class TT {

    /**
     * @param args
     */
    public static void main(String[] args) {
        // TODO Auto-generated method stub

        String path = TT.class.getResource("").getPath();
        File file = new File(path);
        System.out.println(file.getAbsolutePath());

    }

}




© Copyright 2018 w3hello.com Publishing Limited. All rights reserved.