I installed new version of eclipse Kepler instead of Indigo. My current OS is Ubuntu 12.04.
All looks fine and setting Ubuntu update the same as was at Indigo.
But some error
happens when I try to run easy program:
package polymorphism;
class AlertStatus {
public String getStatus() {
return "None";
}
}
class RedAlertStatus extends AlertStatus {
public String getStatus() {
return "Red";
}
}
class GreenAlertStatus extends AlertStatus {
public String getStatus() {
return "Green";
}
}
class YellowAlertStatus extends AlertStatus {
public String getStatus() {
return "Yellow";
}
}
class Starship {
private AlertStatus status = new RedAlertStatus();
public void setStatus(AlertStatus aStatus) {
status = aStatus;
}
public String toString() {
return status.getStatus();
}
}
public class StarshipDemo {
public static void main(String[] args) {
Starship starfish = new Starship();
System.out.println(starfish);
starfish.setStatus(new GreenAlertStatus());
System.out.println(starfish);
starfish.setStatus(new YellowAlertStatus());
System.out.println(starfish);
}
}
Here is error message:
Error: Could not find or load main class polymorphism.StarshipDemo
I couldn't figure out why this error happen and how to avoid it?
Here is java -version
:
nazar_art@nazar-desctop:~$ java -version
java version "1.7.0_40"
Java(TM) SE Runtime Environment (build 1.7.0_40-b43)
Java HotSpot(TM) 64-Bit Server VM (build 24.0-b56, mixed mode)
Questions:
- Why exactly this error erase?
- How to solve this trouble?
Update:
I solved this by save before running program:
Ctrl + S => Ctrl + F11
All is working perfect now, but why this exactly happen?
At Indigo version I could fixed code and rerun (Ctrl + F11
) at any time and all was re-recompiling and executing again.
Does exist any way to circumvent this "save" part?