• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Finding the path that my Application is running in
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Finding the path that my Application is running in


  • Subject: Finding the path that my Application is running in
  • From: Jake MacMullin <email@hidden>
  • Date: Mon, 4 Feb 2002 23:48:09 +1030

Hi,

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?

Thanks,

Jake MacMullin


  • Follow-Ups:
    • Re: Finding the path that my Application is running in
      • From: John Timmer <email@hidden>
    • Re: Finding the path that my Application is running in
      • From: Andrew Pinski <email@hidden>
  • Prev by Date: Re: Simple TableView App (problem solved)
  • Next by Date: Re: Finding the path that my Application is running in
  • Previous by thread: Re: Simple TableView App (problem solved)
  • Next by thread: Re: Finding the path that my Application is running in
  • Index(es):
    • Date
    • Thread