代码启动tomcat时,怎么通过代码修改启动的端口

MoMeaker 2018-02-01 02:32:36
public void startOrStopTomat(String id, String[] args) {
if (bt == null) {
bt = new Bootstrap();
}
if (id.equals("start")) {
// bt.main(args);
try {
bt.init(args);
bt.setAwait(true);
bt.start();
} catch (Exception e) {
e.printStackTrace();
}
}
if (id.equals("stop") && bt != null) {
try {
// bt.init(args);
bt.stopServer(args);
} catch (Exception e) {
e.printStackTrace();
}

} else {
return;
}
}


现在想要的是传port进去,而不是从server.xml读取,该怎么做呢
...全文
1337 回复 打赏 收藏 转发到动态 举报
写回复
用AI写文章
回复
切换为时间正序
请发表友善的回复…
发表回复

24,923

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 Apache
社区管理员
  • Apache
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