• 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

Java package problem with package.*

 
Ranch Hand
Posts: 130
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 128
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 128
Hibernate Eclipse IDE Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • 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: 79067
376
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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.
 
reply
    Bookmark Topic Watch Topic
  • New Topic