简体   繁体   中英

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

I know that

Compiling is the act of turning source code into object code.

Linking is the act of combining object code with libraries into a raw executable.

Building is the sequence composed of compiling and linking, with possibly other tasks such as installer creation.

(thanks to Ignacio Vazquez-Abrams ).

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

Your definitions seem to come from the world of native code compilers (C, C++, Pascal, etc). In Java, compilation is just the process of turning Java code (text) into Java bytecode which is also a high-level code, rather than object (machine) code.

Linking in Java happens each time the application runs inside the virtual machine, where symbols in the bytecode are resolved to references to other loaded bytecode. So the sequence in java is actually: Compile -> Deploy -> Link -> Run.

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

In this case deploying just refers to telling the application server where the code is and running the startup code as defined in the application descriptor (eg Servlet and Filter initialization defined in web.xml for webapps).

它通知应用程序服务器(例如tomcat)您的应用程序存在,配置它并启动它,以便通过http提供。

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM