I checked few other stackoverflow posts. But I am not able to call a function that is present in another project.
SampleTwo.java
package a.two;
public class SampleTwo {
public static void bar() {
System.out.println("Bar");
}
public static void main(String[] args) {
bar();
}
}
Updated SampleOne.java
package a.samp;
import a.two.*;
public class SampleOne {
public static void foo() {
System.out.println("Foo");
SampleTwo.bar(); // <------ I want this to work
}
public static void main(String[] args) {
foo();
}
}
Here is my project properties of both projects
[Version 1: Before blackjack26's answer]
Eclipse shows the error SampleTwo cannot be resolved
Can you please tell if I am missing something? Thanks!
[Version 2: After blackjack26's answer]
Exception in thread "main" java.lang.Error: Unresolved compilation problem:
SampleTwo cannot be resolved
[Version 3] Removed SampleOne from SampleTwo's project property fixed it.