From: Jorge S. S. <jsa...@gm...> - 2010-11-24 15:12:39
|
Good morning. Here you have a short "how to", courtesy of Elmer Alexis (thank you, Elmer!) We will try to launch SpaceWandererExample example The first step is to be installed: Player 2.0.5 Stage 2.0 then you have to install version 2.0.1 of JavaClient, for this must have JDK installed, in my case I have installed version 6. I have not tested the javaclient examples with javaclient3. I´ll do that on the following weeks, posting a new version of the examples on the case there are incompatibilities. By the moment, it will be safer if you use player/stage/javaclient 2 choose any stage configuration file (that launch player with simulator Stage used as a plugin) when trying to run the examples found several errors: player: error while loading shared libraries: libplayerdrivers.so.2: cannot open shared object file: No such file or directory This first error is given by player, player needs to find the libraries to execute, error is resolved with: export LD_LIBRARY_PATH=/usr/local/lib COMPILE EXAMPLES: other error is to try to compile the program with javac: by typing: $ javac SpaceWandererExample.java The error is: SpaceWandererExample.java:26: package javaclient2 does not exist import javaclient2.PlayerClient; ^ SpaceWandererExample.java:27: package javaclient2 does not exist import javaclient2.PlayerException; ^ SpaceWandererExample.java:28: package javaclient2 does not exist import javaclient2.Position2DInterface; ^ SpaceWandererExample.java:29: package javaclient2 does not exist import javaclient2.SonarInterface; ^ SpaceWandererExample.java:30: package javaclient2.structures does not exist import javaclient2.structures.PlayerConstants; ^ SpaceWandererExample.java:129: cannot find symbol symbol : class SonarInterface location: class SpaceWandererExample public static String decodeSonars (SonarInterface soni) { ^ SpaceWandererExample.java:54: cannot find symbol symbol : class PlayerClient location: class SpaceWandererExample PlayerClient robot = null; ^ SpaceWandererExample.java:55: cannot find symbol symbol : class Position2DInterface location: class SpaceWandererExample Position2DInterface posi = null; ^ SpaceWandererExample.java:56: cannot find symbol symbol : class SonarInterface location: class SpaceWandererExample SonarInterface soni = null; ^ SpaceWandererExample.java:60: cannot find symbol symbol : class PlayerClient location: class SpaceWandererExample robot = new PlayerClient ("localhost", 6665); ^ SpaceWandererExample.java:61: cannot find symbol symbol : variable PlayerConstants location: class SpaceWandererExample posi = robot.requestInterfacePosition2D (0, PlayerConstants.PLAYER_OPEN_MODE); ^ SpaceWandererExample.java:62: cannot find symbol symbol : variable PlayerConstants location: class SpaceWandererExample soni = robot.requestInterfaceSonar (0, PlayerConstants.PLAYER_OPEN_MODE); ^ SpaceWandererExample.java:63: cannot find symbol symbol : class PlayerException location: class SpaceWandererExample } catch (PlayerException e) { ^ 13 errors to resolve this, use the path where are stored the clasess of JavaClient: $ export CLASSPATH=”$CLASSPATH:/home/elmerlab/Documentos/Javaclient2-2.0.1/classes:.” This step solves the problem and generates the .class using the javac. After trying to run the file with the command: $ java SpaceWandererExample appears a new error: Exception in thread "main" java.lang.NoClassDefFoundError: SpaceWandererExample Caused by: java.lang.ClassNotFoundException: SpaceWandererExample at java.net.URLClassLoader$1.run(URLClassLoader.java:217) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(URLClassLoader.java:205) at java.lang.ClassLoader.loadClass(ClassLoader.java:321) at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:294) at java.lang.ClassLoader.loadClass(ClassLoader.java:266) Could not find the main class: SpaceWandererExample. Program will exit. This is why you need the files .jar, this is corrected using the following path: export CLASSPATH=”$CLASSPATH:/home/elmerlab/Documentos/Javaclient2-2.0.1/jars/javaclient.jar:.” I hope this help. Please tell me if you have further problems. > Dear Developer, > can you tell me after installing the Player/stage javaclient and the player > also how to run the examples which are the main class to run a simulation > and how and where to write world and configuration files?? there are 2 test > examples on your web page but which class in the client is responsible to > run them thanks in advance > -- > Bests > Khaluf |