Results 1 to 4 of 4
Thread: relative paths of ubuntu
- 05-20-2010, 07:02 PM #1
Member
- Join Date
- Feb 2010
- Posts
- 15
- Rep Power
- 0
relative paths of ubuntu
Hi,
can anyone tell me how to find the relative path to the jar file when working on ubuntu. I have an application that uses some files that are in the same folder as the jar file. It works fine on windows and even on ubuntu but on ubuntu it only works when running the application from netbeans. Any help pls about what i can do... this is a bit urgent
thanks
- 05-20-2010, 07:58 PM #2
What technique are you using in Windows? What does that technique return when you run the program in ubuntu?
Here are some string I got when running code:
URL ourLoc = obj.getClass().getResource(className);
// Output when load from a jar:
//JAVA >Loaded from jar:file:/C:/My_Photos/SlideShowApp.jar!/ImgIdxEditor.class,
// getFile=file:/C:/My_Photos/SlideShowApp.jar!/ImgIdxEditor.class
//JVIEW>Loaded from systemresource:/ZIPC:\My_Photos\SlideShowApp.jar/+/ImgIdxEditor.class,
// getFile=/ZIPC:\My_Photos\SlideShowApp.jar/+/ImgIdxEditor.class
//JDK118>Loaded from=systemresource:/ZIP1/+/NormsTools/FindOurHome.class,
// getFile=/ZIP1/+/NormsTools/FindOurHome.class
// Linux: URLStr=jar:file:/home/norm/www/HTTPServer.jar!/HTTPServer/httpd.class
- 05-20-2010, 08:03 PM #3
Member
- Join Date
- Feb 2010
- Posts
- 15
- Rep Power
- 0
hi 10x 4 the reply, in windows I am just opening a file giving the path like this for example Myfolder/myfile.txt.
in the code you have given, what is obj expected to be pls?
thanks
- 05-20-2010, 10:45 PM #4
obj could be the this for the calling program.
In following test code, foh became obj in the method called:
FindOurHome foh = new FindOurHome(); // need an object
String theFN = FindOurHome.getHomeLoc(foh, args[0]);
...
in FinfOurHome class:
public final static String getHomeLoc(Object obj, String className) {
...
Similar Threads
-
How to use relative paths when compiling?
By chesl73 in forum New To JavaReplies: 1Last Post: 10-14-2009, 02:28 PM -
AlwaysOnTop is on TOP of everything. I need it relative
By TimHuey in forum New To JavaReplies: 2Last Post: 10-14-2009, 05:47 AM -
how to set relative path in jsp?
By makpandian in forum JavaServer Pages (JSP) and JSTLReplies: 0Last Post: 01-02-2009, 08:20 AM -
Obtaining relative path outside of executable JAR
By tjsaker in forum Advanced JavaReplies: 1Last Post: 11-14-2008, 06:48 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks