Reputation: 119
I am using command line to run java file. Here's my files:
Class files: workspace/test/src/test/test.class
Java files: workspace/test/src/test/test.java
My command line is (CLASSPATH is already setted):
D:\Twitter\workspace\test\src\test>java test
And my error is:
Exception in thread "main" java.lang.NoClassDefFoundError: test (wrong name: tes
t/test)
Anyone know how to solve this?
Upvotes: 0
Views: 101
Reputation: 9954
You have to provide the fully qualified class name (FQCN) to the java
command. Your class is named test
(Test
as a class name would be better) and is in the package test
. Therefore the FQCN is test.test
.
To start your program you have to call java test.test
. from D:\Twitter\workspace\test\src
.
Upvotes: 1
Reputation: 9601
Try:
D:\Twitter\workspace\test\src\test>cd ..
D:\Twitter\workspace\test\src>java test.test
Upvotes: 0