• 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
  • Liutauras Vilda
  • Jeanne Boyarsky
  • paul wheaton
Sheriffs:
  • Ron McLeod
  • Devaka Cooray
  • Henry Wong
Saloon Keepers:
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Tim Moores
  • Mikalai Zaikin
Bartenders:
  • Frits Walraven

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
 
What I don't understand is how they changed the earth's orbit to fit the metric calendar. Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic