spring-boot启动后在浏览器打开指定页面
import java.awt.Desktop;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;
public class Browser {
public static void main(String[] args) {
String url = "http://www.google.com";
if(Desktop.isDesktopSupported()){
Desktop desktop = Desktop.getDesktop();
try {
desktop.browse(new URI(url));
} catch (IOException | URISyntaxException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}else{
Runtime runtime = Runtime.getRuntime();
try {
runtime.exec("xdg-open " + url);
} catch (IOException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
}
}
spring-boot启动后在浏览器打开指定页面的更多相关文章
- 微信如何实现自动跳转到用其他浏览器打开指定页面下载APP
不管是app的下载链接还是普通文件的链接在微信内置浏览器或者QQ内置浏览器都会被屏蔽.这是微信对第三方下载域名实施的拦截政策.被拦截了用户在微信内打开就会提示“已停止访问该网页”. 那么当我们遇到这个 ...
- 在Spring Boot启动后执行指定代码
在开发时有时候需要在整个应用开始运行时执行一些特定代码,比如初始化环境,准备测试数据等等. 在Spring中可以通过ApplicationListener来实现相关的功能,不过在配合Spring Bo ...
- idea中spring boot启动后无法访问jsp
出自:https://www.jianshu.com/p/470b28d76147 第一种: 打开File > Project Structure > Facetes 如图1: 图1 如果 ...
- Spring boot启动后没有生成日志文件问题排错
我的配置是: logging.file.name=spring-boot.log logging.file.path=D:/log/ 系统启动后日志文件没有生成 原因:一开始以为这两个属性是配合着使用 ...
- 问题之Spring MVC配置后,可以打开jsp页面,但打不开html页面
一.配置Spring MVC 1.导入jar spring框架:http://repo.spring.io/release/org/springframework/spring/ spring-fra ...
- spring boot 启动后执行初始化方法
http://blog.csdn.net/catoop/article/details/50501710 1.创建实现接口 CommandLineRunner 的类 package org.sprin ...
- spring boot启动后执行方法
@Componentpublic class InitProject implements ApplicationRunner { private static final Logger logger ...
- Spring boot启动成功后输出提示
添加logback-spring.xml,将log输出到文件,控制台输出的level改为error因此只会出处banner src/main/resources/banner.txt的内容为 star ...
- Spring Boot 启动(二) Environment 加载
Spring Boot 启动(二) Environment 加载 Spring 系列目录(https://www.cnblogs.com/binarylei/p/10198698.html) 上一节中 ...
随机推荐
- winform 中TextBox只能输入数字
textBox1.KeyPress+=TextNumber_KeyPress; private void TextNumber_KeyPress(object sender, KeyPressEven ...
- BZOJ 2460 [BeiJing2011]元素(线性基模板题)
Description 相传,在远古时期,位于西方大陆的 Magic Land 上,人们已经掌握了用魔法矿石炼制法杖的技术.那时人们就认识到,一个法杖的法力取决于使用的矿石.一般地,矿石越多则法力越强 ...
- Delphi xe5 控件TIdhttp的用法post,get解决中文乱码问题
网络接口如下图: 浏览器演示如下:http://xxx.xxx.xxx.xxx/web/login!doLogin?data={"password":"yy123&quo ...
- New Year, New Devs: Sharpen your C# Skills
At the beginning of each new year, many people take on a challenge to learn something new or commit ...
- redis内网无法连接的问题
1.修改redis服务器的配置文件 vi redis.conf 注释以下绑定的主机地址 # bind 127.0.0.1 2.修改redis服务器的参数配置 修改redis的守护进程为no ,不启用 ...
- 【原创】插件式ICE服务框架
Zero ICE在跨平台.跨语言的环境中是一种非常好的RPC方案,而且使用简单.早期在使用ICE时,每一个后端功能模块都以独立服务方式部署,在功能模块较少时不会有明显的问题,但是随着功能模块的增多,部 ...
- WPF MaterialDesignInXamlToolkit锁屏恢复后页面冻结的问题
在做WPF项目时,用到 MaterialDesignInXamlToolkit 开源项目.结果客户用的时候发现这个问题,锁屏后,界面不刷新. 如果不用MaterialDesign,测试后不会出现这个问 ...
- Tips on rendering interiors
http://www.evermotion.org/tutorials/show/9824/making-of-morning-breakfast-tip-of-the-week http://www ...
- 这些混账的开源库在煞笔Windows系统上的编译方法
母语不就是用来吐槽的么!!!!!说母语我不骂人难道还用英语么!!!!!!!!!! 说什么什么开源库好的狗日的,尼玛有种先搞定编译啊卧槽!!!!!!!!! 是的!!!!!你可以吐槽老子智商低用弱智煞笔W ...
- [NOI2010]能量采集(莫比乌斯反演)
题面: bzoj luogu NOI2010能量采集 题解 读完题之后我们发现在每个产生贡献的点\((x1,y1)\)中,它与原点之间的点\((x2,y2)\)都满足\(x2|x1\),\(y2|y1 ...