Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feedback for /docs/quarks/samples/ #45

Open
chanskw opened this issue Mar 3, 2016 · 2 comments
Open

Feedback for /docs/quarks/samples/ #45

chanskw opened this issue Mar 3, 2016 · 2 comments

Comments

@chanskw
Copy link
Collaborator

chanskw commented Mar 3, 2016

I'd like to open a sample, edit it, build and run on my own.

Is there documentation on how to do this? Is there ant scripts too run? If so, where are they? Do I have to construct the javac command and figure out the class path?

@chanskw
Copy link
Collaborator Author

chanskw commented Mar 3, 2016

Can I pick individual sample, build and run?

@home4slc
Copy link

home4slc commented Mar 3, 2016

@chanskw which sample are you thinking of editing, and how are you planning to run it? From Eclipse, or from the command line?

In general this is what I do when I want to edit a sample to get a better understanding of how to use it.
Let's take DevelopmentMetricsSample as an example. Currently due to quarks-edge issue #86 (quarks-edge/quarks#86) I'm having trouble running the examples in Eclipse as well. I'll tell you how I do it when I run from the command line, and what used to work from Eclipse. Hopefully we will be able to run from Eclipse soon.

Command line:
Edit the java file with your changes. At first I would not add new classes, so you know that build.xml will work.
From the top level quarks directory run these ant commands:
ant clean
ant

This will build all the api classes, examples, generate javadoc and create console.war which is needed for any application that embeds the console.

Now, from the top level 'quarks' directory find where the jar file for the samples, for the topology package is. Here is where mine was found:
Susans-MacBook-Pro-247:quarks susancline$ find . -name quarks.samples.topology.jar -print ./target/java8/samples/lib/quarks.samples.topology.jar
Which makes my java command appear like this:

quarks susancline$ java -cp target/java8/samples/lib/quarks.samples.topology.jar quarks.samples.topology.DevelopmentMetricsSample
Mar 03, 2016 10:02:39 AM org.eclipse.jetty.util.log.Log initialized
INFO: Logging initialized @173ms
Mar 03, 2016 10:02:39 AM org.eclipse.jetty.server.Server doStart
INFO: jetty-9.3.6.v20151106
...
If Eclipse was working correctly, this is what I used to do:
Eclipse:

  1. Open the file under samples directory, then navigate to the package quarks.samples.topology package, under the topology/src/main/java folder.
  2. Change something minor in the file, at first I would not add a new class, so you know that the required classes are referenced properly in build.xml.
  3. Now go to the samples/topology folder. You should see a build.xml file under that. Right-click and select Run As --> Ant Build.
  4. Now go back to the DevelopmentMetricsSample.java file and right click and select Run As --> Java Application.

If you want to add new classes from packages that are not referenced in build.xml, then you will need to edit the appropriate build.xml file to add them so your class compiles and the associated jar file will be usable.

If I've missed anything, or someone else has comments please chime in.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants