Beaglebone Black : Issues with Java on Ubuntu


java-duke-logoWhile I was starting work on my next walk-through, I discovered that I had not installed Java on my Ubuntu instance.  I don’t know why other than it simply didn’t come up.  When I originally installed it, I did it on Angstrom and had no issue.  Well, it was most certainly a different story with Ubuntu.

I downloaded the ARM version of JDK 1.7 from java.com and attempted to unpack it with this command:

tar -xvpzf jdk-7u40-linux-arm-vfp-hflt.tar.gz

Instead of a stream of files being strone across my screen, I received an error message:

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now

I thought that I had corrupted my instance so I unpacked my latest backup.  As a side note, I dug around a bit and discovered how to overwrite existing files.  Here’s that command:

tar --overwrite -xvpzf bbb-ubuntu.tar.gz

This reset my BBB to my standard setup.  After attempting to unpack the Java tarball again, I received the same error.  I also unpacked the package on my host machine and then moved it over to the BBB and attempted to run Java.  It looked at me like I was daft and replied with:

-su: jdk1.7.0_25/bin/java: No such file or directory

Hmmmmm.   Time for Dr. Google.

I found the answer in teensy sized print in the middle of a StackOverflow.com answer:

sudo apt-get install libc6-*

This adds/updates a buch of files (took about 15 minutes to download and install) but it didn’t seem to be too large (about 50MB).

Once this was complete, I was able to unpack my JDK files, then from the bin directory,  I ran java -version and received:

java version "1.7.0_25"
 Java(TM) SE Runtime Environment (build 1.7.0_25-b15)
 Java HotSpot(TM) Client VM (build 23.25-b01, mixed mode)

Now I can get back to work

https://dotnetdavid.wordpress.com/2013/07/12/apache-karaf-on-beaglebone-black/

http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

http://stackoverflow.com/questions/9081962/java-is-installed-in-listing-but-execution-produces-java-no-such-file-or-d

Advertisements

Ubuntu on BeagleBone Black


beagle_squareLast week, I finally became frustrated with Angstrom on my BeagleBone Black.  It’s could be that I have no patience for it.  Or It could be that I need more time with it.  Either way, it caused me to creatively string together new manifestations of my “Football words” and we’ll just leave it at that.

Without looking back, I just burned it to the ground and grabbed the Ubuntu image and burned it to my 8GB card. Without issue, it ran fine.  I am not running any of these systems via a monitor, just via SSH.  I put the SD card in, rebooted and SSH’d to it.  I was so impressed with how easy it worked, I’m hooked.  I installeed java, maven and repeated my Karaf install as well.  I got nutty and installed apache web server and mysql just because I could and it was wicked easy.  Oh yeah, I thought my wireless adaptor was defective because I just wasn’t able to get it working on Angstrom.  It took about 15 minutes to get it working under Ubuntu.

Though I won’t call my time with Angstrom a waste, I will say that it’s just not my cup of tea and I felt right at home with Ubuntu.  My next project is to see if I can get one or two different CMSs running on it so I can say that I did.  I will post a walk-through for how I set up Ubuntu on the BBB and some How-Tos for some of the apps but they really are fairly simple.

UPDATE:  Read my newest post on setting up Ubuntu on the BeagelBone Black, a multi-part series.

Linux Noobie – App Installation (Java Install Redux)


penguin-ubuntuSince burning my ship and switching between Mac and Linux (for work… At home, it’s straight-up Linux), I have found a much easier way of making software manageable for me.  This means its manageable BY me but that’s ok because with some apps, I need to control versioning.  This works with apps that are downloadable, don’t have a million and one dependencies and meant to run independently.

Previously, as most Linux users should, I used the package management system.  This is still a good practice, making installation and removal easy, not to mention patching/updates/upgrades/etc.  However, my local Ubuntu as a deathgrip on Java v7.  I don’t have anything against JDK7 and would prefer to use it.  However, my primary CMS is locked into JDK6, and JDK7 makes it very sad.

What I generally do for things like the JDK, Maven, MySQL, etc. is to put it through the Noobie Initializer of Dooooom:

  1. Unpack the tar/zip/suitcase to my /opt folder
  2. rename the folder to “<appname>-<version number>
  3. create a symbolic link to the app-version folder of my choosing
  4. add “export <app short name>_HOME=/opt/<symlink>” to my .bashrc
  5. add “…:$<app short name>_HOME/bin” to my path in .bashrc

This allows me the flexibility to swap out different versions so that I can evaluate new releases with my software easily without wrestling with the package mangler.  So far, I haven’t had any adverse issues with this process and the only caveat would be that I need to proactively seek out updates that may occur.  Since my current production/prod-like apps use the current version, I am slow to move to the next version without compelling, motivating factors like death, dismemberment or hunger.  However, I still check to see where I am at at least once a month or sooner if the mood strikes me.

Here’s a list of what I run with this method:

  • maven
  • vault
  • java
  • Sublime
  • groovy
  • grails
  • idea
  • jmeter
  • mysql
  • mongo

 

