= Build and run a sample app in Eclipse = == Overview == Now that you have a collection of sample apps in Eclipse, here you'll learn how to build one of the sample apps called ''sample-create-network-view'' and run it in Cytoscape. == Process == === 1. Build a sample app === A. In the ''Package Explorer'' panel on the top-left, click to expand the ''cytoscape-samples'' folder. A. Click to expand the ''sample-create-network-view'' folder. A. Right-click (or control-click if you're on a Mac) on the ''pom.xml'' file. A. Select ''Run As''. A. Then select ''Maven install''. {{attachment:run-mvn-install.png}} <
> <
> <
> <
> <
> When Maven finishes building the app, you will see the ''Build success'' message in the Console tab, located at the bottom-center of Eclipse. {{attachment:build-success.png}} === 2. Install the app === Once the build finishes, open the ''target'' folder that's located directly above the ''pom.xml'' file. Inside you'll see the file ''sample-create-network-view-1.0.jar''. This jar file is your newly built app. To install the app, first open the ''!CytoscapeConfiguration'' folder. /!\ You will need to have run Cytoscape at least once beforehand. ||'''If you're on a...'''||'''Do this to open !CytoscapeConfiguration'''|| ||Mac||Go to the Finder, then in the ''Go'' menu choose ''Home''. You will find the ''!CytoscapeConfiguration'' folder inside your home folder.|| ||Windows||In Windows Explorer, go to `C:\Users\Your-User-Name`. You will find the ''!CytoscapeConfiguration'' directory inside there.|| ||Linux GNOME 3||In the GNOME Files application, click on the ''Home'' tab on the left. You will find ''!CytoscapeConfiguration'' inside there.|| Now that you have the ''!CytoscapeConfiguration'' open, open ''3'', then open ''apps''. You will find the ''installed'' folder there. Copy your jar file to the ''installed'' folder by dragging it from Eclipse while holding the option/alt key. {{attachment:copy-app.png}} {i} The `CytoscapeConfiguration/3/apps/installed` directory is where all active Cytoscape apps reside. === Installing using a symbolic link === If you are using MacOS or Linux then you can avoid having to copy the jar file every time your app is rebuilt. This is done by creating a symbolic link from the Cytoscape apps folder to the App jar file in the Eclipse workspace. This only has to be done once. * Open a terminal window * Navigate to the `CytoscapeConfiguration/3/apps/installed` folder. For example type the command `cd /home/user/CytoscapeConfiguration/3/apps/installed` (where `/home/user` is replaced by the location of your ''!CytoscapeConfiguration'' folder). * Type the command `ln -s /path/to/my_app.jar my_app.jar` (where `/path/to/my_app.jar` is the full path to the App jar file). To find the full path to the App jar file select the jar file in Eclipse and press ''Alt + Enter''. The Resource Properties dialog will open and the full system path to the file is shown as the first entry in the dialog. === 3. Run your app === Open Cytoscape. In the ''Apps'' menu, go to ''Samples'', then choose ''Create Network View''. {{attachment:apps-menu.png}} <
> <
> <
> <
> <
> Your app will create a network view and a new node. Cytoscape will then look like this: {{attachment:new-network-view.png}} B-) You just built an app and ran it in Cytoscape.