wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes package problem (Urgent !!!!!) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "package problem (Urgent !!!!!)" Watch "package problem (Urgent !!!!!)" New topic
Author

package problem (Urgent !!!!!)

padmshree Patil
Ranch Hand

Joined: Dec 18, 2000
Posts: 54
Hi All,
I am facing problem in packaging .
I have file testClass.java as
package java.first;
public class TestClass {
public void testShow(String str)
{ System.out.println (str);
}
}
and PackageTest file as
package MyPrgs.java;
import java.first.*;
public class PackageTest{
public static void main(String arg[])
{
System.out.println("Before calling Test funcion");
TestClass tc =new TestClass();
tc.testShow( "Testing from main");
System.out.println("After calling Test funcion");
}
}
TestClass.java file is compliling .But PackageTest.java file is giving err at
import java.first.*; as package java.first not found.
I do have correct directory structure.
Where am I wroung ?
Thanks
padmashree

Bosun Bello
Ranch Hand

Joined: Nov 06, 2000
Posts: 1510
Try naming the first part of your package something else instead of "java" and see if that works. Since you said you do have the correct directory structure, that'a the only thing I can think of.
Bosun


Bosun (SCJP, SCWCD)
So much trouble in the world -- Bob Marley
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
So you have a directory structure
c:JavaHome\java\first\
c:JavaHome\myprgs\java
and JavaHome is in your path - correct?

"JavaRanch, where the deer and the Certified play" - David O'Meara
padmshree Patil
Ranch Hand

Joined: Dec 18, 2000
Posts: 54
Hi,
I have set path to javahome. It's strange that if I copy PacakegeTest.java to root dir (c:\)
and then try to compile it works .It also runs.
I just comented package statement.
// package Myprgs.java;
import Myprgs.java.first.*;

class PackageTest{

public static void main(String arg[])
{
System.out.println("Before calling Test funcion");
TestClass tc =new TestClass();
tc.testShow( "Testing from main");
System.out.println("After calling Test funcion");

}
}

same file if I move to c:/ Myprgs/java dir ,then try to compile it gives err !!
TestClass.java is in
c:/Myprgs/java/first/ dir
What's wroung with this ???
Thanks,
padmashree
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: package problem (Urgent !!!!!)