Click here to Skip to main content
12,560,652 members (52,245 online)
Rate this:
Please Sign up or sign in to vote.
See more: Java netbeans
Hello everyone,

Finally, I finished my graduation project. I am putting some extra facilities. However, ı faced with a problem. There was a code line in .net while reading some folders or files. when we wrote Application.StartupPath... the project directs the user "proje\bin\debug folder. In this manner, I want to use the same facility. I have a resources.rar folder. When the user clicked on the download the source link this should be downloaded. However, I am using my own path C:Users/Emre/etc...

Is there any way to solve this?

Thank you.
Posted 17-Jan-13 12:46pm
Sergey Alexandrovich Kryukov 17-Jan-13 19:05pm
Not quite clear. Do you need similar functionality for Java, or it is still somehow related to .NET?
TuranEmre 18-Jan-13 2:09am
I am sorry, I am using the file path as C:Users/Emre/....
But, when we move the project to another pc, it wont work. There was a code in .net we use Application.StartupPath+"\resources.rar" and this works any pc. I am asking is there a code doing sama things for java?
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

Yes. You need to use relative paths, not absolute.
There should be a package ResourceBundle for doing so. Please check that.

If you are linking in from another destination (some .net app), you should use a property for configuring a decent path.
TuranEmre 18-Jan-13 2:09am
I am sorry TorstenH. Still couldn't find anything.
TorstenH. 18-Jan-13 5:58am
yeah - google is wired. I like to use "feel lucky" in those cases. Works quite well:

ResourceBundle in Java 6SE
TuranEmre 18-Jan-13 7:43am
Thank you TorstenH. I solved with this link.
Rate this: bad
Please Sign up or sign in to vote.

Solution 2

For the record: I believe I answered here: Raising the portability of program[^].


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.161026.1 | Last Updated 18 Jan 2013
Copyright © CodeProject, 1999-2016
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100