Apache Karaf on BeagleBone Black


beagle_squareLast night, I finally accepted the challenge thrown down by a co-worker (Architect’s Log).  I recently received my BBB and have been getting familiar with the environment.

First, I jumped right into the terminal of Angstrom, the preloaded linux distro.  It took a little while but I’m getting used to some of the nuances.  I started off with following the BeagleBone Linux 101 guide which seems to track pretty close to my experience.  SUDO is not available in the package download but I found a site where I could download and manually install to get running.

The next step was to get Java running.  I downloaded the jdk-7u25-linux-arm-sfp.tar.gz from the Java SE Downloads page but it doesn’t seem to be there anymore… jdk-7u21-linux-arm-sfp.tar.gz will work too.

I added Java to my path and tested.  Here’s my method:

  • add the uncompressed folder to /opt (had to create)
  • create symbolic link to this folder called java.  i.e. ln -s /opt/jdk1.7.0_25 java
  • add this to my .bashrc: “export JAVA_HOME=/opt/java
  • and this as last line: “export PATH=$PATH:$JAVA_HOME/bin:$MAVEN/bin:” (did I forget to mention I installed maven too?  Don’t worry… that’s coming up).
  • restart the BBB: shutdown -r now
  • after server returns test with “java -version” and bask in the glory

So, then I installed maven nearly the same exact way.

karaf-logo

I should add that I created a HOSTS entry for the ethernet interface for my BBB.Finally, I downloaded the source for karaf 2.3.2.  Once unpacked, I followed the instructions in the BUILDING file.  This didn’t go so well for me.  The build goes on for about 15 mins and then failed.  I tried a couple times but didn’t feel like debugging the issue (it was getting late).  I downloaded v.3.0.1.rc1 binary.  After unpacking to /opt I fired it up and it ran like a champ.  I even fired up the webconsole with “feature:install webconsole“.  Finally, on my laptop (on the same network), I navigate to http://beaglebone.local:8181/system/console/

So, the process worked but this is just the beginning.  Now I need to begin writing bundles to run on the BBB.  Check back to see how that goes.

Linux Noob: Et tu sudo?


Cesar-sa_mortI haven’t been here in a while so I’ll quickly sum up.  My work machine got sad and instead of replacing the hard drive, I was gifted a Mac.  Well, the Mac got sad so I made my Linux laptop work again.

Currently, I am running Ubuntu 13.  I have been playing around with some other distros but everyone here seems to be pretty happy with Ubuntu.  Personally, I never over-liked it but Mom always said to try new things.

I wish I had been documenting all the wonders to get this thing going but suffice it to say I have been “challenged.”  My latest bout with U13 was with sudo.

I have a rather complex development workstation config going on and so, to make things easier, I have a few environmental variables set, One being the $JAVA_HOME.  This works fine when banging around but I have an application server that I develop against locally that needs to run as root.  So, I kick off the the old sudo command and I get:  java: no can find.

Bah!

I run echo $JAVA_HOME and that works
I run sudo echo $JAVA_HOME and that works… hmm
but I run sudo java and I get the ‘no can find’

So I did a bit of looking about and I found that Ubuntu has some security fix to its sudo.  Though I am hesitant to circumvent this, I had to throw this in to make it work:

alias sudo='sudo env PATH=$PATH'

With that, all is better.  Now I can access java via root, user, and sudo.  weeeeeeeeeeeeee.

Here’s the article where I found this fix: http://stackoverflow.com/questions/257616/sudo-changes-path-why

Image source: http://en.wikipedia.org/wiki/File:Cesar-sa_mort.jpg

Linux Noob: Java in the Browser (Chrome or Firefox) on Fedora 14 64 bit


Ack!  This was not an intuitive endeavor to get Java applets running in Linux but I finally got it done.  Here’s what I did.

Though I used the defaults, my installation for Java seems to be a bit different than one’s I have seen on the web while I was researching this issue.  Here is my path:

/usr/java/jdk1.6.0_24/jre/lib/amd64/

I found an article that closely described the fix (click here).  You need to create a symbolic link that looks something like this:

ln -s /usr/java/jdk1.6.0_24/jre/lib/amd64/libnpjp2.so

,,,AND… this needs to be in the correct folder.  So for my instance (64bit), this symbolic link needed to be created in the following folder:

/usr/lib64/mozilla/plugins

So, to put it all together, it should go something like this:

[root@Dave ~]# cd /usr/lib64/mozilla/plugins
[root@Dave plugins]# ln -s /usr/java/jdk1.6.0_24/jre/lib/amd64/libnpjp2.so
[root@Dave plugins]# ls
libflashplayer.so                      libtotem-gmp-plugin.so
libnpjp2.so                            libtotem-mully-plugin.so
librhythmbox-itms-detection-plugin.so  libtotem-narrowspace-plugin.so
libtotem-cone-plugin.so
[root@Dave plugins]#

I then refreshed my browser and the applets started flowing.

See how easy that was?

😛