File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Class And Package Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Class And Package" Watch "Class And Package" New topic

Class And Package

Manoj G S

Joined: Feb 03, 2008
Posts: 1
How to find in which Package a .class file belongs
Henry Wong

Joined: Sep 28, 2004
Posts: 20355

Originally posted by Manoj G S:
How to find in which Package a .class file belongs

Have you simply tried it? If you have a .class file (say A.class), and you don't know what package it is in... have you just tried "java -cp . A"? If the A.class file is not in the default package, the class loader should complain about the name being wrong. It will also give you the wrong name -- which includes the package.


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
I agree. Here's the link:
subject: Class And Package
It's not a secret anymore!