What is the difference between building and deploying a Java web project?

I know that

Compilation is the conversion of source code to object code.

Binding is a combination of object code with libraries into a raw executable file.

Building is a sequence consisting of compiling and linking, possibly with other tasks, such as creating an installer.

(thanks to Ignacio Vasquez-Abrams ).

But when I want to see my changes in a Java Web project, I will also have to deploy them (after creation). What does Netbeans do when deploying my project?

+4
source share
2 answers

Your definitions apparently come from the world of compilers with native code (C, C ++, Pascal, etc.). In Java, compilation is just the process of turning Java code (text) into Java bytecode, which is also high-level code, not an object (machine) code.

Binding in Java occurs every time an application runs inside a virtual machine, where characters in a byte encoder are allowed to reference another loaded byte code. So, the sequence in java is actually: Compile -> Deploy -> Link -> Run.

Once launched, the JVM may choose to turn Java bytecode into machine code for direct execution, but it can also simply interpret the bytecode.

In this case, deployment simply means telling the application server where the code and the launch code are located, as defined in the application descriptor (for example, the servlet and filter initialization defined in web.xml for webapps).

+5
source

It informs the application server (e.g. tomcat) about the existence of your application, configures it, and launches it to be accessible via http.

+3
source

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


All Articles