By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
458,111 Members | 1,665 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 458,111 IT Pros & Developers. It's quick & easy.

compilation error : cannot resolve symbol

P: 4
i hav created 3 classes in 3 different files. am gettin an error durin compilation. wat shud i do???

C:\s\source>javac -d ..\classes devtestdrive.java
devtestdrive.java:5: cannot resolve symbol
symbol : class device
location: class devtestdrive
device d1=new tv();
^
devtestdrive.java:5: cannot resolve symbol
symbol : class tv
location: class devtestdrive
device d1=new tv();
^
devtestdrive.java:6: cannot resolve symbol
symbol : class device
location: class devtestdrive
device d2=new printer();
^
devtestdrive.java:6: cannot resolve symbol
symbol : class printer
location: class devtestdrive
device d2=new printer();
^
devtestdrive.java:7: cannot resolve symbol
symbol : class device
location: class devtestdrive
device d3=new micro();
^
devtestdrive.java:7: cannot resolve symbol
symbol : class micro
location: class devtestdrive
device d3=new micro();
^
devtestdrive.java:9: cannot resolve symbol
symbol : class devicetester
location: class devtestdrive
devicetester d4=new devicetester();
^
devtestdrive.java:9: cannot resolve symbol
symbol : class devicetester
location: class devtestdrive
devicetester d4=new devicetester();
^
8 errors
Aug 5 '08 #1
Share this Question
Share on Google+
3 Replies


Expert 10K+
P: 11,448
Set your classpath (-cp), output directory (-d) and sourcepath (-sourcepath) on
your javac command line and compile all your .java files at once (*.java).
Type 'javac -help' for details. Don't forget to 'import' the classes in each others'
source files (if they're in a package).

kind regards,

Jos
Aug 5 '08 #2

P: 4
i compiled .java files all at once... but now am gettin an error at run time,

C:\s\source>java devtestdrive
Exception in thread "main" java.lang.NoClassDefFoundError: devtestdrive
Aug 5 '08 #3

Expert 10K+
P: 11,448
i compiled .java files all at once... but now am gettin an error at run time,

C:\s\source>java devtestdrive
Exception in thread "main" java.lang.NoClassDefFoundError: devtestdrive
Now type 'java -help' and read how you can set the classpath variable for the
JVM itself.

kind regards,

Jos
Aug 5 '08 #4

Post your reply

Sign in to post your reply or Sign up for a free account.