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 ]
posted 9 years ago
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.