Search code examples
javaeclipsejarlibgdx

How to export a java project from eclipse that contains all libraries required to compile?


For a project I completed a game in Java on Eclipse using LibGDX. I now need to turn in the source code to my professor. When I export the project and try opening it on a new computer, about a dozen libraries are missing.

I would like to export my entire project so that when the project is opened in eclipse, it will still compile. Is there any way to do this? I know that runnable jars come with the .jar files of the dependencies and no source code, but I need both.

Thanks in advance


Solution

  • Libgdx required number of dependent jars so it's hard to manually add all jars into project.

    Make your project gradle based so that When you import your project through gradle into another System then gradle do most of your task* for you.

    *gradle try to find dependent jars in file system if already exist then link with your project if not then it download from given repository and link them in your project. Make sure your system is connected with internet when you build your project.

    I highly encourage to use Android Studio or IntelliJIDEA.

    On window, by default all jars are stored inside

    C:\Users\User_name\.gradle\caches\modules-2\files-2.1
    

    In Mac OSX

    /Users/User_name/.gradle/caches/modules-2/files-2.1
    

    When you want to deploy or packaging for the desktop run this command on your IDE terminal.

    gradlew desktop:dist