-
FEATURED COMPONENTS
First time here? Check out the FAQ!
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
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.
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
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.)
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.
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.
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
Asked: 2013-04-10 09:50:36 +0800
Seen: 118 times
Last updated: Apr 19 '13
ZK Clustering, Session Replication Question [closed]
ZK Tomcat 7 Cluster/Session Replication
Call to zkcomet failing the first time
ZK 6.5.2 and memory leak stopping Tomcat 7.0.32
ZK on tomcat7 not working when accessing by IP
how do I map my domain name to an ZK application in TOMCAT server ...