# How to create a new Swirlds app in Eclipse

These versions (or later) should be downloaded and installed:

- Oracle Java SE 10: Oracle Java SE Development Kit 10.0.2
- Eclipse 4.7 (Oxygen): Eclipse IDE for Java Developers (EE is also ok).
- Swirlds SDK: Swirlds SDK.

To create a new app, copy the HelloSwirldsDemo folder and everything in it to a new folder with the appropriate name. In this example, the new folder will be called ExampleApp. The folder can be anywhere, but there are some advantages to having it somewhere under the Eclipse workspace directory. Two directory levels above ExampleApp will be the Swirlds browser (named swirlds.jar) and possibly a file named config.txt In this example, the files will be at:

        workspace/git/swirlds/sdk/source/ExampleApp
        workspace/git/swirlds/sdk/swirlds.jar
        workspace/git/swirlds/sdk/config.txt

This example will use slashes in paths, but on Windows they will be backslashes. After copying and renaming the folder, do the following:

- edit the file ExampleApp/pom.xml with a text editor

- replace all 3 occurrences of "HelloSwirldDemo" with "ExampleApp"
- save and close the text editor

- import the project
  - run Eclipse
  - if the package explorer isn't visible, choose menu WINDOW > SHOW VIEW > PROJECT EXPLORER
  - choose menu FILE > IMPORT
  - click the triangle by MAVEN if it doesn't have items indented under it
  - click EXISTING MAVEN PROJECTS
  - click NEXT
  - click BROWSE (on the same line as ROOT DIRECTORY)
  - navigate to the ExampleApp folder, and click on it
  - click OPEN
  - click FINISH
  - in the package explorer, click the triangle by EXAMPLEAPP then SRC then (DEFAULT PACKAGE) to open them
  - right click on HelloSwirldDemoMain.java and choose REFACTOR > RENAME
  - change the name to ExampleAppMain
  - make sure the first box is checked (UPDATE REFERENCES) and the other two are unchecked
  - click FINISH twice (because it will warn there is a main method)
  - do the same to rename HelloFileSystemDemoState to ExampleAppState
- in the package explorer, right click on pom.xml and choose RUN AS > MAVEN INSTALL
- click on src in the package explorer to select it
- click the green arrow button on the top bar to run it
- if it asks, click JAVA APPLICATION and click OK

If there is a config.txt file in the same directory as swirlds.jar, then the new ExampleApp should run. It should look exactly like the HelloSwirldDemo app. If there are any problems, see How To Run Apps.

At this point, the new app is ready for code development.

Back