deployment - How are Java applications deployed in the "real world"? -


as novice world of java programming, question has boggled mind. first believed java files compacted applets , ran, realized isn't case. explain me how interweave our java applications real product of everyday life?

tl;dr: how implement our code practical usage?

it depends on application. there many options depending on how want users use app. it's packaged jar or specialized jar (war, ear).

in theory, zip raw directory structure .class files in , provide shell script/instructions run java command user. don't recommend because it's kind of unprofessional , requires maintain shell script each os want able run program on.

jar files used package libraries can have manifest file in says, "when double clicks/executes this, run class". class can start gui or headless task responds parameters, etc.

you can have applets, said. these programs run in user's browser.

you can have war file, way package web application. give web server , knows how deploy can visit web pages. example web server/container tomcat or jetty.

you can have ear file can contain other war files inside it. used applications need other parts of javaee functionality (ejbs, jms queues, etc.). example of application server jboss or glassfish.

there's java web start apps. these apps can run visiting webpage, downloaded computer , run on user's computer (instead of on server's backend, in war/ear).

there's javafx. don't know though. by skimming faq, appears java's answer adobe's flex. configure ui components xml configuration. i'm not sure format javafx apps use, say, "deploy on desktop or in browser".


as sotirios delimanolis mentioned in comment below, can build these files build systems ant or maven. can build them "by hand" tools come java/javaee sdk. example, should have jar command in path if installed sdk. here details of these build systems:

  • maven
    1. high level (you tell build, not how build it)
    2. much more build system. has dependency management, etc.
    3. opinionated (it uses convention on configuration, each config file generates 1 artifact, etc.)
  • ant
    1. low level (you tell how build things)
    2. flexible
    3. config files can whatever want, build many artifacts want
    4. easy learn
  • sdk tools
    1. always date. eg: rarely, maven/ant may not able set configuration option
    2. difficult remember commands
    3. very low level
    4. by itself, not repeatable (eg: unless build script, have type jar command each time)

Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -