You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@mxnet.apache.org by GitBox <gi...@apache.org> on 2018/11/15 21:31:15 UTC

[GitHub] yzhliu closed pull request #13267: [MXNET-1181] Added command line alternative to IntelliJ in install instructions

yzhliu closed pull request #13267: [MXNET-1181] Added command line alternative to IntelliJ in install instructions
URL: https://github.com/apache/incubator-mxnet/pull/13267
 
 
   

This is a PR merged from a forked repository.
As GitHub hides the original diff on merge, it is displayed below for
the sake of provenance:

As this is a foreign pull request (from a fork), the diff is supplied
below (as it won't show otherwise due to GitHub magic):

diff --git a/docs/tutorials/java/mxnet_java_on_intellij.md b/docs/tutorials/java/mxnet_java_on_intellij.md
index b90a92b0a7b..7f02853660d 100644
--- a/docs/tutorials/java/mxnet_java_on_intellij.md
+++ b/docs/tutorials/java/mxnet_java_on_intellij.md
@@ -1,6 +1,6 @@
 # Run MXNet Java Examples Using the IntelliJ IDE (macOS)
 
-This tutorial guides you through setting up a simple Java project in IntelliJ IDE on macOS and demonstrates usage of the MXNet Java APIs. 
+This tutorial guides you through setting up a simple Java project in IntelliJ IDE on macOS and demonstrates usage of the MXNet Java APIs.
 
 ## Prerequisites:
 To use this tutorial you need the following pre-requisites:
@@ -108,6 +108,15 @@ TODO
 After clicking Finish, you will be presented with the project's first view.
 The project's `pom.xml` will be open for editing.
 
+**IntelliJ IDEA Alternative** If you want to use only Maven to create the project, you can create a new folder and run the following in the newly created folder :
+```bash
+mkdir java-proj
+cd java-proj/
+mvn archetype:generate -DgroupId=mxnet -DartifactId=mxnetJava -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
+```
+This command will create a new Java project folder with name `mxnetJava` inside `java-proj` folder.
+More on creating Maven projects can be found on this Maven tutorial : [Maven in 5 Minutes](https://maven.apache.org/guides/getting-started/maven-in-five-minutes.html).
+
 **Step 3.** Add the following Maven dependency to your `pom.xml` file under the `dependencies` tag: 
  
 ```html
@@ -120,6 +129,10 @@ The project's `pom.xml` will be open for editing.
 
 To view the latest MXNet Maven packages, you can check [MXNet Maven package repository](https://search.maven.org/#search%7Cga%7C1%7Cg%3A%22org.apache.mxnet%22)
 
+Note :
+- Change the osx-x86_64 to linux-x86_64 if your platform is linux.
+- Change cpu into gpu if you have a gpu backed machine and want to use gpu.
+
 
 **Step 4.** Import dependencies with Maven:
 
diff --git a/docs/tutorials/scala/mxnet_java_install_and_run_examples.md b/docs/tutorials/scala/mxnet_java_install_and_run_examples.md
deleted file mode 100644
index 83e1ec5b2da..00000000000
--- a/docs/tutorials/scala/mxnet_java_install_and_run_examples.md
+++ /dev/null
@@ -1,123 +0,0 @@
-# Install and run Java Examples
-
-## Prerequisites:
-Please follow the Step 1 in the [Scala configuration](http://mxnet.incubator.apache.org/install/scala_setup.html#setup-instructions)
-These should help you install the correct Java version and all dependencies.
-
-## Run the Java example project
-We have provided a general MXNet Java template under `scala-package/mxnet-demo/java-demo` which contains the necessary project files for you to get started. It contains a simple Hello world! equivalent program `JavaSample.java` and a full fledged `ObjectDetection.java `that shows how to run Object Detection on images using MXNet and pre-trained SSD model.
-
-Alternatively you could build project from scratch following the below instructions.
-
-## Import and run the Java package
-For users using a desktop/laptop, we recommend using IntelliJ IDE as it is tested and supported to provide the necessary documentation for the Java API.
-
-Alternatively, users can follow the second instruction to set up an empty Maven project for Java.
-
-### IntelliJ instruction
-If you are using a computer with Ubuntu16.04 or Mac, you can install IntelliJ to run the Java package. Please follow the instruction below:
-
-1. Create a new Java project in IntelliJ. Fire up IntelliJ and click `Create New Project`.
-
-2. Click `Next`, and in the `Create project from template` window, do not select anything and click `Next` again.
-
-3. In the next window choose your `Project name` and the `Project location` and click on `Finish`.
-
-4. Let's add the Java Inference API jars that we build from source. At the top of the window, Go to the `File -> Project Structure`. In the popup window that opens up, click on `Libraries -> +` and select the path to the jar files downloaded. Click `Apply` and then click `OK`.
-
-6. Create a new Java class under the folder `your-project-name/src`. Let's call this class `JavaSample.java`. Type in the following code snippet and run it. In this code snippet, we create an NDArray object in Java and print its shape.
-```java
-import org.apache.mxnet.javaapi.Context;
-import org.apache.mxnet.javaapi.NDArray;
-
-public class JavaSample {
-public static void main(String[] args) {
-  System.out.println("Hello");
-  NDArray nd = NDArray.ones(Context.cpu(), new int[] {10, 20});
-
-  System.out.println("Shape of NDarray is : "  + nd.shape());
-}
-}
-```
-
-7. If all went well, you should see an output like this :
-```
-Hello
-SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
-SLF4J: Defaulting to no-operation (NOP) logger implementation
-SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
-Shape of NDarray is : (10,20)
-Process finished with exit code 0
-```
-This means you have successfully set it up on your machine
-
-### Run the project manually in Maven
-In this example, Maven is being used to create the project. This tutorial referred the [Maven in 5 min](https://maven.apache.org/guides/getting-started/maven-in-five-minutes.html) tutorial.
-
-1. Create a new folder and run the following commands
-```
-mvn archetype:generate -DgroupId=com.mycompany.app -DartifactId=my-app -DarchetypeArtifactId=maven-archetype-quickstart -DinteractiveMode=false
-```
-You can specify the `groupId` and `artifactId` to your favourite names. You can also create a maven project using empty archetype.
-
-2. then go to `pom.xml` file in your project folder and add the following content.
-
-- Change the `osx-x86_64` to `linux-x86_64` if your platform is linux.
-- Change `cpu` into `gpu` if you are using gpu
-- Change the version of your package from `1.3.1-SNAPSHOT` to the matched jar version.
-```xml
-<dependency>
-  <groupId>org.apache.mxnet</groupId>
-  <artifactId>mxnet-full_2.11-osx-x86_64-cpu</artifactId>
-  <version>1.3.1-SNAPSHOT</version>
-  <scope>system</scope>
-  <systemPath>path-to-your-jar/jarName.jar</systemPath>
-</dependency>
-<dependency>
-  <groupId>args4j</groupId>
-  <artifactId>args4j</artifactId>
-  <version>2.0.29</version>
-  </dependency>
-<dependency>
-  <groupId>org.slf4j</groupId>
-  <artifactId>slf4j-api</artifactId>
-  <version>1.7.7</version>
-</dependency>
-<dependency>
-  <groupId>org.slf4j</groupId>
-  <artifactId>slf4j-log4j12</artifactId>
-  <version>1.7.7</version>
-</dependency>
-```
-3. Finally you can replace the code in `App.java`
-```java
-import org.apache.mxnet.javaapi.Context;
-import org.apache.mxnet.javaapi.NDArray;
-
-public class App {
-public static void main(String[] args) {
-  System.out.println("Hello");
-  NDArray nd = NDArray.ones(Context.cpu(), new int[] {10, 20});
-
-  System.out.println("Shape of NDarray is : "  + nd.shape());
-
-}
-}
-```
-make the package by
-```
-mvn package
-```
-
-and run it by
-```
-java -cp target/my-app-1.0-SNAPSHOT.jar:<full-path-to-jar>/<jarName>.jar com.mycompany.app.App
-```
-The result looks like this:
-```
-Hello
-SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
-SLF4J: Defaulting to no-operation (NOP) logger implementation
-SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
-Shape of NDarray is : (10,20)
-```
\ No newline at end of file


 

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
users@infra.apache.org


With regards,
Apache Git Services