This week's book giveaway is in the Python forum.
We're giving away four copies of Python Continuous Integration and Delivery and have Moritz Lenz on-line!
See this thread for details.
Win a copy of Python Continuous Integration and Delivery this week in the Python forum!
  • 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Bear Bibeault
  • Paul Clapham
  • Jeanne Boyarsky
Sheriffs:
  • Devaka Cooray
  • Junilu Lacar
  • Tim Cooke
Saloon Keepers:
  • Tim Moores
  • Ron McLeod
  • Tim Holloway
  • Claude Moore
  • Stephan van Hulst
Bartenders:
  • Winston Gutkowski
  • Carey Brown
  • Frits Walraven

finding packages  RSS feed

 
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
how to list all the packages in my class path using a java program?


for eg. if the class path is c:\ajay;
and ajay contains two folders pack1(i.e a package) and pack2(i.e a general folder not a package)

in pack1 there are 2 java file which has package pack1; as their first statement.

in pack2 there are two java file which does not contain package statement.

so can i identify between pack1 which is a package and pack2 which is a general folder
 
Ranch Hand
Posts: 1923
Linux Postgres Database Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Both aren't packages, because the class-file has to be in a certain folder, not the java file.
 
Rajagopal Manohar
Ranch Hand
Posts: 183
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
sorry i meant class files not java files my mistake

but what i want to know is,how to differentiate between a package and an ordinary folder

what i want to do is to list all the class files in a particular folder(path)say D:\ and i have a package in D:\ called test then i should be able to list all the classes in path which includes test package such as test.Test now how do i know that test is an package and not a folder
[ November 28, 2004: Message edited by: Rajagopal Manohar ]
 
And when my army is complete, I will rule the world! But, for now, I'm going to be happy with this tiny ad:
Become a Java guru with IntelliJ IDEA
https://www.jetbrains.com/idea/
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!