Re: Finding the path that my Application is running in
Re: Finding the path that my Application is running in
- Subject: Re: Finding the path that my Application is running in
- From: John Timmer <email@hidden>
- Date: Mon, 04 Feb 2002 13:09:54 -0500
Since you're using Cocoa anyway, have you thought of:
PathString = NSBundle.mainBundle().bundlePath();
Jay
>
I've been writing a simple text editor in Java using the Cocoa API's as
>
a way of learning Cocoa. Among other things this editor allows me to
>
compile and run java files that I'm editing. However, I do this by
>
calling Java's Runtime.exec() method (similar to Cocoa's NSTask), and
>
passing it the command "javac filename.java -d ." (compile the file
>
called filename and put the resulting class file in the current
>
directory), followed by "java classname" (run the resulting class file
>
in the current directory).
>
>
This works really well when I build the application in Project Builder
>
and run it from my project/build directory. The application puts any
>
created .class files in the same directory that it is in, and when I
>
call run they launch ok.
>
>
However, as soon as I move my built application (say to the Applications
>
Directory), something goes wrong. Instead of placing the .class files in
>
the same directory as the Application, my app puts them at the root
>
level of my hard drive. I can't think why this might be happening. As a
>
solution I was wondering if anyone knows of an easy way to find out (at
>
runtime) where my application is running?