I created Myproject folder. Inside I have 3 folders:
/lib
/src
/bin
Inside src there is a .java file:
Code:
public class hello_world{
public static void main(String[] args){
System.out.println("Hi, from hello_world");
seba.st.hello_world_package test1 = new seba.st.hello_world_package();
test1.packFunc();
}
}
inside lib is a .jar file which I created from this .java file:
Code:
package seba.st;
public class hello_world_package{
public void packFunc(){
System.out.println("hi from pack_func!");
}
}
I am trying to run this program from terminal with this command
Code:
javac -d bin -sourcepath src -cp lib/packEx.jar src/hello_world.java
and I get this error:
Code:
src/hello_world.java:11: error: cannot find symbol
test1.packFunc();
^
symbol: method packFunc()
location: variable test1 of type hello_world_package
1 error
What am I doing wrong ? How can I compile and run this program from terminal?