search

Home  >  Q&A  >  body text

java - Should I package the tool class I made into a jar and reference it every time, or should I paste the code every time I use it?

I just started writing programs in Java. I wrote several tool classes of my own based on our projects. It is relatively simple to package them into jars and use them every time. However, if there are any modifications, we need to open a separate project for the tool classes; if every time The advantage of copying the tool code is that it can be changed at any time. I don’t know what other differences there are in the use of these two tool types. Please give me some advice.

过去多啦不再A梦过去多啦不再A梦2717 days ago790

reply all(4)I'll reply

  • 高洛峰

    高洛峰2017-06-23 09:15:16

    1. The tool classes that are packaged into jar packages are basically the result of a large number of scenarios. Such tool classes are rarely modified. In the situation you mentioned, those tool classes are not yet mature, so it is still difficult to package them into jar packages. It's not appropriate enough because there are scenes that need to be modified and added.
    2. If there are only a few tool classes, I personally think it is more convenient without using the jar package.
    3. Large-scale projects are generally jar packages, which are unified.

    reply
    0
  • 代言

    代言2017-06-23 09:15:16

    If it is a tool class that is only useful for your project, then it will naturally be placed in your project. Why create a separate tool class project?

    If you think that these tool classes may have a certain degree of versatility and can be used in other places in the future, then put them in a separate project, introduce them as dependent projects in eclipse, and then type them when they are actually released. JAR package.

    reply
    0
  • 扔个三星炸死你

    扔个三星炸死你2017-06-23 09:15:16

    Packaging is an inevitable trend, just let it take its course.

    reply
    0
  • 漂亮男人

    漂亮男人2017-06-23 09:15:16

    Frequently modified instructions are not general enough. . .

    reply
    0
  • Cancelreply