• Post Reply Bookmark Topic Watch Topic
  • New Topic

Java package problem with package.*  RSS feed

 
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have created two files


_______________and_________________




everything is working fine but i found that when i am putting import "import packing1.*;" in place of "import packing1.Hi; " compiler shows error , why ???

* 1 day ago
* - 1 week left to answer.

Additional Details
error is

"C:\>javac Hello.java
Hello.java:12: cannot find symbol
symbol : method disp()
location: class Hi
h.disp();"
^
 
Ranch Hand
Posts: 71
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have tried your code, both using and it works fine.
Can you please give the details how you ran the program maybe i can be able to see where you went wrong.

 
abhay jain
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i am running my program through command line (DOS)
by

javac filename.java


and writing source code in notepad
 
Joseph Mokenela
Ranch Hand
Posts: 71
Eclipse IDE Hibernate Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
create a folder named packing1 and put Hi.java inside this folder, then outside the folder packing1 put Hello.java, compile Hi.java first and then compile Hello.java

It should work.

Good Luck.
 
abhay jain
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
@Joseph Mokenela

did the same and it works but strange thing is that sometime it works, some times not , why ? .......... anyway Thanks for your reply
 
Marshal
Posts: 56600
172
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to tell us more than "sometimes it doesn't work". There are lots of possible reasons for that, a minor spelling error being one of the commonest. Please give us the details so we can get this sorted out properly.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!