How do I create a Java Package and Test it Using Vim in Linux
I know how to create a java package, write code in the /src folder and
test it from the /tst folder. But, I want to learn how I can do that
without Eclipse, just using Vim.
For example, I have a java Hello World Class:
class HelloWorld {
public void disp() {
System.out.println("Hello World");
}
}
I save this in a directory home/javacode/HelloWorld
Now, I write a test for it in the same folder :
import org.junit.*;
class HelloWorldTest extends HelloWorld {
@Test testHelloWorld() {
HelloWorld hello = new HelloWorld();
hello.disp();
}
}
Now, can someone please help me as to how to get this test to run? As in I
have to compile Hello World as :
javac HelloWorld.java
and then compile the test as :
javac -cp "path to junit" HelloWorldTest.java
However, I always end up with a ClassPath error. I understand that I am
really messing up something very fundamental here. Please do help me out
with this!
No comments:
Post a Comment