How to read a file from jar in Java?

后端 未结 5 1293
我寻月下人不归
我寻月下人不归 2020-11-22 05:45

I want to read an XML file that is located inside one of the jars included in my class path. How can I read any file which is included in the jar?<

5条回答
  •  失恋的感觉
    2020-11-22 06:23

    Just for completeness, there has recently been a question on the Jython mailinglist where one of the answers referred to this thread.

    The question was how to call a Python script that is contained in a .jar file from within Jython, the suggested answer is as follows (with "InputStream" as explained in one of the answers above:

    PythonInterpreter.execfile(InputStream)
    

提交回复
热议问题