Serialized files don't work when project is converted to executable jar?

前端 未结 4 1160
温柔的废话
温柔的废话 2021-01-06 17:34

I made my java project into an executable jar using the export to jar option in eclipse. The jar runs as expected, except that it does not use any of the serialized files. I

4条回答
  •  执念已碎
    2021-01-06 17:59

    You need your JAR to use the same path for reading the Serialized Files as your code in eclipse.

    So you make a properties file containing the directory with your serialized objects. Then, this is the same for both your JAR and our project.

    See also: http://www.mkyong.com/java/java-properties-file-examples/

提交回复
热议问题