I Have two applications.One is Standalone application.Another one is web Application (Servlet App). Here I want to Call Java Application From Servlet Application.So can You Guys Suggest Me or Can i have one app for this one.So that i will implement in my application. In this Application I have created Jar file of Stand alone Application After that What to do ?
First, you should make your command line application classes available in your web applcaction environment. To achieve this you should either:
WEB-INF/classes
in you war
WEB-INF/lib
in you war
Stand alone application starts from main()
method. You can just call this method from your servlet and pass parameters, for example: MyApp.main("hello", "stand alone application")
.
Since you are the author of both applications and are familiar with the internal design of the stand alone application you could (and probably should) call internal layer directly without using main()
. For example if you main method starts with new MyApp().start()
perform the same call from your servlet.
只需从GlassFish切换到Tomcat,即可解决您的问题。
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.