Hello all. I'm using JBuilder 5.0 and have a question about how to repackage a bunch of classes that exist in several projects. Due to some company imposed mandates, I've got to repackage the Java classes in several projects from com.xxx to com.xxx.xxx (not actually 'xxx', just an example.) In other words, I've got to add another 'node' to the package name. I know that I'll have to change the package name in each Java class and recompile, but when I do JBuilder complains: "MyCode.java": Error #: 901 : package com.xxx.xxx stated in source c:\Documents and Settings\rlc1234\jbproject\MyNewProject\src\com\xx\MyCode.java does not match directory com.xxx I could probably shut JBuilder down and manually create all new directories under the existing src and classes directories within each project, then move each .java file, but I was hoping there was a better way. Any suggestions? Thanks, Rick <>< [ January 25, 2002: Message edited by: Rick Crawford ]
There is a much better way in JBuilder 6. It has introduced 'refactoring' wizards, one of which is a repackaging wizard.
I've found the only way to do this in JBuilder 5 is to either go direct to my file system and ignore JBuilder (you don't have to exit it, you just hit Refresh on the file browser, and it will pick up your file system changes), or...
You can right click a file in the browser and select 'rename'.
Then save the file in a new directory (ie: package). Manually change the package name at the top of the file, it's NOT automatic Then rebuild.
One thing to watch for: If you have two or more files that 'assume' they are in the same package ,and you don't import one into the other, you'll find that rebuilding half way through this repackaging exercise will cause big-time compile errors.
Which brings up the last point, and that is to make sure you also retype any and all imports (or god forbid, any lines like: If you've done this in any of your classes, such that a simple replace of the import statement won't catch all the instances, I'd start thinking Perl script running against the files, as JBuilder isn't so hot at doing multi-file search and replace.
Mike, Thanks so much for the response. What you recommended is precisely what I ended up doing to get my code converted. What a pain! I'm glad to hear there's a more automatic way to accomplish this in JBuilder 6. I sincerely appreciate the help. Rick <><
incandescent light gives off an efficient form of heat. You must be THIS smart to ride this ride. Tiny ad: