aspose file tools*
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: 19064
    
  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)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Class And Package