-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
cannot find symbol symbol: class Greet #32337
Comments
If you must stay on JDK 8 the last version of Akka supporting it is 2.8.5, you could try building the quickstart with that. |
Hi Johanadren, thank you for your reply. Actually I am using Akka 2.8.5. Here is my pom file. Is there anyproblem with it? 4.0.0
|
And my java version is 1.8 and maven version is 3.8.3. Should the version of maven be same as the version of maven compiler plugin? |
Ah, I see now what is wrong, you have probably cloned the entire java quickstart repository, but that is structured for project creation through the sbt (the build tool most common for Scala) templating functionality, not to be cloned and run directly. Generally such project creation is done via If you do not want to install sbt to do that you can instead download a zip file of the project template from this page: https://developer.lightbend.com/guides/akka-quickstart-java/ and it should work as expected. |
Hi Johanandren, Thank you for the information. Scala is an interesting and new language for me. But it seems not to be the reason of problem. I finally found the bug is cuased by java version incompatibility. The code below (which is a record class, only supported by java 14 version and afterwards), is not supported by java 8. public static record Greet(String whom, ActorRef<Greeted> replyTo) {}
public static record Greeted(String whom, ActorRef<Greet> from) {} So I change these code into typical class, and it works. Cheers! public static final class Greet{
private final String whom;
private final ActorRef<Greeted> replyTo;
public Greet(String whom, ActorRef<Greeted> replyTo){
this.whom = whom;
this.replyTo = replyTo;
}
public String whom(){
return this.whom;
}
public ActorRef<Greeted> replyTo(){
return this.replyTo;
}
public String toString(){
return String.format("Point[x=%s, y=%s]", this.whom, this.replyTo);
}
public boolean equals(Object o){
return true;
}
public int hashCode(){
return 110;
}
} public static final class Greeted{
private final String whom;
private final ActorRef<Greet> from;
public Greeted(String whom, ActorRef<Greet> from){
this.whom = whom;
this.from = from;
}
public String whom(){
return this.whom;
}
public ActorRef<Greet> from(){
return this.from;
}
public String toString(){
return String.format("Point[x=%s, y=%s]", this.whom, this.from);
}
public boolean equals(Object o){
return false;
}
public int hashCode(){
return 120;
}
} |
Ah, sorry, didn't remember that, yes, we switched to showcasing newer JDK features a while ago, if you start from commit akka/akka-quickstart-java.g8@269d369 I think that should still work with JDK 8 (alternatively rewrite those records to regular Java classes like you did) |
Yeah, thanks. And I also create a new repo for java8 version, for new beginners like me. Here is the link https://github.com/shaoshuaidu/akka-quickstart-java8. |
Thanks for sharing, I'll close this issue now. |
Hi, everyone! I am new to java and akka, I try to run akka-quickstart-java demo but this error keeps happen. Mybe this problem happens due to the java version. But I work on a supercomputer cluster so I am not able to update the java8 to 11 or 17.
Anyone can help me with this problem? thank you in advance.
[ERROR] COMPILATION ERROR :$package$ .Greeter$package$ .Greeter$package$ .Greeter$package$ .Greeter$package$ .Greeter$package$ .Greeter$package$ .Greeter$package$ .Greeter$package$ .Greeter$package$ .Greeter$package$ .Greeter$package$ .Greeter$package$ .Greeter$package$ .Greeter$package$ .Greeter$package$ .Greeter$package$ .Greeter$package$ .Greeter$package$ .Greeter$package$ .Greeter$package$ .Greeter$package$ .Greeter$package$ .Greeter
[INFO] -------------------------------------------------------------
[ERROR] /home/sdu/dss_git/akka-quickstart-java.g8/src/main/g8/src/main/java/$package$/Greeter.java:[10,54] cannot find symbol
symbol: class Greet
location: class
[ERROR] /home/sdu/dss_git/akka-quickstart-java.g8/src/main/g8/src/main/java/$package$/GreeterBot.java:[6,57] cannot find symbol
symbol: class Greeted
location: class
[ERROR] /home/sdu/dss_git/akka-quickstart-java.g8/src/main/g8/src/main/java/$package$/GreeterBot.java:[8,35] cannot find symbol
symbol: class Greeted
location: class
[ERROR] /home/sdu/dss_git/akka-quickstart-java.g8/src/main/g8/src/main/java/$package$/GreeterBot.java:[15,44] cannot find symbol
symbol: class Greeted
location: class
[ERROR] /home/sdu/dss_git/akka-quickstart-java.g8/src/main/g8/src/main/java/$package$/GreeterBot.java:[21,27] cannot find symbol
symbol: class Greeted
location: class
[ERROR] /home/sdu/dss_git/akka-quickstart-java.g8/src/main/g8/src/main/java/$package$/GreeterBot.java:[25,56] cannot find symbol
symbol: class Greeted
location: class
[ERROR] /home/sdu/dss_git/akka-quickstart-java.g8/src/main/g8/src/main/java/$package$/GreeterBot.java:[25,29] cannot find symbol
symbol: class Greeted
location: class
[ERROR] /home/sdu/dss_git/akka-quickstart-java.g8/src/main/g8/src/main/java/$package$/Greeter.java:[12,52] cannot find symbol
symbol: class Greeted
location: class
[ERROR] /home/sdu/dss_git/akka-quickstart-java.g8/src/main/g8/src/main/java/$package$/Greeter.java:[12,17] cannot find symbol
symbol: class record
location: class
[ERROR] /home/sdu/dss_git/akka-quickstart-java.g8/src/main/g8/src/main/java/$package$/Greeter.java:[13,54] cannot find symbol
symbol: class Greet
location: class
[ERROR] /home/sdu/dss_git/akka-quickstart-java.g8/src/main/g8/src/main/java/$package$/Greeter.java:[13,17] cannot find symbol
symbol: class record
location: class
[ERROR] /home/sdu/dss_git/akka-quickstart-java.g8/src/main/g8/src/main/java/$package$/Greeter.java:[15,26] cannot find symbol
symbol: class Greet
location: class
[ERROR] /home/sdu/dss_git/akka-quickstart-java.g8/src/main/g8/src/main/java/$package$/Greeter.java:[19,32] cannot find symbol
symbol: class Greet
location: class
[ERROR] /home/sdu/dss_git/akka-quickstart-java.g8/src/main/g8/src/main/java/$package$/Greeter.java:[24,18] cannot find symbol
symbol: class Greet
location: class
[ERROR] /home/sdu/dss_git/akka-quickstart-java.g8/src/main/g8/src/main/java/$package$/Greeter.java:[28,35] cannot find symbol
symbol: class Greet
location: class
[ERROR] /home/sdu/dss_git/akka-quickstart-java.g8/src/main/g8/src/main/java/$package$/Greeter.java:[28,20] cannot find symbol
symbol: class Greet
location: class
[ERROR] /home/sdu/dss_git/akka-quickstart-java.g8/src/main/g8/src/main/java/$package$/GreeterMain.java:[17,35] cannot find symbol
symbol: class Greet
location: class
[ERROR] /home/sdu/dss_git/akka-quickstart-java.g8/src/main/g8/src/main/java/$package$/GreeterBot.java:[22,53] cannot find symbol
symbol: class Greeted
location: class
[ERROR] /home/sdu/dss_git/akka-quickstart-java.g8/src/main/g8/src/main/java/$package$/GreeterBot.java:[31,44] cannot find symbol
symbol: class Greet
location: class
[ERROR] /home/sdu/dss_git/akka-quickstart-java.g8/src/main/g8/src/main/java/$package$/Greeter.java:[25,42] cannot find symbol
symbol: class Greet
location: class
[ERROR] /home/sdu/dss_git/akka-quickstart-java.g8/src/main/g8/src/main/java/$package$/Greeter.java:[31,32] cannot find symbol
symbol: class Greeted
location: class
[ERROR] /home/sdu/dss_git/akka-quickstart-java.g8/src/main/g8/src/main/java/$package$/GreeterMain.java:[37,25] cannot find symbol
symbol: class Greeted
location: class
[ERROR] /home/sdu/dss_git/akka-quickstart-java.g8/src/main/g8/src/main/java/$package$/GreeterMain.java:[39,33] cannot find symbol
symbol: class Greet
location: class
[INFO] 23 errors
[INFO] -------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
The text was updated successfully, but these errors were encountered: