0

how to deploy zk application with tomcat startup

asked 2013-04-10 09:50:36 +0800

zknl gravatar image zknl
124 2

hello everyone, while after deploying zk project on client pc,before starting zk application we have to first start tomcat server(manully) and then resp zk appl. so now my question is is it possible to create an exe file or batch file by which after clicking on that file tomcat will start first automcatically and then zk application will run ???? plz provide some ways how should i do this? Regards, Nil

delete flag offensive retag edit

6 Replies

Sort by ยป oldest newest

answered 2013-04-10 23:53:57 +0800

rickcr gravatar image rickcr
704 7

I'm not sure I fully understand the question. What do you mean "then the zk application will run?" Once tomcat starts up (or any application server) the applications are there by visiting the appropriate URL.

If you are referring to wanting some Java code within your ZK application to run once Tomcat starts, then I'd implement a ServletContextListener (defined in your web.xml of your ZK app.) You'll implement the following in your ServletContextListener:

 public void contextInitialized(ServletContextEvent arg)

In which you could place any arbitrary code you'd like to have run. contextInitialized will be called when Tomcat starts.

link publish delete flag offensive edit

answered 2013-04-15 08:21:09 +0800

zknl gravatar image zknl
124 2

updated 2013-04-15 08:21:34 +0800

thanks ricker for ur reply i thought u have partially understood my question

i know we run zk application by using appropriate URL in browser ok let me explain what i want to do or achieve, as u know plain java project can be run by creating its .exe / batch file so likewise i want to run zk application by using .exe / .batch file

like when i'll click on exe file then first it will start tomcat server and browser will open with whatever first zul page URL

i know its something strange n difficult,but if it is possible with plain java so i thought will it work for our ZK also

plz do reply

link publish delete flag offensive edit

answered 2013-04-15 14:57:42 +0800

rickcr gravatar image rickcr
704 7

Correct me if I'm wrong but it sounds like you're planning on distributing this is as a 'standalone' application to some clients? In other words are you planning on delivering the application to people and then you want the exe to install tomcat for them and deploy your zk application to tomcat and then start tomcat and then open up a browser to localhost? That totally defeats the purpose of this being a 'web application.' You might as well build the application using a desktop technology if this is what you're attempting to achieve. Why not just deploy it as a web application on your server and tell people "Go to this URL"

Note when you say " u know plain java project can be run by creating its .exe / batch file so likewise " I take it you're referring to a Java Swing application, which sure of course this could be done, but that's a "desktop" application not a "web application." A web application runs on a server not on ones' desktop (not counting development of course.)

link publish delete flag offensive edit

answered 2013-04-15 15:50:37 +0800

azli gravatar image azli
24 3

Although i agree with rickr, but i'll suggest you take a look at jetty. Its an embedded server. My idea is you put your zk app in a folder, create a batch file to run jetty. And you also might put some command in the batch file to automatically open your app in browser.

You can download the zk essentials project as an example since jetty already configured in the project.

link publish delete flag offensive edit

answered 2013-04-16 22:42:25 +0800

jhcd2016 gravatar image jhcd2016
1

I agree with Rick too. "...Why not just deploy it as a web application on your server and tell people "Go to this URL". "

If you want a desktop app to do that try put all your app in a folder and compress as a jar file then @import as an external batch file or exe to run it.

link publish delete flag offensive edit

answered 2013-04-19 07:52:39 +0800

zknl gravatar image zknl
124 2

Hello everyone, thanks 2 all for quick responses though i agree that as zk is a web application on server and to run i can tell people "Go to this URL ",,,,," but for user convience i thought to do like desktop application so i asked how i can achieve by double click on exe/batch file..starting tomcat and opening zk application main url in browser

ok as azli said will try by using jetty as well as willl try as jhcd2016 suggested

regards zknl

link publish delete flag offensive edit
Your reply
Please start posting your answer anonymously - your answer will be saved within the current session and published after you log in or create a new account. Please try to give a substantial answer, for discussions, please use comments and please do remember to vote (after you log in)!

[hide preview]

Question tools

Follow
1 follower

RSS

Stats

Asked: 2013-04-10 09:50:36 +0800

Seen: 118 times

Last updated: Apr 19 '13

Support Options
  • Email Support
  • Training
  • Consulting
  • Outsourcing
Learn More