Women in Technology

Hear us Roar



Article:
  Building Cocoa-Java Apps with Eclipse
Subject:   Having a problem setting up Debugging
Date:   2006-07-17 19:55:16
From:   meclyma
Mike,


I have enjoyed your article.


I have run into a problem when I started to implement the Debugging section of the article. Under the headings of page 2: "Debugging Cocoa-Java Applications with Eclipse" and then the heading: "Getting Started". Item #2 "Add a breakpoint to the first line of applicationDidFinishLaunching() in Controller.java." Where can "Controller.java" be found? It must be a file that can be viewed in Eclipse because you need to set a breakpoint. But I can't find it. Do you have any helpful suggestions?


Thanks.


Mark

Full Threads Oldest First

Showing messages 1 through 3 of 3.

  • Having a problem setting up Debugging
    2006-07-19 13:20:17  mikebutler1 [View]

    Hi Mark,

    Glad you liked the article - hopefully we can sort out what's going on...

    If you follow the link from the first part of the article you will find the TextEdit sample project. Controller.java is simply one of the files used in that project. (
    file:///Developer/Examples/Java/AppKit/TextEdit/Controller.java 
    )

    When you follow the steps outlined in the "Getting Started with Eclipse" section, you should see all of the java files in the eclipse Navigator panel ( or the Package Explorer if you prefer it :-) So you should be able to see Controller.java there.

    If it's not showing up, make sure it's actually there on disk in the first place and hasn't been accidentally deleted at some point!

    Let me know how it goes for you,

    Mike.
    • Having a problem setting up Debugging
      2006-07-20 19:52:42  meclyma [View]

      Mike,

      I found the original Controller.java file. I copied the code into a new file under the TextEdit folder in Eclipse (it was placed under a default package). Then I received several errors in Controller.java. Here are a few of the lines with errors:

        Under applicationShouldTerminate method:

      Document document = Document.documentForWindow(window);
      The error is on "Document"

      Preferences.saveDefaults();
      The error is on "Preferences"

        Under applicationOpenFile method:

      return Document.openDocumentWithURL(NSPathUtilities.URLWithPath(filename),
      The error is on "Document" (there are other errors on this line that I won't list here).

      There are more errors in Controller.java that I will not list here because they are similar errors. I am not sure if all of these errors are part of JAVA classes or Cocoa classes (I suspect Cocoa classes). Do I need to add more "import"'s to Controller.java? Or do I need to tell Eclipse where to find the Cocoa library? If the latter, is this because I created a new Java file and copied the code into a new file that Eclipse is confused on (and obviously this developer too)? In your article you showed us how to tell Eclipse where to find the Cocoa classes by creating a
        new
      folder called "Cocoa". But how do you link a newly created Java file to the Cocoa classes when the Cocoa folder already exists?

      BTW, I forgot to mention that I am using: Eclipse 3.2.0, MacOS X 10.4.6, Xcode 2.3, and JAVA 1.5.

      Thanks.

      Mark
      • Having a problem setting up Debugging
        2006-07-21 02:40:02  mikebutler1 [View]

        Hi Mark,

        It looks like you're nearly there ( but why did you have to copy the code from Controller.java? Why not just use Controller.java? ). It just looks like you haven't told Eclipse where to find all of the Cocoa classes.

        If you follow steps 5 and 6 of "Tell Eclipse where to find the Cocoa classes" on page one, then it should sort it out for you. Those steps describe how to get Eclipse to add an external class folder - in this case /System/Library/Java where all of the Cocoa classes are stored.

        Hope that helps,

        Mike.