8

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
  • 794
  • 4
  • 9
  • 22
  • try importing this project in android studio, or idea intellij or eclipse – thedarkpassenger Jan 31 '16 at 20:45
  • 1
    What is confusing about your screenshot is that your project appears to have a build file for both ANT (build.xml) and also Maven (pom.xml). Without knowing which project you're working on all you can expect is some generic advice to install the both build tools and see what happens – Mark O'Connor Feb 01 '16 at 00:38
  • after reading the answer below here I've tried building with ant which said "Build succesfull" but haven't built anything, then I ran Maven command to build it and it has actually built files so I GUESS it's maven project. I'm stuck now and don't know how to run examples though. – Shady Programmer Feb 01 '16 at 11:34
  • http://cathyreisenwitz.com/wp-content/uploads/2016/01/no.jpg – Shady Programmer Feb 01 '16 at 11:35

2 Answers2

3

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
  • 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 ? – Shady Programmer Jan 31 '16 at 21:54
  • 1
    Once the build is successful, you'll find the built binary inside the lib folder : lib/jgraphx.jar – Julien Revault d'A... Feb 01 '16 at 06:26
  • 1
    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 https://github.com/jgraph/jgraphx/tree/master/examples/com/mxgraph/examples/swing – Julien Revault d'A... Feb 01 '16 at 06:29
  • 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 Feb 01 '16 at 11:30
1

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

FlowX
  • 102
  • 12