I am a newbie on Nokia development. I tried to create a Service like in https://projects.developer.nokia.com/notificationsapi/wiki/ServiceSampleJava but I have more problem about that. I tried to compile MyService? .java like this:
java -cp .:httpclient-4.0.1.jar开发者_C百科:apache-mime4j-0.6.jar:commons-codec-1.3.jar:commons-logging-1.1.1.jar:httpcore-4.0.1.jar:/lib/httpmime-4.0.1.jar MyService? "payload:Test Notification from REST API" "jid:nnapi_testuser@ovi.com" “application_id:com.example” “service_id:example.com” “service_secret:WcbOlf05YCSyy0d4I9nBHSkE+vXRGJxjw90E/KpXLJ0=”
I have result errors like this:
Exception in thread "main" java.lang.NoClassDefFoundError?: :apache-mime4j-0/6/jar Caused by: java.lang.ClassNotFoundException?: :apache-mime4j-0.6.jar
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: :apache-mime4j-0.6.jar. Program will exit.
What can I do to fix these errors?
You're using a colon : to separate your libs. You need to use a semi-colon ;. You might have other errors as well, but let's start there.
Per tools doc -cp classpath Specify a list of directories, JAR archives, and ZIP archives to search for class files. Class path entries are separated by semicolons (;). Specifying -classpath or -cp overrides any setting of the CLASSPATH environment variable.
精彩评论