
第一种:object获取项目中的properties
InputStream in = Object. class .getResourceAsStream( "/com/demo/conf.properties" );
第二种:直接获得本地配置文件properties
(推荐学习:java视频教程)
FilePond 是一个 JavaScript 文件上传库,支持通过拖拽、粘贴和 API 方式处理文件、目录、URL 和 Data URI。它包含内置的图像优化功能、异步分块上传功能,并提供了适用于 React、Vue、Angular 和 Svelte 的适配器。
FileInputStream in = new FileInputStream("D:\work\demo\conf.properties");
//加载properties文件
Properties prop = new Properties();
prop.load(in);
//从配置文件中获取 页面的位置,此处url为网页的绝对路径并解决乱码,如:d:/demo/index.html
String url = new String(prop.getProperty( "csv_url" ).trim().getBytes("ISO-8859-1"),"gbk");
//根据url打开网页
private static void browse(String url) throws ClassNotFoundException, IllegalAccessException,
IllegalArgumentException, InterruptedException, InvocationTargetException, IOException,NoSuchMethodException {
String osName = System.getProperty("os.name", "");
if (osName.startsWith("Windows")) {
Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + url);
} else if (osName.startsWith("Mac OS")) {
Class fileMgr = Class.forName("com.apple.eio.FileManager");
Method openURL = fileMgr.getDeclaredMethod("openURL", new Class[] { String.class });
openURL.invoke(null, new Object[] { url });
} else {
// Unix or Linux
String[] browsers = { "firefox", "opera", "konqueror", "epiphany",
"mozilla", "netscape" };
String browser = null;
for (int count = 0; count <p>相关文章教程推荐:<a href="https://www.php.cn/java/guide/" target="_blank">java入门教程</a><br></p>
Java免费学习笔记:立即使用
解锁 Java 大师之旅:从入门到精通的终极指南










