There are a variety of technologies for "packaging" Java applications, webapps and so forth, for deployment to the platform on which they will run. They range from simple library or executable
EAR files, through to installers and self-contained executables.
At the most fundamental level, a Java program can be deployed by copying a compiled class (i.e. a ".class" file) or a directory tree containing compiled classes. However Java is normally deployed in one of the following ways:
By copying a JAR file or collection of JAR files to the system where they will be executed; e.g. using
By copying or uploading a WAR, EAR or similar file to a "servlet container" or "application server".
By running some kind of application installer that automates the above. The installer might also install an embedded JRE.
By putting the JAR files for the application onto a web server to allow them to be launched using Java WebStart.
The Creating JAR, WAR and EAR files example summarizes the different ways to create these files.
There are numerous open source and commercial "installer generator" and "EXE generator" tools for Java. Similarly, there are tools for obfuscating Java class files (to make reverse engineering harder) and for adding runtime license checking. These are all out of scope for the "Java Programming Language" documentation.