我有这个使用 jline 库的示例类:
[niko@localhost temporal]$ ls -l jline/example/Example.java
-rw-rw-r-- 1 niko niko 3502 Jul 6 00:20 jline/example/Example.java
[niko@localhost temporal]$ head -20 jline/example/Example.java
package jline.example;
import jline.*;
import java.io.*;
import java.util.*;
import java.util.zip.*;
public class Example {
public static void usage() {
System.out.println("Usage: java " + Example.class.getName()
+ " [none/simple/files/dictionary [trigger mask]]");
System.out.println(" none - no completors");
System.out.println(" simple - a simple completor that comples "
[niko@localhost temporal]$
当我运行它时,我收到此错误:
[niko@localhost temporal]$ java -classpath ./:jline/example/:./jline-0.9.94.jar Example
Exception in thread "main" java.lang.NoClassDefFoundError: Example (wrong name: jline/example/Example)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:792)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:449)
at java.net.URLClassLoader.access$100(URLClassLoader.java:71)
at java.net.URLClassLoader$1.run(URLClassLoader.java:361)
at java.net.URLClassLoader$1.run(URLClassLoader.java:355)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:354)
at java.lang.ClassLoader.loadClass(ClassLoader.java:424)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:308)
at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
at sun.launcher.LauncherHelper.checkAndLoadMain(LauncherHelper.java:482)
[niko@localhost temporal]$
这里有什么问题?