0

I am trying to create a neural network using deeplearning4j. I have created a maven project. but when I run the project I get this java error.

Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.2.1:exec (default-cli) on project demo-neural: Command execution failed. Cannot run program "C:\Program Files\Java\jdk1.8.0_77\bin\java.exe" (in directory "C:\Users\dev1\Documents\New folder (3)\NeuralNetwork"): CreateProcess error=206, The filename or extension is too long -> [Help 1]

To see the full stack trace of the errors, re-run Maven with the -e switch.
Re-run Maven using the -X switch to enable full debug logging.

For more information about the errors and possible solutions, please read the following articles:
[Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

My pom.xml looks like this

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">

    <modelVersion>4.0.0</modelVersion>

    <groupId>com.cdap</groupId>
    <artifactId>demo-neural</artifactId>
    <packaging>jar</packaging>
    <version>1.0-SNAPSHOT</version>

    <name>A Camel Route</name>
    <url>http://www.myorganization.org</url>

    <properties>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
    </properties>

    <dependencies>
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-core</artifactId>
            <version>2.17.3</version>
        </dependency>
        <!-- logging -->
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-api</artifactId>
            <version>1.7.21</version>
        </dependency>
        <dependency>
            <groupId>org.slf4j</groupId>
            <artifactId>slf4j-log4j12</artifactId>
            <version>1.7.21</version>
        </dependency>
        <dependency>
            <groupId>log4j</groupId>
            <artifactId>log4j</artifactId>
            <version>1.2.17</version>
        </dependency>

        <dependency>
            <groupId>org.deeplearning4j</groupId>
            <artifactId>deeplearning4j-core</artifactId>
            <version>0.5.0</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>org.deeplearning4j</groupId>
            <artifactId>dl4j-spark_2.11</artifactId>
            <version>0.4-rc3.10</version>
        </dependency>
        <!-- https://mvnrepository.com/artifact/org.apache.maven.plugins/maven-compiler-plugin -->
        <dependency>
            <groupId>org.apache.maven.plugins</groupId>
            <artifactId>maven-compiler-plugin</artifactId>
            <version>3.5.1</version>
        </dependency>

        <dependency>
            <groupId>org.nd4j</groupId>
            <artifactId>nd4j-native</artifactId>
            <version>0.4-rc3.10</version>
        </dependency>
        <dependency>
            <groupId>org.nd4j</groupId>
            <artifactId>nd4j-api</artifactId>
            <version>0.5.0</version>
            <type>jar</type>
        </dependency>
        <dependency>
            <groupId>org.nd4j</groupId>
            <artifactId>canova-nd4j-common</artifactId>
            <version>0.0.0.16</version>
        </dependency>
        <dependency>
            <groupId>org.apache.spark</groupId>
            <artifactId>spark-core_2.11</artifactId>
            <version>1.6.1</version>
        </dependency>
        <dependency>
            <groupId>org.apache.spark</groupId>
            <artifactId>spark-mllib_2.11</artifactId>
            <version>1.6.1</version>
        </dependency>
        <dependency>
            <groupId>org.scala-lang</groupId>
            <artifactId>scala-library</artifactId>
            <version>2.10.6</version>
        </dependency>
        <dependency>
            <groupId>org.apache.hadoop</groupId>
            <artifactId>hadoop-client</artifactId>
            <version>2.7.2</version>
        </dependency>
        <dependency>
            <groupId>nz.ac.waikato.cms.weka</groupId>
            <artifactId>weka-stable</artifactId>
            <version>3.6.6</version>
        </dependency>
        <dependency>
            <groupId>org.nd4j</groupId>
            <artifactId>nd4j-native-platform</artifactId>
            <version>0.4.0</version>
        </dependency>

        <dependency>
            <groupId>org.nd4j</groupId>
            <artifactId>nd4j-cuda-7.5-platform</artifactId>
            <version>0.4.0</version>
        </dependency>
        <dependency>
            <groupId>org.datavec</groupId>
            <artifactId>datavec-spark_2.10</artifactId>
            <version>0.4.0</version>
        </dependency>
        <!--<dependency>-->
        <!--<groupId>org.nd4j</groupId>-->
        <!--<artifactId>nd4j-api</artifactId>-->
        <!--<version>0.0.3</version>-->
        <!--</dependency>-->

        <!-- testing -->
        <dependency>
            <groupId>org.apache.camel</groupId>
            <artifactId>camel-test</artifactId>
            <version>2.17.3</version>
            <scope>test</scope>
        </dependency>

        <dependency>
            <groupId>org.deeplearning4j</groupId>
            <artifactId>deeplearning4j-nlp</artifactId>
            <version>0.0.3.3</version>
        </dependency>

        <dependency>
            <groupId>org.datavec</groupId>
            <artifactId>datavec-api</artifactId>
            <version>0.5.0</version>
        </dependency>
    </dependencies>

    <build>
        <defaultGoal>install</defaultGoal>

        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>3.5.1</version>
                <configuration>
                    <source>1.7</source>
                    <target>1.7</target>
                </configuration>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-resources-plugin</artifactId>
                <version>2.6</version>
                <configuration>
                    <encoding>UTF-8</encoding>
                </configuration>
            </plugin>

            <!-- Allows the example to be run via 'mvn compile exec:java' -->
            <plugin>
                <groupId>org.codehaus.mojo</groupId>
                <artifactId>exec-maven-plugin</artifactId>
                <version>1.2.1</version>
                <configuration>
                    <mainClass>com.cdap.MainApp</mainClass>
                    <includePluginDependencies>false</includePluginDependencies>
                </configuration>
            </plugin>

        </plugins>
    </build>

</project>

Can anyone help me to solve this? I have tried many options and nothing worked. Thanks in advance.

Ishani Pathinayake
  • 177
  • 1
  • 2
  • 15

3 Answers3

0

Command execution failed. Cannot run program "C:\Program Files\Java\jdk1.8.0_77\bin\java.exe" (in directory "C:\Users\dev1\Documents\New folder (3)\NeuralNetwork"): CreateProcess error=206, The filename or extension is too long

Try to rename "New folder (3)" directory

0

Problem is actually with jar's location in your .m2\repository folder. Location of those jars are way too long to be identified. Maven downloads jars and put them in \repository folder located by default in C:\Users\< your.username >\.m2\ folder.

Error which maven currently shows states that there is a problem with jdk but this is not the case. Problem is jdk is unable to pick up some jars as their path is way too long for jdk to pick up.

Easy Solution :

Move your repository folder from C:\Users\< username >\.m2\repository to some location of shorter path maybe directly in C:\repository

Now, you have to change the default path of maven's repository to your new location in maven's settings.xml .

Default path of settings.xml is C:\maven\conf\ .

Search for the following lines

<!-- localRepository
   | The path to the local repository maven will use to store artifacts.
   |
   | Default: ${user.home}/.m2/repository
  <localRepository>/path/to/local/repo</localRepository>
 -->

remove the comments and and just keep the following lines :

<localRepository>/path/to/local/repo</localRepository>

Here put path of your local repository. e.g. C:\repository

Save it and run using maven again. everything should work as before.

Rathan Naik
  • 993
  • 12
  • 25
0

When i used aws-java-sdk library this error appeared. Reducing the number of libraries helped me. Obviously some libraries had too large name. But i need only aws-java-sdk-s3 so i replace aws-java-sdk to aws-java-sdk-s3 in maven and problem was solved . But it is not the solution when you need library with long name )

Valeriy K.
  • 2,616
  • 1
  • 30
  • 53