I have the following code generated by Eclipse (.java file).
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Display;
public class HelloWorldSWT {
/**
* @param args
*/
public static void main(String[] args) {
// TODO Auto-generated method stub
Display display = new Display();
Shell shell = new Shell(display);
shell.setText("Hello world!");
shell.open();
while (!shell.isDisposed()) {
if (!display.readAndDispatch()) display.sleep();
}
display.dispose();
}
}
Now I want to compile the above file from the command line. I went to the directory where the source code is located and I tried two commands:
1. javac HelloWorldSWT.java
2. javac -d /home/myname/workspace/ HelloWorldSWT.java
In both cases I have the same error "The import org.eclipse cannot be resolved". /home/myname/workspace/ - is the directory where the class file is located.
As far as I understand the compiler does not see the org.eclipse.swt package. Why?
Can it be because the problematic package is located in "/home/myname/workspace/org.eclipse.swt/" (not in "/home/myname/workspace/org/eclipse/swt/")?