On 09/04/14 13:18, Markus Krötzsch wrote:
Hi Denny, hi Daniel, hi all,
Welcome to Java :-) (more useful answers below)
Following popular demand ;-), I have now created a new documentation section "Beginner's guide" [1] that takes you step-by-step through setting up your very first Maven project in Eclipse and configuring it to use Wikidata Toolkit.
A relevant remark that had been missing on the documentation pages is that you really must use Java 1.7 or above. Probably a no-brainer for most users today, but annoying if you happen to run on older Java versions (which won't make sense of the code without being able to tell you the real reason).
Cheers,
Markus
[1] https://www.mediawiki.org/wiki/Wikidata_Toolkit#Beginner.27s_guide
On 09/04/14 10:41, Daniel Kinzler wrote:
Am 08.04.2014 23:34, schrieb Denny Vrandečić:
I was trying to use this, but my Java is a bit rusty. How do I run the DumpProcessingExample?
I did the following steps:
git clone https://github.com/Wikidata/Wikidata-Toolkit cd Wikidata-Toolkit mvn install mvn test
Now, how do I start DumpProcessingExample?
Looks like you are supposed to run it from Eclipse.
It would be very useful if maven would generate a jar with all dependencies for the examples, or if there was a shell script that would allow us to run classes without the need to specify the full class path.
Finding out how to get all the libs you need into the classpath is one of the major annoyances of java...
First, the quick answer to Denny:
""" Change to the directory of the example module (wdtk-examples), then run:
mvn exec:java -Dexec.mainClass="org.wikidata.wdtk.examples.DumpProcessingExample" """
Anyway, this is not something one would normally do. Some clarifications seem to be needed here.
The examples we have are not applications that you would ever want to run. They don't do anything really useful (yet). The purpose of the examples is to give Java developers a practical, well, example on how to use the Wikidata Toolkit library. Since Wikidata Toolkit is a library for Java, it is somehow presumed that you already know how to run a Java application when you look into it ;-) Normally, every Java developer has some preferred way in which she will normally do this, usually through her IDE.
If you are new to Java, I would recommend you to start with a little tutorial (there are plenty on the Web) and to use Eclipse (there are other good IDEs for Java, but Eclipse is a safe bet if you don't know your needs yet). We have detailed instructions on the homepage how to install git and maven support for Eclipse so that it can do everything for you [1]. An Eclipse user could run the examples, for example, by: right click on file -> Run as -> Java application.
The "major annoyance" that Daniel remarked on is simply that there is no single main application here. There can (and will) be many examples, so naturally you have to tell Java which program to run. Doing this on the command line is not convenient due to the long strings, but then again that is not something you would normally do (and if you do, you could create a one-line script with the command I gave above ;-).
In the future, we might have actual applications that are useful as stand-alone tools. When this happens, we will of course provide suitable stand-alone packages where you only need to run a single "main" file to start the tool. This is also what people would do who use the library to develop their own stand-alone applications. But if you want to work with a multi-module library, you probably don't want an all-in-one package that uses third party dependencies that you don't want or need.
Anyway, all hints on packaging are really appreciated -- our goal is to provide packages that are most useful to you. We just started with the obvious standard packages but we could create more specific bundles for relevant applications. As we move along in alpha phase, these things might still change quite a bit, of course ... ;-)
Cheers
Markus
[1] https://www.mediawiki.org/wiki/Wikidata_Toolkit/Eclipse_setup
-- daniel