I bought book "LEGO NXT Building Robots with Java brains".
There is GPS chapter.
According to this chapter I tried to run simple application on PDA.
This application use gpsylon GPS lib.
Problem is that when I use code below I got error:
Message is quite simple but problem is that this class exist in jar file.
I use Mysaifu JVM.
CLASSPATH is set correctly.
I don't know what to do with it.
- Code: Select all
0
Exception in thread "Thread-1" java.lang.NoClassDefFoundError: org/dinopolis/gpstool/gpsinput/GPSGeneralDataProcessor
at GPSTest.main(GPSTest.java)
at java.lang.reflect.Method.invokeNative(Native Method)
at java.lang.reflect.Method.invoke(Method.java:355)
at java.lang.VMMainThread$1.run(VMMainThread.java)
at java.lang.VMThread.run(VMThread.java:120)
JVM exit.
Application code :
- Code: Select all
import org.dinopolis.gpstool.gpsinput.*;
import org.dinopolis.gpstool.gpsinput.nmea.*;
import java.util.*;
import java.beans.*;
public class GPSTest {
public static void main(String[] args) {
System.out.println("0");
GPSDataProcessor nmeaReader = new GPSNmeaDataProcessor();
System.out.println("1");
Hashtable settings = new Hashtable();
System.out.println("2");
settings.put(GPSSerialDevice.PORT_NAME_KEY,"COM1");
settings.put(GPSSerialDevice.PORT_SPEED_KEY,new Integer(4800));
GPSDevice myGPS = new GPSSerialDevice();
System.out.println("3");
try{
myGPS.init(settings);
nmeaReader.setGPSDevice(myGPS);
nmeaReader.open();
}
catch(GPSException e)
{
System.out.println("Error "+e);
}
PropertyChangeListener gps_listener = new PropertyChangeListener()
{
public void propertyChange(PropertyChangeEvent e) {
Object obj = e.getNewValue();
String propertyType=e.getPropertyName();
if(propertyType.equals(GPSDataProcessor.LOCATION)) {
GPSPosition pos =(GPSPosition)obj;
System.out.println("Latitude :"+pos.getLatitude());
System.out.println("Longitude :"+pos.getLongitude());
}
}
};
nmeaReader.addGPSDataChangeListener(GPSDataProcessor.LOCATION, gps_listener);
}//main
}
