• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

problem in compiling

 
Greenhorn
Posts: 17
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:rolleyes:
 
Bartender
Posts: 3225
34
IntelliJ IDE Oracle Spring Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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:rolleyes:



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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 3225
34
IntelliJ IDE Oracle Spring Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks sir....
the link was very helpful
 
Mohamed Sanaulla
Bartender
Posts: 3225
34
IntelliJ IDE Oracle Spring Chrome Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes Sir it did.
Thanks again.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic