• 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:
  • Tim Cooke
  • Campbell Ritchie
  • Ron McLeod
  • Liutauras Vilda
  • Jeanne Boyarsky
Sheriffs:
  • Junilu Lacar
  • Rob Spoor
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Tim Moores
  • Jesse Silverman
  • Stephan van Hulst
  • Carey Brown
Bartenders:
  • Al Hobbs
  • Piet Souris
  • Frits Walraven

packages and compilation problem

 
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
my project have a package and i have two java files

1. abstractcheck.java



and the 2. myabstract2.java



now as utility class (which is in myabstract2.java,non-public )is in package pkcheck, so that should be accessible in abstractcheck.java, bevause both are in same package, however this runs well in netbeans, but when i run it from command prompt, then it says cannot find symbol, utility and other non-public classes. what may be the problem..please help!!

i tried even classpath flag also...
 
Marshal
Posts: 74602
335
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Try compiling all the classes together with javac -d . *.java or javac pkcheck/*.java
Otherwise compile the dependency classes before you compile the client classes.
 
abhishek kunal
Ranch Hand
Posts: 42
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thank you very much!! ..it works,now i have another problem, would you suggest me??

now i created another package in pkcheck package and in that package i have one java file,utility2.java , package name is another, now i want to compile all the classes directly in pkcheck package and in all of it's subpackages , here another...

obviously i will run javac from the parent directory of pkcheck and i want classes to be stored in same directory(package) structure in some other directory..so i thought...this command should work...

javac pkcheck/*/*.java , but that didn't work anyway....so please tell the correct command for that..i used other combination's as well....
 
Campbell Ritchie
Marshal
Posts: 74602
335
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Too busy for a lengthy answer at the moment. Sorry.
Please do a search for "package" and "compile", particularly my posts. I write about that sort of thing quite frequently. You may need to move onto "ant" if you have that sort of package structure.
 
Campbell Ritchie
Marshal
Posts: 74602
335
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Have look at this post from last week and the older links I posted there. That should help you; as I said this is quite a frequent question.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic