Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

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 ]
 
You didn't tell me he was so big. Unlike this tiny ad:
Rocket Oven Kickstarter - from the trailboss
https://coderanch.com/t/695773/Rocket-Oven-Kickstarter-trailboss
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!