• Post Reply Bookmark Topic Watch Topic
  • New Topic

problem in compiling  RSS feed

 
ishani sharma
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hello...
i wrote a java program which imports another classname from a different package,
but when am compiling the program from cmd it says package doesnot exist(the imported one).
Can you please tell me the possibilities where i cud be wrong...
i am trying since yesterday but cant figure it out
 
Mohamed Sanaulla
Bartender
Posts: 3185
34
Google App Engine Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ishani sharma wrote:hello...
i wrote a java program which imports another classname from a different package,
but when am compiling the program from cmd it says package doesnot exist(the imported one).
Can you please tell me the possibilities where i cud be wrong...
i am trying since yesterday but cant figure it out


Can you post the exact error message and also how you invoked the java compiler command? The class you are trying to use should be in your classpath. So you need to use the -cp or -classpath command along with the javac command.

And also let us know if you have set the classpath variable in the environment variables?
 
ishani sharma
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

E:\>javac \EclipseWorkspace\TRIAL\src\trialpackage\SubclassB.java
\EclipseWorkspace\TRIAL\src\trialpackage\SubclassB.java:3: package edu.java.trialpackage.ch04.accessibility does not exist
import edu.java.trialpackage.ch04.accessibility.*;
^
\EclipseWorkspace\TRIAL\src\trialpackage\SubclassB.java:8: cannot find symbol
symbol: class SuperclassA
public class SubclassB extends SuperclassA {
^
\EclipseWorkspace\TRIAL\src\trialpackage\SubclassB.java:23: cannot find symbol
symbol : class SuperclassA
location: class trialpackage.AnyClassB
SuperclassA obj = new SuperclassA();
^
\EclipseWorkspace\TRIAL\src\trialpackage\SubclassB.java:11: cannot find symbol
symbol : method superclassMethodA()
location: class trialpackage.SubclassB
superclassMethodA();
^
\EclipseWorkspace\TRIAL\src\trialpackage\SubclassB.java:18: cannot find symbol
symbol : variable anyVar3
location: class trialpackage.SubclassB
System.out.println("anyVar3: "+ anyVar3);
^
\EclipseWorkspace\TRIAL\src\trialpackage\SubclassB.java:23: cannot find symbol
symbol : class SuperclassA
location: class trialpackage.AnyClassB
SuperclassA obj = new SuperclassA();
^
6 errors


Although it compile well with my IDE..
 
Mohamed Sanaulla
Bartender
Posts: 3185
34
Google App Engine Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you try using -classpath option? You might want to read the article- HowToSetTheClasspath
 
ishani sharma
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks sir....
the link was very helpful
 
Mohamed Sanaulla
Bartender
Posts: 3185
34
Google App Engine Java Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ishani sharma wrote:Thanks sir....
the link was very helpful


Glad it was useful. Just to clarify- did that solve your problem?
 
ishani sharma
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes Sir it did.
Thanks again.
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!