Meaningless Drivel is fun!*
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
Author

Class And Package

Manoj G S
Greenhorn

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

Joined: Sep 28, 2004
Posts: 18526
    
  40

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.

Henry


Books: Java Threads, 3rd Edition, Jini in a Nutshell, and Java Gems (contributor)
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Class And Package
 
Similar Threads
Running a java class with -cp parameter
access modifiers and inheritance
"The use of the default package is discouraged." Should I worry?
Tomcat 4.11 doubt
servlet error building