我有这个代码:
package org.test;
import org.test.utils.Logger;
public class Test
{
public static void main(String[] args)
{
}
}
在文件:
/var/www/test/src/org/test/Test.java
还有这个其他文件:
package org.test.utils;
public class Logger
{
}
在文件:
/var/www/test/src/org/test/utils/Logger.java
但是当我从 sublime 编译它时,它说:
Compiling Java sourcecode...
Test.java:3: error: package org.test.utils does not exist
import org.test.utils.Logger;
^
1 error
Compiling error, no .class file created
[Finished in 0.8s]
我正在使用本手册:http ://binarydaydreams.wordpress.com/2012/08/08/compiling-java-with-sublimetext2-on-ubuntu/
我是Java的新手......我做错了什么?
编辑 1
Java 信息
$ java -version
java version "1.7.0_40"
Java(TM) SE Runtime Environment (build 1.7.0_40-b43)
Java HotSpot(TM) 64-Bit Server VM (build 24.0-b56, mixed mode)
* 编辑 2 *
如果我尝试只编译记录器文件,错误是这样的:
Compiling Java sourcecode...
Running the compiled code...
Exception in thread "main" java.lang.NoClassDefFoundError: Logger (wrong name: org/test/utils/Logger)
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(ClassLoader.java:788)
at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:142)
at java.net.URLClassLoader.defineClass(URLClassLoader.java:447)
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)
[Finished in 0.9s with exit code 1]