- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hello,
I recently got an Intel Edison here at work and I've been playing around with it. I'd like to write code in Java because I'm more familiar with it. (I haven't been able to get the Eclipse IDE to work for some unknown reason but that's not why I'm posting.)
I'm trying to compile this simple Java file on the Edison:
import mraa.Dir;
import mraa.Gpio;
import mraa.IntelEdison;
import mraa.mraa;
import mraa.Platform;
import mraa.Result;
public class HelloEdison
{
static
{
try
{
System.loadLibrary("mraajava");
}
catch (UnsatisfiedLinkError e)
{
System.err.println("Blah \n" + e);
System.exit(1);
}
}
public static void main(String argv[])
{
System.out.println(mraa.getVersion());
System.out.println("This has been a test of Intel Edison \n");
}
}
I put that file "HelloEdison.java" in my home directory and I run:
"javac -cp /usr/lib/java/mraa.jar -d bin HelloEdison.java" (note that if I use "/ur/lib/java/*.jar" it fails because "tinyb.jar is an invalid flag")
and it compiles with no issue. "HelloEdison.class" appears in the bin directory.
I move to the bin directory and run:
"java -cp /usr/lib/java*:HelloEdison.java HelloEdison"
and I get the following error:
Exception in thread "main" java.lang.NoClassDefFoundError: mraa/mraa
at HelloEdison.main(HelloEdison.java:26)
Cause by: java.lang.ClassNotFoundException: mraa.mraa
etc etc
What am I doing wrong?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hi jakelstr,
Thanks for your interest in the Intel® Edison Platform.
I just wanted to let you know that you're on the right track! I actually went ahead and replicate your issue, I noticed that once you have compiled your Java code, you needed to access the bin directory created from this process and run the command: java -cp /usr/lib/java/mraa.jar:. HelloEdison instead of java -cp /usr/lib/java*:HelloEdison.java HelloEdison.
Here is an image of the code running on my Edison:
Please let me know if this fixes your issue.
I will be waiting for your reply, have a nice day!
Best Regards,
-Jose P.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hi jakelstr,
Thanks for your interest in the Intel® Edison Platform.
I just wanted to let you know that you're on the right track! I actually went ahead and replicate your issue, I noticed that once you have compiled your Java code, you needed to access the bin directory created from this process and run the command: java -cp /usr/lib/java/mraa.jar:. HelloEdison instead of java -cp /usr/lib/java*:HelloEdison.java HelloEdison.
Here is an image of the code running on my Edison:
Please let me know if this fixes your issue.
I will be waiting for your reply, have a nice day!
Best Regards,
-Jose P.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
Hi jakelstr,
I'm glad that it worked! Please don't hesitate to come back if any questions come up.
Have a great day!
Best Regards,
-Jose P.

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page