Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

What is the problem of generating file path in springboot and its solution

2025-01-19 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/01 Report--

This article introduces the problem and solution of generating file path in springboot. The content is very detailed. Interested friends can use it for reference. I hope it will be helpful to you.

Springboot generate file path

When developing a springboot project and distributing it as a jar package, there may be two cases where the file path is inconsistent. There is a way to get the path so that the root directory of the project or jar package can be correctly obtained in both environments.

For example, String root = System.getProperty ("user.dir"); String path = root + "\\ out.txt"; / / this is the directory where you can get the current jar package runtime.

When the project runs with java-jar xxx.jar in the jar package, jar runs as a separate file and the file is not generated in the jar package.

So use System.getProperty ("user.dir"); to get the path where the current jar is running (the same directory as the jar file), and use that path as the root directory to store the files generated in the project.

Springboot creation error (path)

Error: Cannot download 'https://start.spring.io/starter.zip?type=maven-proje

This happens when you create a springBoot project using idea

Solve

After setting finds HTTP Proxy, select Auto-detect proxy settings, click on the Check connection pop-up input box, and enter the address below

On the problem of generating file paths in springboot and what is the solution to share here, I hope that the above content can be of some help to you, can learn more knowledge. If you think the article is good, you can share it for more people to see.

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report