如何在 Websphere 上运行普通 Java 应用程序
我有一个独立的java应用程序,它有一个主类。我想在 Wepsphere 启动时运行这个课程。我不想为此使用 servlet。 我如何使用管理控制台/脚本等来做到这一点?
谢谢
I have a standalone java application which has one main class. I want to run this class when Wepsphere starts up. I don't want to use servlet for this.
How can I do this using admin console/scripting etc?
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
这有点 hacky,但我很想在
startServer.{bat|sh}
中添加一行来启动 Java 程序。例如(在 Windows 上):如果您需要在 Websphere 关闭时再次停止程序,您可能还需要编辑
stopServer.{bat|sh}
。或者... (最好)
创建一个启动您的应用程序和 Websphere 的新脚本,然后运行该脚本:
优点是您最终不必编辑Websphere 脚本,因此您不会受到未来 WAS 补丁可能应用的任何更改的影响。但是,如果 WAS 作为服务启动,那么您可能需要更改正在运行的命令以指向新脚本。与本答案的其余大部分内容一样,如何执行此操作取决于您的平台。
It's a bit hacky, but I'd be tempted to add a line to
startServer.{bat|sh}
to start your Java program. E.g. (on Windows):If you need to stop the program again when Websphere is shut down, you might want to edit
stopServer.{bat|sh}
as well.Alternatively... (and preferably)
Create a new script that starts both your app and Websphere, and run that instead:
Advantage is that you don't end up editing the Websphere scripts, so you won't be affected by any changes that future WAS patches might apply. However, if WAS is being started as a service, then you might need to alter the command that's being run to point to your new script instead. As with most of the rest of this answer, how to do this differs depending on your platform.