How to create a jar file that includes xml and html files?

I am trying to create a jar file that contains some class and java files, but I would also like to add some additional xml, xsl, html, txt (README) files.

I am using Eclipse on Windows XP.

Is there an easy way to set up the directory structure and pack all my files in a jar?

+3
source share
5 answers

Add the files to the source folder and they can be included in the jar.

One common way is to have the src folder at the root of your project. Inside this are folders for java files and others. sort of:

src /
    css /
    java /
    html /
    images /

( , ), .

+3

A.jar - , ZIP-, , ZIP . , .

+1

Ant, jar (. , / ..)

+1

Eclipse ( txt, html, xml ..).

Eclipse File- > Export- > Jar File- > Next " Java".

.

+1

ANT ( Maven, Maven), Jar, Eclipse (, ). , , src, jsp, foobar , ANT Jar task.

<target name="makejar" depends="compile, copyfiles">

    <jar destfile="${jars.dir}/myjarfile.jar" index="true" basedir="${build.dir}" />

</target>

, , - src -source ( package.html Javadoc). , , -, .

0

Source: https://habr.com/ru/post/1697527/


All Articles