Page 1 of 2 12 LastLast
Results 1 to 20 of 21
  1. #1
    afreaz is offline Member
    Join Date
    Feb 2010
    Posts
    19
    Rep Power
    0

    Default error with package

    /**
    * CalApp.java
    *
    * Created on November 24, 2001, 2:30 PM
    **/

    package com.kdbp.calendar;

    import com.kdbp.calendar.gui.CalFrame;

    /**
    * This launches the calendar application by running the main object.
    * @author Paul Miles
    * @version 1.0
    **/
    public class CalApp {

    /** Creates new CalApp */
    public CalApp() {
    }

    /**
    * @param args the command line arguments
    **/
    public static void main (String args[]) {
    //Construct a CalFrame object and start the calendar running.
    try {
    CalFrame f = new CalFrame("Calendar");
    f.pack();
    f.run();
    }
    catch(Exception e) {
    e.printStackTrace();
    }
    }
    }


    error
    package com.kdbp.calendar.gui does not exist
    import com.kdbp.calendar.gui.CalFrame;

  2. #2
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,172
    Rep Power
    20

    Default

    That error says it all.
    Does that package exist?

  3. #3
    makpandian's Avatar
    makpandian is offline Senior Member
    Join Date
    Dec 2008
    Location
    Chennai
    Posts
    450
    Rep Power
    6

    Default

    might be it was classpath problem. Make sure you have package com.kdbp.calendar.gui.CalFrame
    Mak
    (Living @ Virtual World)

  4. #4
    afreaz is offline Member
    Join Date
    Feb 2010
    Posts
    19
    Rep Power
    0

    Default

    ya al the packages r exactly in thr places so only am not able to decode the error:mad:

  5. #5
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,172
    Rep Power
    20

    Default

    What command are you running when you get this (the full command), and where (as in what directory) are you running it from?

  6. #6
    afreaz is offline Member
    Join Date
    Feb 2010
    Posts
    19
    Rep Power
    0

    Default

    am running it throught jcreator n java jdk directory is in c drive n the proj is in H drive.. i put the proj in jdk bin in c drive n then i tried it too but it did not work..
    the directory path is
    G:\No4\calanderpro\src\com\kdbp\calendar
    G:\No4\calanderpro\src\com\kdbp\calendar\gui
    n this is the exact error
    -------------------Configuration: <Default>--------------------
    G:\No4\calanderpro\src\com\kdbp\calendar\CalApp.ja va:9: package com.kdbp.calendar.gui does not exist
    import com.kdbp.calendar.gui.CalFrame;
    ^
    G:\No4\calanderpro\src\com\kdbp\calendar\CalApp.ja va:28: cannot find symbol
    symbol : class CalFrame
    location: class com.kdbp.calendar.CalApp
    CalFrame f = new CalFrame("Calendar");
    ^
    G:\No4\calanderpro\src\com\kdbp\calendar\CalApp.ja va:28: cannot find symbol
    symbol : class CalFrame
    location: class com.kdbp.calendar.CalApp
    CalFrame f = new CalFrame("Calendar");
    ^
    3 errors

  7. #7
    afreaz is offline Member
    Join Date
    Feb 2010
    Posts
    19
    Rep Power
    0

    Default

    G:\>cd G:\No4\calanderpro\src\com\kdbp\calendar

    G:\No4\calanderpro\src\com\kdbp\calendar>set path=C:\Program Files\Java\jdk1.6.0
    _10\bin

    G:\No4\calanderpro\src\com\kdbp\calendar>set classpath=%classpath%;.;

    G:\No4\calanderpro\src\com\kdbp\calendar>javac CalApp.java
    CalApp.java:9: package com.kdbp.calendar.gui does not exist
    import com.kdbp.calendar.gui.CalFrame;
    ^
    CalApp.java:28: cannot find symbol
    symbol : class CalFrame
    location: class com.kdbp.calendar.CalApp
    CalFrame f = new CalFrame("Calendar");
    ^
    CalApp.java:28: cannot find symbol
    symbol : class CalFrame
    location: class com.kdbp.calendar.CalApp
    CalFrame f = new CalFrame("Calendar");
    ^
    3 errors

    G:\No4\calanderpro\src\com\kdbp\calendar>


    this i hav tried in command prompt also

  8. #8
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,172
    Rep Power
    20

    Default

    makpandian hit the nail on the head.

    Since you're compiling from inside the package directory, and you haven't added a -cp classpath to your command, javac is attempting to find CalFram in:
    your-current-directory/com/kdbp/calendar/gui
    which doesn't exist.

    So add -cp ../../..;. to your javac (I think that's the right number of moves up). Don't forget the '.'.

    Or, possibly better, is move to the root directory (G:\No4\calanderpro\src) and do:
    javac com\kdbp\calendar\CallApp.java.

    ETA: don't stick stuff in the JDK directories. You should have no need to do this at all.

  9. #9
    afreaz is offline Member
    Join Date
    Feb 2010
    Posts
    19
    Rep Power
    0

    Default

    the CalFrame is actually in the gui folder only but still its not executing..

  10. #10
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,172
    Rep Power
    20

    Default

    So, again, what command are you running (including where you are running it from), and what error are you getting?

  11. #11
    afreaz is offline Member
    Join Date
    Feb 2010
    Posts
    19
    Rep Power
    0

    Default

    the same errors i mean all the above errors r coming even if all the files r in there respevtive folders i mean

  12. #12
    afreaz is offline Member
    Join Date
    Feb 2010
    Posts
    19
    Rep Power
    0

    Default

    can i mail u the complete proj as attachment

  13. #13
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,172
    Rep Power
    20

    Default

    OK, but have you run using -cp as I suggested?

    I can't see your machine so I don't know what you are doing.

  14. #14
    afreaz is offline Member
    Join Date
    Feb 2010
    Posts
    19
    Rep Power
    0

    Default

    G:\>cd G:\No4\calanderpro\src\com\kdbp\calendar

    G:\No4\calanderpro\src\com\kdbp\calendar>javac -cp CalApp.java
    'javac' is not recognized as an internal or external command,
    operable program or batch file.

    G:\No4\calanderpro\src\com\kdbp\calendar>
    this error is coming if i do it

  15. #15
    afreaz is offline Member
    Join Date
    Feb 2010
    Posts
    19
    Rep Power
    0

    Default

    how do i attach the folder to ur mail thr is no option in ths forum to attach folder

  16. #16
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,172
    Rep Power
    20

    Default

    So you weren't getting the same error.

    And you also didn't do as I said.
    Do you know what the -cp option does?
    If not then you should have looked it up in the docs.
    It sets the classpath.
    -cp by itself is meaningless.

  17. #17
    afreaz is offline Member
    Join Date
    Feb 2010
    Posts
    19
    Rep Power
    0

    Default

    G:\No4\calanderpro\src\com\kdbp\calendar>javac -cp <gui> CalApp.java
    Access is denied.

    G:\No4\calanderpro\src\com\kdbp\calendar>

  18. #18
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,172
    Rep Power
    20

    Default

    In that directory:
    java -cp ../../..;. CallApp.java

    And that assumes I've got the correct number of '..'

  19. #19
    afreaz is offline Member
    Join Date
    Feb 2010
    Posts
    19
    Rep Power
    0

    Default

    G:\No4\calanderpro\src\com\kdbp\calendar>javac -cp ../../..;. CalApp.java
    Note: Some input files use or override a deprecated API.
    Note: Recompile with -Xlint:deprecation for details.
    Note: Some input files use unchecked or unsafe operations.
    Note: Recompile with -Xlint:unchecked for details.

  20. #20
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    12,172
    Rep Power
    20

    Default

    Well, that should be self explanatory.
    Or do you expect me to hold your hand?

Page 1 of 2 12 LastLast

Similar Threads

  1. I got an error message when using package in Textpad
    By magicianseeker in forum New To Java
    Replies: 5
    Last Post: 12-09-2010, 04:57 AM
  2. package does not exist error
    By glaze24 in forum New To Java
    Replies: 1
    Last Post: 11-28-2010, 03:03 PM
  3. Error: Cannot find symbol during Importing package
    By sashi799 in forum New To Java
    Replies: 4
    Last Post: 07-21-2010, 11:36 AM
  4. why I get error while trying to run a class in a package
    By newlifeseattle in forum New To Java
    Replies: 4
    Last Post: 06-01-2010, 08:15 PM
  5. Replies: 7
    Last Post: 11-09-2009, 08:51 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •