Whats best way to package a Java Application with lots of dependencies?

后端 未结 7 1969
醉酒成梦
醉酒成梦 2021-01-11 14:22

I\'m writing a java app using eclipse which references a few external jars and requires some config files to be user accessable.

  1. What is the best way to pac

7条回答
  •  耶瑟儿~
    2021-01-11 14:43

    There is no one 'best way'. It depends on whether you are deploying a swing application, webstart, applet, library or web application. Each is different.

    On point 2, you are correct. Jar files cannot contain other jar files. (Well, technically they can, its just that the inner jar file won't be on your classpath, effectively meaning that jar files do not contain jar files).

    On point 3, you certainly can reference config files outside the jar file. You can typically reference a config file as a file or a resource. If you use the resource approach, it typically comes from the classpath (can be in a jar). If you use a file, then you specify the filename (not in a jar).

    In general, most Java developers would use Apache Ant to achieve deployment. Its well documented, so take a look.

提交回复
热议问题