the most awesome guy ever.

The Blog of Darryl E. Clarke

  Random musings from a jaded coder who just needs a hug.

Posts Tagged ‘Java’

A Quickie on Using Android Studio on Ubuntu

Friday, May 17th, 2013

The original post below applies to old versions. For 0.4.x plus, you don’t need to do this. You just need to have a proper Oracle JRE/JDK installed system wide which you can do with this:

sudo add-apt-repository ppa:webupd8team/java
sudo apt-get update && sudo apt-get install oracle-jdk7-installer

With the recent preview release of Android Studio it’s important to know that it won’t work properly on Ubuntu with the OpenJDK that’s available.

Fortunately, it’s easy to get it going.

  1. Download the official Oracle JDK
  2. Unpack it (I put mine in ~/SDK/jdk1.7.0_21/ )
  3. Point your JAVA_HOME to this.
    ~/android-studio/bin$ export JAVA_HOME=~/SDK/jdk1.7.0_21/
  4. Run the android studio startup script.
    ~/android-studio/bin$ ./studio.sh
  5. Make awesome android apps.

Have Fun!

Tags: , , ,
Posted in Coding

PHP Java Bridge vs. Zend Platform Java Bridge

Friday, June 5th, 2009

A long time ago I posted some instructions on installing PHP/Java Bridge on Ubuntu and that post is getting quite a few reads, so I figured I’d post a follow up on how it was used.

Over the last year I had been using a Java Bridge from a Zend Framework application to access a Java only API.  And really, between the two bridges there are no differences.  They both work identical, they both work great.  Would I pay Zend for Zend Platform’s Enterprise license? No.  Why? Because both bridges perform the same.  The only differences are:

  1. Zend’s Java bridge already has a function called java_require and the open source PHP/Java Bridge needs you to include a file.
  2. PHP/Java Bridge has a java_cast function, and you need it.  Zend’s Java Bridge does not have, or need this.

With these two differences all you need is a little code in your bootstrap (or somewhere else useful) to cover them and all is golden. Your app should work with both Java Bridges without any issue.

/* no java_require() include the java.inc for PHP/Java Bridge */
if ( ! function_exists('java_require') ) {
    include "java/Java.inc";
}

/* declare this, it doesn't exist with Zend Java, but is needed for PHP/Java Bridge */
if ( ! function_exists('java_cast')) {
    function java_cast($whatever) {
        return $whatever;
    }
}

There’s probably a more graceful way of checking and doing this but that’s it, and it’s worked on a multi tiered build environment for over a year now.

Tags: , , , , ,
Posted in Coding, Java, PHP, Zend Framework

Eclipse and Ubuntu 8.04

Monday, April 7th, 2008

I was having some trouble running Eclipse 3.3 Europa on Hardy Heron.  It was unstable, crashing a lot, and hogging way more ram than it normally hogs.

Then I realized what I’d forgotten to do on this fresh install.  I forgot to simply ‘sudo update-java-alternatives -s java-6-sun’ and voila, it works like a charm.

Eclipse doesn’t work well with the gjc java (the ‘free’ and default) Hopefully this little thing won’t be an issue in the future when sun java 7 (open java) is ready to rock the free world.

Tags: , ,
Posted in Coding, Java, Linux