diff --git a/pages/documentation/platforms/java.html b/pages/documentation/platforms/java.html new file mode 100644 index 00000000..23dc6b43 --- /dev/null +++ b/pages/documentation/platforms/java.html @@ -0,0 +1,170 @@ +
+

+ + Getting started with Haxe for Java +

+
+ +
+
+ 1 +
+

+ Install Haxe +

+
+ Download and install the Haxe Compiler. +
+
+ +
+
+ 2 +
+

+ Install a compatible Haxe IDE +

+
+ You will need one of these to develop your Haxe projects. + +
+
+ +
+
+ 3 +
+

+ Create your project +

+
+ 1. Create a new directory for your Haxe project, with this structure:
+
+project +└---src +│ │ Main.hx +│ +└---bin + └---java +
+ 2. Insert the following code into the Main.hx file:
+
+import php.Lib; + +class Main { + static function main() { + Lib.println('Haxe is great!'); + } +} +
+ 3. Install the hxjava haxelib by running haxelib install hxjava in your Haxe project directory. + 4. Create a .hxml to store compiler config for your project
+ 5. Add the following into the file:
+
+-cp src +-java bin/java +-main Main +
+ The configuration above specifies that your source code is stored in /src, your main Haxe file is src/Main.hx, and that you want Haxe to output the Java source code into the bin/java directory. After code generation, Haxe will try javac to compile the generated Java program into a .jar file. You can debug this Java program using a specialized Java IDE.
+
+
+ +
+
+ 4 +
+

+ Install the Java runtime +

+
+ Haxe requires Java 6. Due to security fixes and new features Java 8 or later is recommended.

+ + 1. Install the latest Java Runtime Environment (JRE) and Software Development Kit (SDK). + + 2. Test your installation by opening a command prompt and typing "java -showversion".
+ +
+java version "1.8.0_201" +Java(TM) SE Runtime Environment (build 1.8.0_201-b09) +Java HotSpot(TM) 64-Bit Server VM (build 25.201-b09, mixed mode) +
+
+
+ +
+
+ 5 +
+

+ Develop your project +

+
+

Haxe API

+

+ Browse the Haxe Java API website for the Java-specific API available.
+ Browse the Haxe API website for the core Haxe platform API that you can use in your project. +

+

Haxe libraries

+

+ Browse the haxelib website for community-developed libraries that you can add to your project.
+ You can install haxelib libraries globally by running haxelib install <library>.
+ You can specify that your project uses a haxelib by adding -lib <library> to your .hxml file. +

+
+
+ +
+
+ 6 +
+

+ Debug your project +

+
+

Running and debugging

+

+ After compiling your project with Haxe and Java, you'll need to open a console in the bin/java directory and run the command java -jar Main.jar
+ You can alternatively use a full-fledged Java IDE like the ones given below to run and debug your project easily. +

+

Install a Java IDE

+ If you want a better debugging experience, you can install a dedicated Java IDE to run and debug your Java programs generated from your Haxe project. + +
+
+ +
+
+ 7 +
+

+ Ask the community +

+
+ If you need help with anything, visit the vibrant Haxe community and simply ask for help with the details of your project. We have a helpful and active community and you should get your answers quickly! +
+
\ No newline at end of file diff --git a/www/img/platforms/java.png b/www/img/platforms/java.png new file mode 100644 index 00000000..f91c11f5 Binary files /dev/null and b/www/img/platforms/java.png differ