• 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
  • Tim Cooke
  • paul wheaton
  • Paul Clapham
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Roland Mueller
  • Piet Souris
Bartenders:

Class access / package problem

 
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi

I would like someone to help me out in this.

I have two java clases in two different folders
one.java in com/classes1 folder and another
two.java in com/classes2 to use one.java
in class two.java i have written in two.java

package com.classes2;

import com.classes1.*;


--
in one.java the package declaration is
package com.classes1;



but when i compile it says
package com.classes1 does not exist import com.classes1.*;

The jdk is installed in C: drive and the com folder is in E: drive
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm going to answer as if we're using a command line instead of IDEs. Here's some conventional setup stuff ... see if this matches your configuration ...

The "src" folder can have any name, but "src" is common. In a command window, change current directory to src. Then commands like these should work:

set classpath=.;com.classes1;com.classes2
javac com\classes1\SomeClass.java
javac com\classes2\OtherClass.java
java com.classes1.SomeClass

Does that make sense. See if this helps, too.
 
Ganesh Chandrasekaran
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Dear Stan James,

Thank you very much .

It is working.


Ganesh
reply
    Bookmark Topic Watch Topic
  • New Topic