-8

Basically, I'm looking to find out how to apply Java patch files using Java. So, to sum that up, I need Java code to apply a patch file to a java source file. Cheers!

Nizam
  • 4,569
  • 3
  • 43
  • 60
  • Are you trying to apply a diff to a java source file, or patching a compiled program by adding the patch to the classpath? – Peter Lawrey Aug 07 '14 at 21:58
  • Patching a compiled program by adding the patch to the classpath, however, I am curious on how to apply a diff to a java source file, so I would appreciate if you explained both to me. Thanks! – ConnorDevelopment Aug 07 '14 at 22:00
  • To add a patch to a compiled program, you put the patch first in the classpath, this will override any existing classes. To apply a patch using diff, I suggest you read the manual for diff (or get your IDE to do it, which is what I do now) – Peter Lawrey Aug 07 '14 at 22:05

1 Answers1

0

There are many ways to extend functionality of the already developed Java application.

You can for example use external non-runnable *.jar files with some extra classes. To do so, you have to first implement proper "uploading" functions in your app, e.g. by using custom ClassPath objects, which is nicely described here, or you can try to use multi URLClassLoaders, which is described here.

There is also another approach, which allows you to call external methods in form of a String, but I haven't tested it yet, altough you can read about it here.

Community
  • 1
  • 1
bluevoxel
  • 4,978
  • 11
  • 45
  • 63