Re: [akka-user] Akka not working in java environment

259 views
Skip to first unread message

√iktor Ҡlang

unread,
Jun 14, 2012, 5:41:45 PM6/14/12
to akka...@googlegroups.com


On Thu, Jun 14, 2012 at 10:21 PM, Tsume <alpha...@gmail.com> wrote:
Hi,

I'm very new to Akka and trying to follow the guide which was provided, but I just cant get the Pi calculation program to work.
Initially I tried to run the program in Eclipse but I get the error shown in the attached image. The error refers to "import akka.actor.ActorRef;" statement.

I then tried to run the program through the terminal, first by compiling
javac -cp lib/scala-llibrary.jar;lib/akka/akka-actor-2.0.1.jar tutorial/akka/tutorial/first/java/Pi.java

javac is the compile, not the jvm. use "java" instead

Cheers,
 

No problems there, but when I try run it using this command
javac -cp lib/scala-llibrary.jar;lib/akka/akka-actor-2.0.1.jar;. akka.tutorial.first.scala.Pi
I get an error saying Class names, 'akka.tutorial.first.scala.Pi', are only accepted if annotation processing is explicitly requested
I looked the error up online and it's said to occur in Java when ".java" is not specified for the file being compiled, but I did.

I'm really not sure what I should do. I find the guide not to clear for people jumping from Java into Akka. For example why am I running "akka.tutorial.first.scala.Pi" and not just "Pi"? Also why was there no executable created i.e. Pi.jar file?

--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To view this discussion on the web visit https://groups.google.com/d/msg/akka-user/-/URDs8M52kOEJ.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.



--
Viktor Klang

Akka Tech Lead
Typesafe - The software stack for applications that scale

Twitter: @viktorklang

Patrik Nordwall

unread,
Jun 15, 2012, 6:34:21 AM6/15/12
to akka...@googlegroups.com
Regarding the Eclipse error. Make sure you have Scala Library in the project build path. I think there were some problems with the ordering of JRE Library and Scala Library in earlier versions of Eclipse Scala IDE. If that is still the case in the version you are using you can try to change the order of them in the build path.

Patrik Nordwall

Typesafe The software stack for applications that scale

Twitter: @patriknw


√iktor Ҡlang

unread,
Jun 16, 2012, 10:20:09 AM6/16/12
to akka...@googlegroups.com


On Sat, Jun 16, 2012 at 3:27 PM, Tsume <alpha...@gmail.com> wrote:
Excuse me while I find a wall to bang my head against.

Have fun!
 
Thanks for the help I guess I was so frustrated with the code not working in Eclipse I ignored such a minor detail


Happy hakking!

Cheers,
√ 


On Thursday, 14 June 2012 23:41:45 UTC+2, √ wrote:
On Thu, Jun 14, 2012 at 10:21 PM, Tsume <alpha...@gmail.com> wrote:
Hi,

I'm very new to Akka and trying to follow the guide which was provided, but I just cant get the Pi calculation program to work.
Initially I tried to run the program in Eclipse but I get the error shown in the attached image. The error refers to "import akka.actor.ActorRef;" statement.

I then tried to run the program through the terminal, first by compiling
javac -cp lib/scala-llibrary.jar;lib/akka/akka-actor-2.0.1.jar tutorial/akka/tutorial/first/java/Pi.java

javac is the compile, not the jvm. use "java" instead

Cheers,
 

No problems there, but when I try run it using this command
javac -cp lib/scala-llibrary.jar;lib/akka/akka-actor-2.0.1.jar;. akka.tutorial.first.scala.Pi
I get an error saying Class names, 'akka.tutorial.first.scala.Pi'are only accepted if annotation processing is explicitly requested
I looked the error up online and it's said to occur in Java when ".java" is not specified for the file being compiled, but I did.

I'm really not sure what I should do. I find the guide not to clear for people jumping from Java into Akka. For example why am I running "akka.tutorial.first.scala.Pi" and not just "Pi"? Also why was there no executable created i.e. Pi.jar file?

--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To view this discussion on the web visit https://groups.google.com/d/msg/akka-user/-/URDs8M52kOEJ.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.



--
Viktor Klang

Akka Tech Lead
Typesafe - The software stack for applications that scale

Twitter: @viktorklang

--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To view this discussion on the web visit https://groups.google.com/d/msg/akka-user/-/DR-OmPitCW0J.

