File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes removed package signature.. now the code won't run! Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "removed package signature.. now the code won Watch "removed package signature.. now the code won New topic

removed package signature.. now the code won't run!

Tyrone Chandler

Joined: Dec 05, 2003
Posts: 4
Hi -
I downloaded some example code from a zip online. I noticed that there were package signatures on all the files... ie there was package whatever.whatever on the first line of each class file. I took them out and then compiled it, the GUI pop up but now none of the functionality runs! I get a lot of exception messages, starting with how data was imported into the GUI.
Is it not possible to run code once a package signature has been put into it?? Can anyone exlain this and tell me why that is? And if you know how to work around it, that would be a great help.
Dirk Schreckmann

Joined: Dec 10, 2001
Posts: 7023
Welcome to JavaRanch, Tyrone!
It's possible to take a Java application with packages, and edit it to remove those packages, and have it still work. You'd have to not just remove package declaration statements, but you'd also likely have to remove a few import statements, as well as any other bits of code that attempt to use an orignial class's fully qualified name.
Of course, you might run into situations where two of the original classes then have the same name. So, you'd have to rename one, locate all references to it, and change those as well.
Of course, if this is all just to avoid learning how packages work, then your time may well be better spent learning 'em.
Good luck.

[How To Ask Good Questions] [JavaRanch FAQ Wiki] [JavaRanch Radio]
I agree. Here's the link:
subject: removed package signature.. now the code won't run!
jQuery in Action, 3rd edition