访问JAR文件夹中的文件

编程入门 行业动态 更新时间:2024-10-27 22:27:12
本文介绍了访问JAR文件夹中的文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

你好朋友...

我已经开发了一个包含示例音频测试代码的JAR文件. JAR文件包含一个名为wavfile的文件夹,该文件夹保存项目的wavefile.我曾经通过在其中添加以下代码来获取JAR的当前目录:

I have developed a JAR file that contains the sample audiotesting code. The JAR file contains a folder called wavfile which holds the wavefiles of the project. I used to get the current dir of the JAR by adding the follwing code into it:

System.getProperties("User.dir"+"\\WavFile");

但是当我尝试在另一个Windows系统中运行此文件时,该文件无法正常工作.

But when I try to run this file in another Windows system it is not working.

代码搜索jar加载到的wavefile

The code searches for the wavefile where the jar has been loaded

例如:如果我在C:\\中加载JAR文件,则代码在C:\\中而不是在JAR文件中搜索wavefile文件夹,并抛出错误

For example: If I load my JAR file in C:\\ then the code searches for the wavefile folder in C:\\ and not inside the JAR file and throws me the error

File not found:C:\\WavFile\\English\\mysound.wav

对我有什么想法.....

Any ideas for me .....

推荐答案

您需要先提取文件. 这个站点应该可以帮助您从存档中取出文件. You need to extract the file first. This site should help you with getting the file out of the archive.

更多推荐

访问JAR文件夹中的文件

本文发布于:2023-10-31 16:49:05,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1546689.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:文件   夹中   JAR

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!