Deployment Concepts: Packing JAR Dependencies When and Why

So, I'm relatively new to Java EE, and it's hard for me to understand when, where, and why Java deployment files are packaged with their dependencies.

Let's say I'm building my project in myapp.jar , and it depends on fizz.jar, buzz.jar and JODA ( joda-time-2.0.jar).

I heard that the default class loader does not pack jars inside other jars, so I have to assume that if I called the jar task from Ant, then the default class loader will be called and myapp.jar will be created without these 3 dependencies.

Is it because the mentality is to deploy containers mainwithout containers or other systems that will meet its requirements at runtime? If not, how does myapp.jar work?

What about executable cans? To meet, they must be different from mainwithout cans, because they are designed for autonomous units, right? This means that they will need all their dependencies packed with them, right?

And last but not least, about banks that depend on cans, which depend on cans ... etc. (i.e. dependency graphs that are huge)?

I think that all these questions can be summarized as follows:

  • , , , , (-) ? (, , )?
  • , , ?
  • № 1 , classpath? (, )? , JRE , jars ?

, Java, / !

+5
2

( , Maven). Classloaders. .

,

, jar, , , (-) ? (, , )?

  • NO. , , . .

, , ?

  • NO. . , .

№ 1 , classpath? (, )? , JRE , jars ?

  • jar ( jar), classloader classpath , .
  • (WAR, EAR) /, , . .

, , . , . , ( ).

+5

JAR - java-. Jar .

, Jars , ( ) .

, jar libryra (, jdbc) , jdbc jar .

jar .class .

, , jdbc jar . , extarnal :

- , , J2SE ( )

-it , (classpath - , java)

:

java -jar -c/your/path/yourApp.jar

, ///, , , .

: http://download.oracle.com/javase/tutorial/deployment/jar/index.html

0

All Articles