This week's book giveaway is in the OCAJP 8 forum. We're giving away four copies of OCA Java SE 8 Programmer I Study Guide and have Edward Finegan & Robert Liguori on-line! See this thread for details.
My colleagues at work use an app written in Java. They'd like it modified in various ways - to show yellow lines here, some extra image processing there, respond to some mouse events that are currently ignored, etc. All we have are .jar files, no source. I asked the software provider, but they said nothing about source.
Is it a reasonable idea take on this project, or should i join the next cattle drive out of town? How would i go about modifying this app? Is it possible to modify a .jar, or is that something extreme no sane person would consider? A bytecode disassembler? Figure out the interface to a class and write my own replacement .jar files?
I'm many years experienced at programming in C++, assembly, raw binary blinking LEDs, expert at number crunching, graphics programming and all, and don't mind digging around at a low level. But i'm no expert at Java yet, need a cheat sheet to write HelloWorld ;-)
BTW, i love this site! Great design, well organized, a pleasure to visit.
If you can get source from the vendor, that is definitely the way to go. It is also the best way to avoid complications, such as law suits. Or discontinuation of any support.
If you can't, you can get a decompiler to generate source code from byte codes, but... obfuscation is a possibility too. The vendor could have used an obfuscator on the bytecode to make it decompile to a mess -- assuming that it even works.
It also may be possible to make the changes without modifying the source at all, but rather just replacing one or more of their classes with your own and/or adding classes.
For example, you can subclass existing classes and add behavior, or you can add event listeners onto existing GUI components. You can even use "bytecode engineering" to add behavior or modify existing behavior on the fly, either directly, or indirectly through the use of Aspect-Oriented Programming (AOP).
Doing any of these will take a certain amount of reverse engineering, and you may need to use a combination of techniques. But the decompile-modify-recompile angle is only one possibility, and not even necessarily the best one.
Now, you've posted this in the "Beginner's" forum, and say you're not a Java expert; unfortunately, I'm talking about some stuff that, while not necessarily advanced, required a good grasp of the lay of Java-land. Of course, we're always here to help.
The software in question is freely available. It's used by scientists working with the Spitzer space telescope. It just needs a couple enhancements...
The idea of replacing a few chosen classes with my own might be the way to go. I might need to see a good example of how to do that in general. Reverse engineering is one of my better skills, and i've not dug into the workings of java very far yet, so this will be fun.