Do I *have* to compile, or can I use .java files?

Discussion in 'Plugin Development' started by weepingboil, Jul 3, 2011.

Thread Status:
Not open for further replies.
  1. Offline


    I'm using a couple of plugins which are mostly brilliant - but I want to change a couple of lines of code to change functionality a bit - strictly for my own server and not to reditribute.
    I don't want to install all the bits and pieces required to recompile these plugins (I think I would have to install Ice, Mavern, the Bukkit API etc)
    So ... Is it possible to put just .java files into the .jar and get it to work? I tried renaming the .java files to .class but I got an "Incompatible magic value" error in the server console.
    Any help would be greatly appreciated.
    (I mostly work in c# - I'm completely new to java - and I don't want to clutter my machine up with other languages/environments if you see what I mean? Please don't yell at me if I'm being stoopid!)
  2. Offline


    You need to decompile the plugin JAR and then recompile.
  3. .java-files = text format that humen can understand
    .class-files = binary format that the computer (the JRE) can understand

    Yes, you need to compile stuff to get it to work.

    You don't necessarily have to install a complete IDE like Eclipse, but the JDK and the bukkit-api to compile against are required.
  4. Offline


    As Kaikz said, the only way is to get the open source project and install the addons to compile or if it is close sourced you can decompile/reverse engineer it using some tool.
  5. Offline


    @Bone008 - Ok - I understand. Thanks!
    I've got the JDK (reluctantly!) and I'll download the bukkit-api. Are you able to tell me the command line for javac I would need to put it all together?
  6. Offline


    eclipse is portable
  7. @weepingboil Not sure, I never used javac to build against a jar.
    It could possibly be that:
    javac -cp <path-to-your-bukkit-api>/bukkit.jar <space-seperated-list-of-your-source-files>
    I've no idea if bukkit.jar would be the classpath. Try google, it should help you.
  8. Offline


    And you'd need to use the jar command to get a jar from the .class files.
  9. Offline


    easiest would be to download Eclipse, no install needed, just extract, and it's only around 60MB i think?
Thread Status:
Not open for further replies.

Share This Page