This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
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: 18876

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)
GeeCON Prague 2014
subject: Class And Package