Results 1 to 20 of 21
Thread: error with package
- 12-15-2010, 08:37 AM #1
Member
- Join Date
- Feb 2010
- Posts
- 19
- Rep Power
- 0
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;
- 12-15-2010, 09:18 AM #2
Moderator
- Join Date
- Apr 2009
- Posts
- 10,476
- Rep Power
- 16
That error says it all.
Does that package exist?
- 12-15-2010, 10:10 AM #3
might be it was classpath problem. Make sure you have package com.kdbp.calendar.gui.CalFrame
Mak
(Living @ Virtual World)
- 12-15-2010, 12:37 PM #4
Member
- Join Date
- Feb 2010
- Posts
- 19
- Rep Power
- 0
ya al the packages r exactly in thr places so only am not able to decode the error:mad:
- 12-15-2010, 01:08 PM #5
Moderator
- Join Date
- Apr 2009
- Posts
- 10,476
- Rep Power
- 16
What command are you running when you get this (the full command), and where (as in what directory) are you running it from?
- 12-15-2010, 01:14 PM #6
Member
- Join Date
- Feb 2010
- Posts
- 19
- Rep Power
- 0
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
- 12-15-2010, 01:19 PM #7
Member
- Join Date
- Feb 2010
- Posts
- 19
- Rep Power
- 0
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
- 12-15-2010, 01:29 PM #8
Moderator
- Join Date
- Apr 2009
- Posts
- 10,476
- Rep Power
- 16
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.
- 12-15-2010, 03:31 PM #9
Member
- Join Date
- Feb 2010
- Posts
- 19
- Rep Power
- 0
the CalFrame is actually in the gui folder only but still its not executing..
- 12-15-2010, 03:47 PM #10
Moderator
- Join Date
- Apr 2009
- Posts
- 10,476
- Rep Power
- 16
So, again, what command are you running (including where you are running it from), and what error are you getting?
- 12-15-2010, 03:52 PM #11
Member
- Join Date
- Feb 2010
- Posts
- 19
- Rep Power
- 0
the same errors i mean all the above errors r coming even if all the files r in there respevtive folders i mean
- 12-15-2010, 03:53 PM #12
Member
- Join Date
- Feb 2010
- Posts
- 19
- Rep Power
- 0
can i mail u the complete proj as attachment
- 12-15-2010, 03:54 PM #13
Moderator
- Join Date
- Apr 2009
- Posts
- 10,476
- Rep Power
- 16
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.
- 12-15-2010, 03:59 PM #14
Member
- Join Date
- Feb 2010
- Posts
- 19
- Rep Power
- 0
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
- 12-15-2010, 04:00 PM #15
Member
- Join Date
- Feb 2010
- Posts
- 19
- Rep Power
- 0
how do i attach the folder to ur mail thr is no option in ths forum to attach folder
- 12-15-2010, 04:02 PM #16
Moderator
- Join Date
- Apr 2009
- Posts
- 10,476
- Rep Power
- 16
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.
- 12-15-2010, 04:12 PM #17
Member
- Join Date
- Feb 2010
- Posts
- 19
- Rep Power
- 0
G:\No4\calanderpro\src\com\kdbp\calendar>javac -cp <gui> CalApp.java
Access is denied.
G:\No4\calanderpro\src\com\kdbp\calendar>
- 12-15-2010, 04:18 PM #18
Moderator
- Join Date
- Apr 2009
- Posts
- 10,476
- Rep Power
- 16
In that directory:
java -cp ../../..;. CallApp.java
And that assumes I've got the correct number of '..'
- 12-15-2010, 04:41 PM #19
Member
- Join Date
- Feb 2010
- Posts
- 19
- Rep Power
- 0
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.
- 12-15-2010, 05:01 PM #20
Moderator
- Join Date
- Apr 2009
- Posts
- 10,476
- Rep Power
- 16
Similar Threads
-
I got an error message when using package in Textpad
By magicianseeker in forum New To JavaReplies: 5Last Post: 12-09-2010, 03:57 AM -
package does not exist error
By glaze24 in forum New To JavaReplies: 1Last Post: 11-28-2010, 02:03 PM -
Error: Cannot find symbol during Importing package
By sashi799 in forum New To JavaReplies: 4Last Post: 07-21-2010, 10:36 AM -
why I get error while trying to run a class in a package
By newlifeseattle in forum New To JavaReplies: 4Last Post: 06-01-2010, 07:15 PM -
The declared package does not match the expected package
By oneforall in forum EclipseReplies: 7Last Post: 11-09-2009, 07:51 AM


LinkBack URL
About LinkBacks
Reply With Quote
Bookmarks