Win a copy of Kotlin in Action this week in the Kotlin forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

Class access / package problem  RSS feed

 
Ganesh Chandrasekaran
Greenhorn
Posts: 22
  • Mark post as helpful
  • send pies
  • 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
 
Stan James
(instanceof Sidekick)
Ranch Hand
Posts: 8791
  • Mark post as helpful
  • send pies
  • 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
  • Quote
  • Report post to moderator
Dear Stan James,

Thank you very much .

It is working.


Ganesh
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!