Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/320.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Java 正在构建Eclipse RCP应用程序,运行失败_Java_Eclipse_Eclipse Rcp_Rcp - Fatal编程技术网

Java 正在构建Eclipse RCP应用程序,运行失败

Java 正在构建Eclipse RCP应用程序,运行失败,java,eclipse,eclipse-rcp,rcp,Java,Eclipse,Eclipse Rcp,Rcp,在成功构建我的应用程序之后,启动失败,因为它依赖于META-INF目录中的配置文件,并且在构建之后,该目录压缩为jar文件,因此无法访问配置文件。在手动解压缩jar、删除jar并使用xxx.jar重命名目录之后,程序运行没有问题。 SSO登录(Kerberos)需要配置文件。 代码如下: Bundle bundle = Platform.getBundle(Application.PLUGIN_ID); String path; try { path = new URL(bundle.g

在成功构建我的应用程序之后,启动失败,因为它依赖于META-INF目录中的配置文件,并且在构建之后,该目录压缩为jar文件,因此无法访问配置文件。在手动解压缩jar、删除jar并使用xxx.jar重命名目录之后,程序运行没有问题。 SSO登录(Kerberos)需要配置文件。 代码如下:

Bundle bundle = Platform.getBundle(Application.PLUGIN_ID);
String path;
try {
    path = new URL(bundle.getLocation().substring(18)).getPath();
} catch (MalformedURLException e1) {
    System.out.println(e1);
    path="";
} 
System.setProperty("java.security.auth.login.config",path+"META-INF/jaas-win.config");
Path变量包含类似“plugin/mydomain.pluginame xxxx.jar/”的内容 但系统似乎需要将jar解压缩

我在构建应用程序时做错了吗?
在将代码更改为以下内容后,感谢您

    ClassLoader cl = Thread.currentThread().getContextClassLoader();
    URL authconf = null;
    authconf= cl.getResource("META-INF/jaas-win.config");

    if (authconf == null) {
        loginContext = null;
        return;
    }

    String p;
    try {
         p = URLDecoder.decode(authconf.toExternalForm(), "UTF-8");
         System.setProperty("java.security.auth.login.config", p);
    } catch (UnsupportedEncodingException e1) {
        loginContext = null;
        return;
    }
现在可以了