Tomcat 7 emdedded


/ Published in: Java
Save to your folder(s)

How to embedded tomcat 7 java


Copy this code and paste it in your HTML
  1. String webappDirLocation = "src/main/webapp/";
  2. Tomcat tomcat = new Tomcat();
  3. tomcat.setPort(8080);
  4.  
  5. tomcat.addWebapp("/jerseyTest", new File(webappDirLocation).getAbsolutePath());
  6.  
  7. tomcat.start();
  8. tomcat.getServer().await();

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.