How to run source code downloaded from github

26,456

Solution 1

This is a maven and ant project, you need to download and install maven : https://maven.apache.org/

And download and install ant: http://ant.apache.org/

The build.xml file is the configuration for ant The pom.xml is the configuration for maven

Look inside the ant.xml, you will find "<target ..." elements. For example one target is build, to run it just opent a commande line and :

ant build

Solution 2

You have to import the Project!

  1. From the main menu bar, select command link File > Import.... The Import wizard opens.

  2. Select General > Existing Project into Workspace and click Next.

  3. Choose either Select root directory or Select archive file and click the associated Browse to locate the directory or file containing the projects.

  4. Under Projects select the project or projects which you would like to import.

  5. Click Finish to start the import.

help.eclipse

Share:
26,456
Shady Programmer
Author by

Shady Programmer

Updated on February 01, 2020

Comments

  • Shady Programmer
    Shady Programmer over 4 years

    This is getting quite frustrating lately as I've downloaded various source codes for various programs from github and I don't know how to build them or run them. Now mind you, I'm not new to programming but this particular area of not knowing how to get things started when I get someones project files is absolutely killing me. What I have is this:

    Source files

    What am I supposed to do now to build and run one of their examples ?

    Before anyone starts hatin' on me for that question:

    I've read the manual that was attached with these files and it gives general overview of what can be found in the folders and so on but they don't specify how to build it. Also I have eclipse for Java set up and tried to import these files as a project but eclipse rejected and said that no project can be found. I tried running individual java files but couldn't get them to compile because there was no "ant file" ( what is going on ? ) Later on I found something which I think was that ant file and opened it in conjunction with the file I wanted to run but no success.

  • Shady Programmer
    Shady Programmer over 8 years
    That's exactly what I've done and No projects show up under "project select"
  • FlowX
    FlowX over 8 years
  • Shady Programmer
    Shady Programmer over 8 years
    Okay, I've succesfully installed maven and ant. I've opened cmd window in the folder and ran the command ant build. A lot happened with few warning but the overall consensus was "Build successful" but I don't see anything changed or created in the folder, what's going on and how do I actually run something ?
  • Julien Revault d'A...
    Julien Revault d'A... over 8 years
    Once the build is successful, you'll find the built binary inside the lib folder : lib/jgraphx.jar
  • Julien Revault d'A...
    Julien Revault d'A... over 8 years
    just in case : jgraphx is a library, it's not a software you can launch to create diagrams. You use is by adding the built jar inside your java project andthen you use the API to create your diagrams (or diagram creator), you can see examples here github.com/jgraph/jgraphx/tree/master/examples/com/mxgraph/…
  • Shady Programmer
    Shady Programmer over 8 years
    Even though ant said that build was successful there was nothing created so I've built it with Maven which created "target" folder and actually built the files. I know that jgraphx is a library and I'm trying to run exactly the HelloWorld example that is in your link. So should I go to project properties > Java Build path add my jar and then open the HelloWorld.java example file in my project, will that be enough or do I need add any other files as well as HelloWorld.java ?
  • Shady Programmer
    Shady Programmer over 8 years
    Just tested it. IT WORKS! IT'S ALIVE! I'M SO HAPPY! THANK YOU!