| 12345678910111213141516171819202122232425262728293031323334353637 |
- <!DOCTYPE html><html lang="en"><head><meta charset="UTF-8"><!--[if IE]><meta http-equiv="X-UA-Compatible" content="IE=edge"><![endif]--><meta name="viewport" content="width=device-width, initial-scale=1.0"><meta name="generator" content="Asciidoctor 1.5.4"><meta name="keywords" content="documentation, project, deployment, sdk"><title>jMonkeyEngine SDK: Creating Projects</title><link rel="stylesheet" href="./asciidoctor.css">
- <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.5.0/css/font-awesome.min.css">
- <link rel="stylesheet" href="./coderay-asciidoctor.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/docsearch.js/2/docsearch.min.css"></head><body class="article toc2 toc-left"><div id="header"><div id="toolbar"><a href="https://github.com/jMonkeyEngine/wiki/edit/master/src/docs/asciidoc/sdk/project_creation.adoc"><i class="fa fa-pencil-square" aria-hidden="true"></i></a><a href="https://github.com/jMonkeyEngine/wiki/new/master/src/docs/asciidoc/sdk/"><i class="fa fa-plus-square" aria-hidden="true"></i></a><input dir="auto" style="position: relative; vertical-align: top;" spellcheck="false" autocomplete="off" class="searchbox__input aa-input" id="doc-search" name="search" placeholder="Search in the doc" required="required" type="search"></div><h1>jMonkeyEngine SDK: Creating Projects</h1><div class="details"><span class="author" id="author"></span><br><span id="revnumber">version ,</span> <span id="revdate">2016/03/17 20:48</span></div><div id="toc" class="toc2"><div id="toctitle">Table of Contents</div><ul class="sectlevel1"><li><a href="#creating-a-new-jmonkeyengine-project">Creating a New jMonkeyEngine Project</a><ul class="sectlevel2"><li><a href="#project-structure">Project Structure</a></li><li><a href="#directory-structure">Directory Structure</a></li><li><a href="#project-configuration">Project Configuration</a></li><li><a href="#clean-build-and-run-cycle">Clean, Build and Run Cycle</a></li></ul></li><li><a href="#development-process">Development Process</a><ul class="sectlevel2"><li><a href="#adding-external-jar-libraries">Adding external jar libraries</a></li><li><a href="#application-deployment">Application Deployment</a></li></ul></li><li><a href="#running-sample-projects">Running Sample Projects</a></li></ul></div></div><div id="content"><div id="preamble"><div class="sectionbody"><div class="paragraph"><p>The jMonkeyEngine SDK makes it easy to get started with developing 3-D games based on the jMonkeyEngine.</p></div></div></div>
- <div class="sect2"><h3 id="creating-a-new-jmonkeyengine-project">Creating a New jMonkeyEngine Project</h3><div class="olist arabic"><ol class="arabic"><li><p>Choose <code><span class="menuseq"><span class="menu">File</span> ▸ <span class="menuitem">New Project</span></span></code> from the main menu.</p></li><li><p>In the New Project Wizard, select the template <code><span class="menuseq"><span class="menu">JME3</span> ▸ <span class="menuitem">Basic Game</span></span></code>.</p></li><li><p>Click next to specify a project name, and the path where to store your new project.</p></li><li><p>Click Finish. A skeleton application is created and opens in the Project Explorer.</p><div class="ulist"><ul><li><p>This basic jme3 application is based on the SimpleApplication class to allow an easy start with jme3.</p></li><li><p>You can click the run button to run it: You will see a blue cube.</p></li></ul></div></li></ol></div>
- <div class="sect2"><h3 id="project-structure">Project Structure</h3><div style="text-align: center;" class="imageblock"><div class="content"><img src="../sdk/jmonkeyplatform-docu-4.png" alt="jmonkeyplatform-docu-4.png" width="421" height="298"></div></div>
- <div class="paragraph"><p>Let’s have a look at the abstract project structure in the Project Explorer. (<kbd>Ctrl</kbd>+<kbd>1</kbd>).</p></div>
- <div class="ulist"><ul><li><p><strong>Project Assets node:</strong> These directories have been created for you to store your games assets, such as fonts, materials, models, shaders, sounds, and textures. For a newly created project, these directories are empty.</p></li><li><p><strong>Source Packages node:</strong> This is where you manage your packages and classes. For a newly created project, it contains one package and one class, <code>Main.java</code>. Double click <code>Main.java</code> to open it in the editor.</p></li><li><p><strong>Libraries node:</strong> An overview of all libraies on your game’s classpath. The classpath is already set-up for the jme3 framework (including LWJGL, Bullet, Nifty <abbr title="Graphical User Interface">GUI</abbr>, etc).</p></li></ul></div></div>
- <div class="sect2"><h3 id="directory-structure">Directory Structure</h3><div class="paragraph"><p>Now let’s have a look at the project’s file structure in the File Explorer (<kbd>Ctrl</kbd>+<kbd>2</kbd>). This explorer shows the physical directory structure on your hard drive.</p></div>
- <div class="ulist"><ul><li><p><strong>assets</strong> – This directory corresponds to the Project Assets node. It is needed for the assetManager.</p><div class="paragraph"><p>This is the recommended internal structure:</p></div>
- <div class="ulist"><ul><li><p><code>assets/Interface</code></p></li><li><p><code>assets/MatDefs</code></p></li><li><p><code>assets/Materials</code></p></li><li><p><code>assets/Models</code></p></li><li><p><code>assets/Scenes</code></p></li><li><p><code>assets/Shaders</code></p></li><li><p><code>assets/Sounds</code></p></li><li><p><code>assets/Textures</code></p></li></ul></div></li><li><p><strong>src</strong> – This directory corresponds to the Source Packages node. Your sources code goes here.</p></li><li><p><strong>nbproject</strong> – This is meta data used by the jMonkeyEngine SDK (don’t edit).</p></li><li><p><strong>build.xml</strong> – This is an Ant build script that is hooked up to the clean/build/run/test actions in the jMonkeyEngine SDK. It loads a default build script, and allows you to further customize the build process. The Ant script also assures that you are able to clean/build/run/test your application outside of the jMonkeyEngine SDK – e.g. from the command line.</p></li><li><p><strong>build</strong> – This directory contains the compiled classes. (Will be generated by the jMonkeyEngine SDK when you build the project.)</p></li><li><p><strong>dist</strong> – This directory contains the executable JAR files. (Will be generated by the jMonkeyEngine SDK when you build the project.)</p></li><li><p><strong>test</strong> – The jMonkeyEngine SDK will store JUnit tests here if you create any. (Optional.)</p></li></ul></div></div>
- <div class="sect2"><h3 id="project-configuration">Project Configuration</h3><div class="paragraph"><p>[RMB] select the project and from the menu open the project <code>Properties</code>.</p></div>
- <div class="ulist"><ul><li><p>In the <code>Run</code> section:</p><div class="ulist"><ul><li><p>Specify the main class of your project. (Pressing <kbd>F6</kbd> runs this main class.)</p></li><li><p>You can optionally configure JVM options and command line parameters. In most cases, set the <code>-Xms VMOption [NUMBER] m</code> for the memory usage.</p><div class="ulist"><ul><li><p>For example (-Xms500m).</p></li><li><p>see <a href="http://performance.netbeans.org/howto/jvmswitches/">http://performance.netbeans.org/howto/jvmswitches/</a>).</p></li></ul></div></li></ul></div></li><li><p>In the Application section:</p><div class="ulist"><ul><li><p>Specify the game title (by default the game will be named <code>BasicGame</code>).</p></li><li><p>Specify the vendor name (your name), a short description, your project’s homepage, and a splash screen.</p></li></ul></div></li></ul></div></div>
- <div class="sect2"><h3 id="clean-build-and-run-cycle">Clean, Build and Run Cycle</h3><div style="text-align: center;" class="imageblock"><div class="content"><img src="../sdk/jmonkeyplatform-docu-5.png" alt="jmonkeyplatform-docu-5.png" width="421" height="298"></div></div>
- <div class="admonitionblock important"><table><tr><td class="icon"><i class="fa icon-important" title="Important"></i></td><td class="content"><div class="paragraph"><p>Pressing <strong><kbd>F6</kbd> builds & runs</strong> the <em>main</em> class of the <em>main project</em>. If there are several classes, or several projects, you have to specify which one you want <kbd>F6</kbd> to run. <b class="button">RMB</b> select a project and choose <code>Set As Main Project</code>, then <b class="button">RMB</b> select the project again and choose <code><span class="menuseq"><span class="menu">Properties</span> ▸ <span class="menuitem">Run</span></span></code> and choose a Main Class.</p></div>
- <div class="paragraph"><p>To build and run the main() of <em>any file that is open in the editor</em>, press <kbd>Shift</kbd>+<kbd>F6</kbd>!</p></div></td></tr></table></div>
- <div class="ulist"><ul><li><p><b class="button">RMB</b> select the project and use the context-menu to clean all generated classes and JARs.</p></li><li><p><b class="button">RMB</b> select individual files with a main method to build and run them. (<kbd>Shift</kbd>+<kbd>F6</kbd>)</p></li><li><p>Press the <b class="button">Run</b> button (green arrow in the toolbar) to build and run the project. (<kbd>F6</kbd>)</p></li></ul></div>
- <div class="paragraph"><p><strong>More than one project open?</strong> The toolbar buttons and the F-keys are bound to the main project, which is shown in bold in the Project Explorer. <b class="button">RMB</b> select a project and select <code>Set As Main Project</code> to make it respond to the toolbar buttons and F-keys.</p></div>
- <div class="paragraph"><p><strong>Worried About Proprietary Lock-in?</strong> You are never locked into the jMonkeyEngine SDK: At any time, you can change into your project directory on the command line, and clean, build, and run your project, using non-proprietary Apache Ant commands:</p></div>
- <div class="listingblock"><div class="content"><pre class="CodeRay highlight"><code>ant clean; ant jar; ant run;</code></pre></div></div></div></div>
- <div class="sect2"><h3 id="development-process">Development Process</h3><div class="ulist"><ul><li><p><strong>Creating new files and packages:</strong> Select the Source Packages node (or any of its subnodes), and press <kbd>Ctrl</kbd>+<kbd>N</kbd> (<code><span class="menuseq"><span class="menu">File</span> ▸ <span class="menuitem">New File</span></span></code>): Use the <code>New File</code> wizard to create new Java classes, Java packages, Java beans, Swing forms, JUnit files, j3m Materials, j3o scenes, j3f filters, and many more.</p></li><li><p><strong>Editing files:</strong> Open the Projects Explorer and double-click a Java file from the Source Packages to open it in the Editor. The <a href="../sdk/code_editor.html">jMonkeyEngine SDK Code Editor</a> assists you in many ways, including syntactic and semantic code coloring, code completion, and javadoc.</p></li><li><p><strong>Adding Assets:</strong></p><div class="ulist"><ul><li><p>You can <a href="../sdk/model_loader_and_viewer.html">import models, scenes, and materials</a> as assets into your project.</p></li><li><p>To add sound files and images, use your operating system’s file explorer and copy the files into your project’s asset directory.</p></li></ul></div></li><li><p><strong>ToDo List:</strong> The tasks window automatically lists all lines containing errors and warnings, and all lines that you have marked with the comment keywords</p><div class="listingblock"><div class="content"><pre class="CodeRay highlight"><code data-lang="html">FIXME</code></pre></div></div>
- <div class="paragraph"><p>, @todo, or TODO.</p></div></li><li><p><strong>Integrated tools:</strong> <a href="../sdk/debugging_profiling_testing.html">Debugging, Testing, Profiling</a>.</p></li></ul></div>
- <div class="sect2"><h3 id="adding-external-jar-libraries">Adding external jar libraries</h3><div class="paragraph"><p>You may want to use external Java libraries in your jME project, for example content generators or artificial intelligence implementations.</p></div>
- <div class="paragraph"><p>Add the library to the global library list:</p></div>
- <div class="ulist"><ul><li><p>Select <span class="menuseq"><span class="menu">Tools</span> ▸ <span class="menuitem">Libraries</span></span> in the main menu.</p></li><li><p>Click “New Library”, enter a name for the library, and press <b class="button">OK</b>.</p></li><li><p>In the “Classpath” tab, press “Add JAR/Folder” and select the jar file(s) needed for the library.</p></li><li><p>(Optional) In the “JavaDoc” tab, press “Add ZIP/Folder” and select the javadoc for the library, as zip file or folder.</p></li><li><p>(Optional) In the “Sources” tab you can select a folder or jar file containing the source files of the library.</p></li><li><p>Press <b class="button">OK</b>.</p></li></ul></div>
- <div class="paragraph"><p>Add the library to a project:</p></div>
- <div class="ulist"><ul><li><p><b class="button">RMB</b> select your project and select “Properties”.</p></li><li><p>Select “Libaries” on the left and then press “Add Library”.</p></li><li><p>Select the library from the list and press <b class="button">OK</b>.</p></li></ul></div>
- <div class="paragraph"><p>That’s it, your project can now use the external library. If you also linked the javadoc and sources, the SDK will assist you with javadoc popups, code completion (<kbd>Ctrl</kbd>+<kbd>Space</kbd>) and source navigation (<kbd>Ctrl</kbd>+<b class="button">LMB</b> ).</p></div></div>
- <div class="sect2"><h3 id="application-deployment">Application Deployment</h3><div class="ulist"><ul><li><p>You can <a href="../sdk/application_deployment.html">deploy</a> your game as desktop application (JAR), browser applet, WebStart (JNLP), or on the Android platform.</p></li></ul></div></div></div>
- <div class="sect1"><h2 id="running-sample-projects">Running Sample Projects</h2><div class="sectionbody"><div class="paragraph"><p>The SDK contains <a href="../sdk/sample_code.html">Sample Code</a> (read more).</p></div>
- <div class="paragraph"><p>Open the Source Packages node of the JmeTests project.</p></div>
- <div class="ulist"><ul><li><p><b class="button">RMB</b> select the <code>JME3Tests</code> project and choose Run.<br>
- Choose samples from the TestChooser and try out the included demos.</p></li><li><p>Browse a demo’s source code in the SDK’s Project window to learn how a feature is implemented and used.</p></li><li><p>Feel free to modify the code samples and experiment! If you break something, you can always recreate the packaged samples from the <code>JME3 Tests</code> template.</p></li></ul></div></div></div></div><div id="footer"><div id="footer-text">Version <br>Last updated 2018-02-28 16:23:40 +00:00</div></div><script type="text/javascript" src="https://cdn.jsdelivr.net/docsearch.js/2/docsearch.min.js"></script><script>docsearch({
- apiKey: 'a736b6d93de805e26ec2f49b55013fbd',
- indexName: 'jmonkeyengine',
- inputSelector: '#doc-search',
- debug: false // Set debug to true if you want to inspect the dropdown
- });</script></body></html>
|