gpt4 book ai didi

java - 将图像保存到 Web 应用程序中的项目文件夹中

转载 作者:行者123 更新时间:2023-12-01 14:43:28 25 4
gpt4 key购买 nike

我需要将图像保存到项目文件夹中。这是一个网络应用程序。我无法弄清楚如何找到我想要保存图像的文件夹的绝对路径。当我尝试创建空文件夹并获取其绝对路径时,我得到了 Eclipse 路径。

有人可以帮我解决这个问题吗?

这是我尝试保存图像的一些代码:

public void saveCustomsLabel(byte[] array, Obj1, String str) throws userException {
byte[] array2 = null;

try {

imageInByte = array;

OutputStream bos = new ByteArrayOutputStream();
InputStream bis = new ByteArrayInputStream(imageInByte);
BufferedImage bImageFromConvert = ImageIO.read(bis);
File path = new File("Templates/Images/Image.bmp")
ImageIO.write(bImageFromConvert, "bmp", path);

最佳答案

也许您应该尝试部署您的项目。在本地计算机上,文件转到 eclipse 路径。

关于java - 将图像保存到 Web 应用程序中的项目文件夹中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15705018/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com