Results 1 to 5 of 5
  1. #1
    stampa is offline Member
    Join Date
    May 2011
    Posts
    5
    Rep Power
    0

    Default problem with package

    I m using these two files hello.java helloimpl.java in a directory named pkgtest.However when i m compiling helloimpl.java it gives me a compilation error.I m using package statement at the top of the files however if i dont use package statement then code works fine.its really bugging me whts wrong??

    code for hello.java


    package pkgtest;
    import java.io.*;

    public class hello{

    public void SayHello()
    {
    System.out.println("hello world");
    }
    }


    /* code for helloimpl.java */


    package pkgtest;

    import java.io.*;

    class helloimpl{

    public static void main(String args[])
    {
    hello hi = new hello();
    hi.SayHello();
    }
    }

  2. #2
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,902
    Rep Power
    25

    Default

    How are you compiling the programs? Does the classpath point to the folder containing the pkgtest folder?

  3. #3
    stampa is offline Member
    Join Date
    May 2011
    Posts
    5
    Rep Power
    0

    Default

    yeah i m giving class path in the compiltation as
    javac -classpath /user/home/myname/pkgtest/

    pkgtest is the directory in which the code files are

  4. #4
    Norm's Avatar
    Norm is offline Moderator
    Join Date
    Jun 2008
    Location
    Eastern Florida
    Posts
    17,902
    Rep Power
    25

    Default

    Did you read my post?
    Does the classpath point to the folder containing the pkgtest folder?

  5. #5
    stampa is offline Member
    Join Date
    May 2011
    Posts
    5
    Rep Power
    0

    Default

    srry!!! yeah i compile it using javac -classpath /user/home/myname/
    yeah thanx I got it!!!!! i was filling the second argument to javac incorrect..

Similar Threads

  1. a problem with package
    By saolion in forum NetBeans
    Replies: 0
    Last Post: 05-03-2011, 01:17 PM
  2. Eclipse package problem
    By Ratul in forum Eclipse
    Replies: 0
    Last Post: 02-15-2011, 09:03 PM
  3. Package problem
    By Vizualni in forum New To Java
    Replies: 4
    Last Post: 08-30-2010, 12:48 PM
  4. Client to Server, ClassNotFound Package Problem
    By pwnzer in forum New To Java
    Replies: 3
    Last Post: 11-07-2009, 10:17 PM
  5. Problem With Package
    By acp26b in forum New To Java
    Replies: 3
    Last Post: 07-14-2008, 06:58 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •