Creating Instance of a public class from the currenyt directory

Discussions

Web tier: servlets, JSP, Web frameworks: Creating Instance of a public class from the currenyt directory

  1. I have two class file in my curent directory. Public class A and public class B.

    I am working in curent directory and both classes are in the same directory. I want to create an object of class A in class B.

    But whenever i try to compile my B class it gives an erroe message cannot resole sybole A.

    I am using jdk1.3. The same problem i am facing with Interface also if i create a n interface amnd try to implement it in any other class in the same directory. The copmile time error shows symobole can't resolve.

    I have been using Jdk1.2 and i have never faced such problem.

    Please help me how to get rid of thois Problem.

    Thanking You

    Niraj
  2. Compile both in one command:

    javac -d . A.java B.java

  3. I am still not able to create an object of another public class in the same directory. I am using Win 2000 and jdk1.3.

    Please help me.

    Thanx

    Niraj
  4. Execute the dos command echo %classpath% and get all the directories listed in classpath and examine all the classpath for public class A. There must be more than one. So jvm unable to decide which class A to take.

    Srinivas.J
  5. Try setting the classpath, give the classpath as your current directory.
  6. Thanx

    i could make it anyhow.

    Actually u have to compile both class at a time then only u will be able to create an instance of another class.

    Thank you very much for ur cooperation

    Niraj