由买买提看人间百态

boards

本页内容为未名空间相应帖子的节选和存档,一周内的贴子最多显示50字,超过一周显示500字 访问原贴
Java版 - java directory?
相关主题
jar 的问题, 路径有问题? 大家帮忙看看是啥毛病?谁给科普一下什么是javascript?
请教一个建网站的笔试题eclipse怎么无法成功导出jar文件的?
Re: Do anyone know a good websit containing the source code of Javaa java question (转载)
为何运行JAVA出现这个错误?Static就是个混球
[转载] Re: package usage in javaJAVA URL question, help
where to execute java program?UNIX 和 Win下的安装区别?
One question about Java Programmingeclipse中怎样改变tab/indent大小?
急问:ubuntu下安装j2ee sdk的奇怪错误java + javascript open local file? (转载)
相关话题的讨论汇总
话题: directory话题: java话题: jar话题: where话题: could
进入Java版参与讨论
1 (共1页)
c*****t
发帖数: 1879
1
How to find the jar directory my jar file is running from?
For example, my abc.jar could be run by somebody by
java -jar /some/where/abc.jar
or they could run like
java -cp /some/where/abc.jar Main
However, i needed to create/load preferences in the same directory
where abc.jar is located.
Anyone could show me howto?
Thanks a lot
xt
发帖数: 17532
2
There is no good way to do it. I recommend writing a running
script along with your jar file at distribution. Then ask
the user to run your script instead of directly running
the java command.
h*k
发帖数: 127
3
of course there is a good/clean way.
dont make false assumptions because you dont know.

【在 xt 的大作中提到】
: There is no good way to do it. I recommend writing a running
: script along with your jar file at distribution. Then ask
: the user to run your script instead of directly running
: the java command.

d******p
发帖数: 24
4
If you are using jdk1.4, you can use
java.util.prefs.Preference
or you can save it to user's home dir,
which is avaliable as system property
"user.home"

【在 c*****t 的大作中提到】
: How to find the jar directory my jar file is running from?
: For example, my abc.jar could be run by somebody by
: java -jar /some/where/abc.jar
: or they could run like
: java -cp /some/where/abc.jar Main
: However, i needed to create/load preferences in the same directory
: where abc.jar is located.
: Anyone could show me howto?
: Thanks a lot

1 (共1页)
进入Java版参与讨论
相关主题
java + javascript open local file? (转载)[转载] Re: package usage in java
问题:Service script for Java app on Unixwhere to execute java program?
其实JSP也不错One question about Java Programming
Position: JAVA Developer 急问:ubuntu下安装j2ee sdk的奇怪错误
jar 的问题, 路径有问题? 大家帮忙看看是啥毛病?谁给科普一下什么是javascript?
请教一个建网站的笔试题eclipse怎么无法成功导出jar文件的?
Re: Do anyone know a good websit containing the source code of Javaa java question (转载)
为何运行JAVA出现这个错误?Static就是个混球
相关话题的讨论汇总
话题: directory话题: java话题: jar话题: where话题: could