5
\$\begingroup\$

Can somebody tell me whats wrong with my pom.xml file?

At this point I get this error if I start my *.jar file:

C:\Users\Michael\git\freezing-robot\target>java -jar freezing-robot-0.0.1-SNAPSHOT.jar 
java.lang.NoClassDefFoundError: org/newdawn/slick/BasicGame
    at java.lang.ClassLoader.defineClass1(Native Method)
    at java.lang.ClassLoader.defineClass(Unknown Source)
    at java.security.SecureClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.defineClass(Unknown Source)
    at java.net.URLClassLoader.access$100(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: org.newdawn.slick.BasicGame
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 13 more
Exception in thread "main" 

And my pom file looks like this:

<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/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>

    <groupId>de.devnetik.freezing-robot</groupId>
    <artifactId>freezing-robot</artifactId>
    <version>0.0.1-SNAPSHOT</version>
    <packaging>jar</packaging>

    <name>freezing-robot</name>
    <url>http://maven.apache.org</url>

    <properties>
        <package.name>de.devnetik.freezing_robot</package.name>
        <main.class>${package.name}.App</main.class>
        <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
        <natives.version>0.0.6</natives.version>
        <lwjgl.version>2.8.2</lwjgl.version>
        <slick.version>274</slick.version>
    </properties>
    <repositories>
        <repository>
            <id>mavenNatives</id>
            <name>Maven Natives Repository</name>
            <url>http://mavennatives.googlecode.com/svn/repo</url>
            <snapshots>
                <enabled>true</enabled>
            </snapshots>
        </repository>
        <repository>
            <id>slick</id>
            <name>slick</name>
            <url>http://slick.cokeandcode.com/mavenrepo</url>
        </repository>
    </repositories>
    <build>
        <plugins>
            <plugin>
                <groupId>com.googlecode.mavennatives</groupId>
                <artifactId>maven-nativedependencies-plugin</artifactId>
                <version>${natives.version}</version>
                <executions>
                    <execution>
                        <id>unpacknatives</id>
                        <goals>
                            <goal>copy</goal>

                        </goals>
                    </execution>
                </executions>
            </plugin>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-jar-plugin</artifactId>
                <version>2.3.2</version>
                <configuration>
                    <archive>
                        <manifest>
                            <mainClass>${main.class}</mainClass>
                            <packageName>${package.name}</packageName>
                            <addClasspath>true</addClasspath>
                            <classpathPrefix>lib/</classpathPrefix>
                        </manifest>
                    </archive>
                </configuration>
            </plugin>
        </plugins>
    </build>

    <dependencies>
        <dependency>
            <groupId>org.lwjgl.lwjgl</groupId>
            <artifactId>lwjgl</artifactId>
            <version>${lwjgl.version}</version>
        </dependency>
        <dependency>
            <groupId>slick</groupId>
            <artifactId>slick</artifactId>
            <version>${slick.version}</version>
        </dependency>
    </dependencies>
</project>

If I try to start the application from eclipse through "play" ill get this error:

Exception in thread "main" java.lang.UnsatisfiedLinkError: no lwjgl in java.library.path
    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    at java.lang.Runtime.loadLibrary0(Unknown Source)
    at java.lang.System.loadLibrary(Unknown Source)
    at org.lwjgl.Sys$1.run(Sys.java:73)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.lwjgl.Sys.doLoadLibrary(Sys.java:66)
    at org.lwjgl.Sys.loadLibrary(Sys.java:95)
    at org.lwjgl.Sys.<clinit>(Sys.java:112)
    at org.lwjgl.opengl.Display.<clinit>(Display.java:135)
    at org.newdawn.slick.AppGameContainer$1.run(AppGameContainer.java:39)
    at java.security.AccessController.doPrivileged(Native Method)
    at org.newdawn.slick.AppGameContainer.<clinit>(AppGameContainer.java:36)
    at de.devnetik.freezing_robot.App.main(App.java:30)

And at least this is my project folder structure:

Screenshot

\$\endgroup\$
  • \$\begingroup\$ hmm ill try that. \$\endgroup\$ – Michael Malura May 24 '12 at 17:28
3
\$\begingroup\$

As the error says, there's no LWJGL in your java library path. See this answer for that.

For setting that up in Eclipse you want to add the -Djava.library.path="your_path" part into the VM arguments field found in the debug/build section in the project settings in eclipse. The "your_path" part should point to the native libraries for LWJGL (native to whatever system you're working on be it Windows, Mac or Linux).

\$\endgroup\$
  • \$\begingroup\$ awesome its working. thank you. i would vote up but i cant :D so you have to wait a bit \$\endgroup\$ – Michael Malura May 24 '12 at 17:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.