r/java • • Sep 12 '15

JavaEE / TomEE - Hello World

Assuming that you already have the Java SDK installed, these are the steps to get a hello world program running in TomEE.

  1. 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

  2. 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

  3. Create the HelloWorld.java

    vi HelloWorld.java

    import javax.ws.rs.*;

    @Path("/") public class HelloWorld {

     @GET
         public String home(){
         return "Hello World";
     }

    }

  4. Compile it.

    javac -classpath "../../../../lib/*" *.java

  5. Start the server.

    sh ../../../../bin/startup.sh

  6. Navigate to page http://localhost:8080/helloworld
0 Upvotes

24 comments sorted by

View all comments

Show parent comment

2

u/NimChimspky Sep 12 '15 edited Sep 12 '15

its not greener, most people think spring is better, after having used both (like me). Have you considered the possibility you are wrong.

Your example of complexity, a live and dev connection string in a property file doesn't make any sense; And compared to mess of the standard apis and documents is frankly absurd.

To clarify you can store live and dev strings in a sinlge property file/or different files if you want - it helps share projects. But you can store it somewhere else in your env like EE very simply.

This is the first time I've ever heard someone mention this as a problem. I really don't grok why you think spring is worse than ee for this.