-1

I have a .jar library and used 7-zip to extract the files and edit the .java source code inside. I need to be able to build this to update the .class files before I turn it back into a .jar.

The library won't build as it's missing dependencies, but I don't know how to add these. The library's using JNI, and LibGDX, and as an amateur, I am out of my depth on this problem that I am stuck on.

The original .jar file is in the link below https://github.com/finnstr/gdx-liquidfun-extension/blob/master/libs/gdx-liquidfun.jar

  • read [Creating a jar File in Eclipse](https://www.cs.utexas.edu/~scottm/cs307/handouts/Eclipse%20Help/jarInEclipse.htm). – DimaSan Oct 03 '16 at 19:41
  • Do you *have* the dependencies? Getting them is an essential first step. Then when you compile, make sure they are included in the classpath. – John Bollinger Oct 03 '16 at 19:41
  • 1
    More generally, however, if you do not know how to do this then indeed you probably are out of your depth. In that case, it seems ... optimistic ... that you think you can modify the library as you intend without breaking anything. – John Bollinger Oct 03 '16 at 19:44
  • I don't know if I have them. I have used the library in another program, and it runs fine - does this mean that I have them? What am I looking for to find the dependencies? I only need to edit a small part of the code, it shouldn't break. – Sam_throwaway Oct 03 '16 at 19:46
  • John is fully correct: your jobs requires you to do A, B, C. When you think that B, C are completely impossible for you ... well, then it wont work. There are no detours; if you want to work on that thing, then you need to learn **all** the things that belong to that task. – GhostCat Oct 03 '16 at 19:46
  • @Sam_throwaway Typically dependencies are somehow described; for example in terms of **maven** instructions. Or as simple text explaining what is required. – GhostCat Oct 03 '16 at 19:46
  • @GhostCat, I'm not trying to find detours, and I want to learn everything related to this task. The problem is I don't know where to start. – Sam_throwaway Oct 03 '16 at 19:54

1 Answers1

0

Download following 2 JARs and add them to the build path of your Eclipse project. If you're not using Eclipse then add them to classpath, however it will be a lot easier to do with Eclipse.

http://mvnrepository.com/artifact/com.badlogicgames.gdx/gdx/1.5.2 http://mvnrepository.com/artifact/com.badlogicgames.gdx/gdx-jnigen/1.5.2

I have included older version from 2014, as the source code that in the git for liquidfun is using some older version of classes which are not available in new version of above JARs.

Eclipse has an option to export project as a JAR file. Use that and you're done.

If you're using plain Java then you'll have to compile all directories one by one (Java: How can I compile an entire directory structure of code ?)

Community
  • 1
  • 1
11thdimension
  • 10,333
  • 4
  • 33
  • 71
  • Thank you for your answer. I haven't managed to get it working. The method "doTest()" isn't recognised when I include the library in my main project. See the link below for a screen shot of Eclipse. I've edited ParticleSystem.java, but when I build, I don't think it's updating ParticleSystem.class. I've tried building just ParticleSystem.java using cmd and javac, but I get errors. http://tinypic.com/r/9tpqx1/9 – Sam_throwaway Oct 03 '16 at 21:07
  • I can't see `doTest()` method. Is this something that you have added ? – 11thdimension Oct 03 '16 at 21:13
  • It is, if you look at the picture, it's been added near the bottom of the screen. I've turned the library back into a .jar, and doTest() isn't recognised when I try to call it from my main project. I've also used a decompiler on ParticleSystem.class to check if doTest() has been put into there, and it hasn't. Any suggestions? – Sam_throwaway Oct 03 '16 at 22:11