File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Swing / AWT / SWT and the fly likes Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » Java » Swing / AWT / SWT
Bookmark ""reverse engineered" package name?" Watch ""reverse engineered" package name?" New topic
Author

"reverse engineered" package name?

Tom Corcoran
Greenhorn

Joined: Oct 11, 2006
Posts: 8
My goal is to start using JDemo so I can preview Jdialogs. I am using IntelliJ IDEA 5.1.2

The project I have inherited has one jar file with no package name. I want to add a package name to it so I can refer to the JDialogs in my Demo app. I am not in a position to change the directory structure of the code which is stored in a path like :
C:\Product\Version\Component\JavaApplet\src. I know the package name normally follows the directory hierarchy, but I'm not sure where one starts from (root) and I haven't been able to choose anything that is recognised.
[
C:\Product\Version\Component\JavaApplet\classes\myapplet.jar is added to the classpath.

I'm not concerned about prefixing the name with the reverse domain name as it will not be distributed. My only goal is to have a package name so I can use the JDialogs in JDemo. What is my "reverse engineered" package name? [Note I use this in quotes as I have full access to the code and want to put in the package name myself, but how not sure what's allowed as the name given the consraints of the existing stucture.]
[ October 11, 2006: Message edited by: Tom Corcoran ]
Martin Simons
Ranch Hand

Joined: Mar 02, 2006
Posts: 196
You can't change the package name on an already compiled class. You will need to take the source code that this jar was created from, factor in the approriate package in each of the java files, recompile it, and repackage the jar. After that, the jar can be placed in the same place it always was, because the directory structure representing the packages is contained within the jar itself, and not in the directory path leading to the jarfile.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: "reverse engineered" package name?