To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.

Roland Kuhn

unread,
Jun 16, 2012, 3:54:43 PM6/16/12
to akka...@googlegroups.com

16 jun 2012 kl. 21:12 skrev Tsume:

I added the Scala library as you suggested, now I have another problem. Eclipse builds the project fine but when I try run it I get an error saying that a "Java exception has occurred" from the Java virtual machine launcher. Eclipse shows a warning for "UntypedActorFactory()" when creating the master.
The warning is as follows: The serializable class does not declare a static final serialVersionUID field of type long

But if I am able to run the code through the terminal but not Eclipse. After the JVM launcher error the console gives the following list of errors

Have you tried following the full tutorial on akka.io so that this step (http://doc.akka.io/docs/akka/2.0.2/intro/getting-started-first-java.html#Run_it_inside_Maven) actually works? If you got there, you should be able to create an eclipse project definition which includes all necessary libraries using “mvn eclipse” (IIRC, have not used Maven in quite some while). Setting up the project manually is not completely trivial, but that is not in any way specific to Akka.

Regards,

Roland

Exception in thread "main" java.lang.NoClassDefFoundError: scala/Serializable
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$100(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at java.lang.Class.getDeclaredMethods0(Native Method)
at java.lang.Class.privateGetDeclaredMethods(Unknown Source)
at java.lang.Class.getMethod0(Unknown Source)
at java.lang.Class.getMethod(Unknown Source)
at sun.launcher.LauncherHelper.getMainMethod(Unknown Source)
at sun.launcher.LauncherHelper.checkAndLoadMain(Unknown Source)
Caused by: java.lang.ClassNotFoundException: scala.Serializable
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 18 more

On Friday, 15 June 2012 12:34:21 UTC+2, Patrik Nordwall wrote:
Regarding the Eclipse error. Make sure you have Scala Library in the project build path. I think there were some problems with the ordering of JRE Library and Scala Library in earlier versions of Eclipse Scala IDE. If that is still the case in the version you are using you can try to change the order of them in the build path.

On Thu, Jun 14, 2012 at 11:41 PM, √iktor Ҡlang <viktor...@gmail.com> wrote:
On Thu, Jun 14, 2012 at 10:21 PM, Tsume <alpha...@gmail.com> wrote:
Hi,

I'm very new to Akka and trying to follow the guide which was provided, but I just cant get the Pi calculation program to work.
Initially I tried to run the program in Eclipse but I get the error shown in the attached image. The error refers to "import akka.actor.ActorRef;" statement.

I then tried to run the program through the terminal, first by compiling
javac -cp lib/scala-llibrary.jar;lib/akka/akka-actor-2.0.1.jar tutorial/akka/tutorial/first/java/Pi.java

javac is the compile, not the jvm. use "java" instead

Cheers,
 

No problems there, but when I try run it using this command
javac -cp lib/scala-llibrary.jar;lib/akka/akka-actor-2.0.1.jar;. akka.tutorial.first.scala.Pi
I get an error saying Class names, 'akka.tutorial.first.scala.Pi', are only accepted if annotation processing is explicitly requested
I looked the error up online and it's said to occur in Java when ".java" is not specified for the file being compiled, but I did.

I'm really not sure what I should do. I find the guide not to clear for people jumping from Java into Akka. For example why am I running "akka.tutorial.first.scala.Pi" and not just "Pi"? Also why was there no executable created i.e. Pi.jar file?

--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To view this discussion on the web visit https://groups.google.com/d/msg/akka-user/-/URDs8M52kOEJ.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.



--
Viktor Klang

Akka Tech Lead
Typesafe - The software stack for applications that scale

Twitter: @viktorklang


--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+unsubscribe@googlegroups.com.

For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.



--

Patrik Nordwall
Typesafe The software stack for applications that scale
Twitter: @patriknw



--
You received this message because you are subscribed to the Google Groups "Akka User List" group.
To view this discussion on the web visit https://groups.google.com/d/msg/akka-user/-/UEMxsuLo3_oJ.

To post to this group, send email to akka...@googlegroups.com.
To unsubscribe from this group, send email to akka-user+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/akka-user?hl=en.

Roland Kuhn
Typesafe – The software stack for applications that scale.
twitter: @rolandkuhn


Reply all
Reply to author
Forward
0 new messages