1

我正在尝试在不同的平台上运行我的应用程序。应用程序使用可以输入和输出。我把这些文件和使用的类放在一起。对于我放的路径

public static String getPath() {
        String decodedPath = null;
        try {
            String path = InstallApk.class.getProtectionDomain()
                    .getCodeSource().getLocation().getPath();
            // URLDecoder decoder = new URLDecoder();
            decodedPath = URLDecoder.decode(path, "UTF-8");
        } catch (Exception e) {
            e.printStackTrace();

        }
        return decodedPath;
    }

但是当我试图用其他系统或来自usb的其他位置测试我的jar时,例如。我没有写路径,但是一个错误的。

4

0 回答 0