Deployment

Hello all,

I have been attempting to deploy a simple game I wrote in NetBeans. Everything compiles and runs fine. However, I have no idea on how to run it outside of NetBeans. I have searched the forums and read the wiki on deployment but still can not figure this out.



Even a simple batch file would be sufficient for my needs. Can someone explain how to assemble everything correctly to make this work.



Thanks!

I’d say your best bet is webstart. Have you also read through this guide? The only step that is different for you is probably the ‘create a jar from your Project (Eclipse)’ - but I am sure the netbeans way is not much more compilcated… give it a go…

That's easy because NetBeans already creates a .jar with all the classpath entries for you. So all you have to do is add the native library path, and start your project's jar as usual.

Follow these two steps:


  1. copy all native libraries (.dlls) to a new folder "binlibs" in your NetBeans project folder
  2. create this batch file in the NetBeans project folder:


java -Djava.library.path=./binlibs -jar dist/YOURPROJECTNAME.jar

hevee said:

That's easy because NetBeans already creates a .jar with all the classpath entries for you. So all you have to do is add the native library path, and start your project's jar as usual.
Follow these two steps:

1. copy all native libraries (.dlls) to a new folder "binlibs" in your NetBeans project folder
2. create this batch file in the NetBeans project folder:


java -Djava.library.path=./binlibs -jar dist/YOURPROJECTNAME.jar




I attempted to run the batch file but I got this this error:


C:Documents and SettingsKyleMy DocumentsMy CodeGame DevjMEGame>java -Djav
a.library.path=./binlibs/ -jar dist/Game.jar
Exception in thread "main" java.lang.NoClassDefFoundError: com/jme/app/BaseGame
        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$000(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 java.lang.ClassLoader.loadClassInternal(Unknown Source)
Caused by: java.lang.ClassNotFoundException: com.jme.app.BaseGame
        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 java.lang.ClassLoader.loadClassInternal(Unknown Source)
        ... 12 more




I also noticed when I did a clean compile this was printed:


Created dir: C:Documents and SettingsKyleMy DocumentsMy CodeGame DevjMEGamedist
C:jmebuild is a directory or can't be read. Not copying the libraries.
Building jar: C:Documents and SettingsKyleMy DocumentsMy CodeGame DevjMEGamedistGame.jar
Not copying the libraries.
To run this application from the command line without Ant, try:
java -jar "C:Documents and SettingsKyleMy DocumentsMy CodeGame DevjMEGamedistGame.jar"
jar:
BUILD SUCCESSFUL (total time: 1 second)



It is not copying the libraries. Is this a problem?  :)

Yeah, any way to make it copy the libraries? That would be quite convenient…