• 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 running program with packages

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello Everyone,
My name is Sunil and I am preparing for SCJP 5.0.
I need help in running the following program.

SOURCE FILE 1:-

package Sunil_programmer.A;
public interface Test
{
void go();
}


SOURCE FILE 2:-
package Sunil_programmer.B;
import Sunil_programmer.A.*;
class Test1 implemets Test
{
public static void main(String[] args)
{
Test1 t=new Test1();
t.go();
}
public void go()
{
System.out.println("Hello Java");
}
}

NOW THE PROBLEM:-
I have created a directory Sunil_Programmer in C partition in windows.
In Sunil_programmer I created two directories named A and B. In
directory A there is SOURCE FILE 1 and in directory B there is SOURCE
FILE 2. I want to compile and run SOURCE FILE 2. I have navigated to directory A and compiled SOURCE FILE 1 and it compiles successfully. Then I navigated to directory B and tried to compile SOURCE FILE 2 having class Test1 implementing interface Test. The class Test1 is in package B and interface is in package A. I have not set classpath expicilty as an Environment Variable.

I am getting two errors given below while compiling class Test1.

1. Sunil_Programmer.A.*; Package A does not exist.
2. Error: Test1 implements Test

I think it is a package access and classpath problem, But I am unable to sort it out.

Please help me in detail in this problem.

With best Regards!
Sunil Kumar
SCJP Aspirant.
 
Ranch Hand
Posts: 1274
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
package Sunil_programmer.B;
I have created a directory Sunil_Programmer

Java is case sensitive.

Bu.
 
Consider Paul's rocket mass heater.
reply
    Bookmark Topic Watch Topic
  • New Topic