Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Modifying Existing App w/o src

 
Daren Wilson
Greenhorn
Posts: 16
Eclipse IDE Linux Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Henry Wong
author
Marshal
Pie
Posts: 20997
76
C++ Chrome Eclipse IDE Firefox Browser Java jQuery Linux VI Editor Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.

Henry
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24208
35
Chrome Eclipse IDE Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Daren Wilson
Greenhorn
Posts: 16
Eclipse IDE Linux Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Don't get me started about those stupid light bulbs.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic