r/javahelp • u/tonywestonuk • Sep 12 '15
JavaEE HelloWorld - Getting Started with TomEE from scratch.... A reminder for those who think Java is too complex....
Assuming that you already have the Java SDK installed, these are the steps to get a hello world program running in TomEE.
Download / unpack Tomee.
wget http://mirror.catn.com/pub/apache/tomee/tomee-1.7.2/apache-tomee-1.7.2-jaxrs.tar.gz tar -xvf apache-tomee-1.7.2-jaxrs.tar.gz
Create folders to store your app.
mkdir -p apache-tomee-jaxrs-1.7.2/webapps/helloworld/WEB-INF/classes cd apache-tomee-jaxrs-1.7.2/webapps/helloworld/WEB-INF/classes
Create the HelloWorld.java
vi HelloWorld.java
import javax.ws.rs.*;
@Path("/") public class HelloWorld {
@GET public String home(){ return "Hello World"; }}
Compile it.
javac -classpath "../../../../lib/*" *.java
Start the server.
sh ../../../../bin/startup.sh
Navigate to page http://localhost:8080/helloworld
0
Upvotes
6
u/NimChimspky Sep 12 '15
most hello worlds are simple. Not sure that this really helps simplifies a normal java ee appliation.
For what its worth I think they are generally more complex than necessary, due in somewhat to the java ee standard libs.
For example there are two singleton annotations. Not that big a deal but very symbolic of the general mess.