Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/java/400.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 如何访问IntelliJ插件中的资源文件';s罐_Java_Plugins_Intellij Idea_Intellij Plugin - Fatal编程技术网

Java 如何访问IntelliJ插件中的资源文件';s罐

Java 如何访问IntelliJ插件中的资源文件';s罐,java,plugins,intellij-idea,intellij-plugin,Java,Plugins,Intellij Idea,Intellij Plugin,我正在构建一个IntelliJ idea插件。我有一个组件TemplateComponent.java,它扩展了ApplicationComponent。下面是代码的链接 我想在TemplateLoader中读取一些模板文件。所有文件都放在项目/模板的根目录下。当我构建jar并将其安装到IDE中时,我无法访问这些文件,因为插件被打包为jar文件。然而,当我在IDE中调试插件时,一切都如期进行。有人能帮我吗?请参阅com.intellij.util.PathUtil#getJarPathForCl

我正在构建一个IntelliJ idea插件。我有一个组件TemplateComponent.java,它扩展了ApplicationComponent。下面是代码的链接


我想在TemplateLoader中读取一些模板文件。所有文件都放在项目/模板的根目录下。当我构建jar并将其安装到IDE中时,我无法访问这些文件,因为插件被打包为jar文件。然而,当我在IDE中调试插件时,一切都如期进行。有人能帮我吗?

请参阅com.intellij.util.PathUtil#getJarPathForClass及其在IDEA代码库中的用法。不幸的是,您可能必须添加一个检查,如果它是一个目录(debug)还是一个jar(production),就像在com.intellij.compiler.server.BuildManager#getJpsPluginSystemClassesPath中一样