Monday, 31 December 2012

Centos 6/RHEL install IntelliJIDEA Java IDE


IntelliJIDEA community edition is an extremely useful free IDE for Java, Scala, Groovy,PHP, Python, Ruby, Spring MVC, Webflow, Play, Grails, Web Services, JSF, Struts, Flex and others with version control support Git, CVS, Mercurial and Subversion. 

It also has support for HTML5, CSS3, SASS, LESS, Javascript, Coffeescript, Actionscript, and others & build tools for Maven, Ant, Gradle and Gant with database functionality for SQL, PostgreSQL, MySQL, Oracle and SqlServer.

There is much more to this popular IDE though, so it is worth perusing the documentation on the web site. It has Android and Lint support and as in the snippet below, drug and drop functionality, although what drug it refers to is unclear.



A huge array of features make IntelliJIDEA an extremely useful free IDE and it's ease of installation and use means it is well suited to a minimal Centos 6 Desktop.

Obviously, first make sure you have the Sun Java JDK installed, follow the link here if not, and when that's done, continue.

The community edition is simple to install and use on Centos 6/RHEL, simply download the tarball from IntelliJIDEA  
into your home directory.

$ su                                             to root 

Move to the directory where you want to install it.

# cd /usr/local                             and untar it

# tar xzf /home/<user_name>/ideaIC-12.0.1.tar.gz

This gives you an idea directory in /usr/local

# exit                         back to unprivileged user

Now with it in place you just need a symlink to /usr/bin

$sudo ln -s /usr/local/idea-IC-123.94/bin/idea.sh /usr/bin/idea.sh

(Change the path if you put it elsewhere)

With the symlink made you can now run it with 

$ idea.sh



At first run (building a Java app), you will need to set up the JDK path, and a dialogue box will appear for you to do this. Just click the add button if your JDK doesn't already show up and add it on, whereby the box will disappear.
Typically, '/usr/java/jdk1.7.0_07' will suffice and others like Android SDK can be added also, see the images below.

Testing a sample class

There are plenty of features to keep you busy for a while and I'd recommend reading through the website docs thoroughly, there are also quite a few video tutorials available from Jetbrains TV.

Fluxbox users see Fluxbox key bindings for shortcut info.

Android SDK

Below are screenshots of the first stages of creating an Android application, for which you will need to set the location of your Android SDK as shown.


Click File > New project, select Android application

Click the New tab and browse to your SDK location

Click OK if all is correct

Your SDK appears in the box so you can now continue


















Friday, 7 December 2012

Centos 6/RHEL install Dr Java

Dr Java is an interactive testing environment for java actually written in java and run on Linux by invoking the jar module. It is designed primarily for students, providing an intuitive interface and the ability to interactively evaluate Java code. It also includes powerful features for more advanced users so many pros find it useful in a similar manner to the BlueJ ide. Additionally, it can be customized and then a new version (jar file) of the customized app can be generated for subsequent use.

It is easy to use on a Centos 6/RHEL box as long as you have the Sun Java JDK installed, so first make sure that you have by following the link and the instructions.(You might want to install Eclipse while you are there as it is very easy to do, there is also a Dr Java plugin for Eclipse, see below)


There is also a Dr Java available from Princeton University and this is the one we will try first. This sets up a working environment for projects with the Princeton version of DrJava. 

Princeton version

Make a java projects directory

$ mkdir introcs

$ cd introcs

$ mkdir bin

Download and chmod the drjava files

$ wget http://introcs.cs.princeton.edu/java/linux/drjava.jar
$ wget http://introcs.cs.princeton.edu/java/linux/drjava
$ chmod 700 drjava
$ mv  drjava bin

Download the textbok standard library stdlib.jar

$ wget http://introcs.cs.princeton.edu/java/stdlib/stdlib.jar

Download Checkstyle 5.5 and Findbugs 2.0.1 from checkstyle.zip and findbugs.zip to ~/javaproj & download the checkstyle and findbugs execution scripts from checkstyle.sh and findbugs.sh to ~/javaproj/bin and chmod them executable

$ wget http://introcs.cs.princeton.edu/java/linux/checkstyle.zip
$ wget http://introcs.cs.princeton.edu/java/linux/findbugs.zip
$ unzip checkstyle.zip
$ unzip findbugs.zip
$ wget http://introcs.cs.princeton.edu/java/linux/checkstyle.xml
$ wget http://introcs.cs.princeton.edu/java/linux/findbugs.xml
$ wget http://introcs.cs.princeton.edu/java/linux/checkstyle
$ wget http://introcs.cs.princeton.edu/java/linux/findbugs

$ mv checkstyle findbugs bin
$ mv checkstyle.xml checkstyle-5.5
$ mv findbugs.xml findbugs-2.0.1

Add the standard libraries to the CLASSPATH environment variable and add checkstyle and findbugs to your PATH environment variable.

Download config.sh to ~/javaproj/bin

$ wget http://introcs.cs.princeton.edu/java/linux/config.sh
$ mv config.sh bin

Add the following line to the end of either ~/.bash_profile or ~/.profile depending on which you have.

test -r ~/introcs/bin/config.sh && source ~/introcs/bin/config.sh

Now you can run Dr Java with

$drjava


For introductory tutorials on Java you can go to Princeton University online, where you will also find the above instructions repeated. 

Standalone version

If you just want a standalone DrJava go to http://www.drjava.org/ and download the latest version of Dr Java, you will need to get the Jar file as we will be running it using the jar module
contained within the JDK.

If you have installed Eclipse along with the Java JDK then you may want to get the plug-in for it also at the same time.

Download to your home directory.


Rename it to something easier to type such as 'drjava'


$ mv drjava-stable-20120818-r5686.jar drjava.jar


Now open up a terminal and type


$ java -jar drjava.jar


This will launch Dr Java as below.



Dr Java

Dr Java Interactive Window

You can add the command to the Fluxbox keys file if using Fluxbox.

Fluxbox users see Fluxbox key bindings for more information.

Eclipse Plugin.

If you are installing the Eclipse plugin and have downloaded it, then first you need to unzip it.

$unzip drjava-eclipse-20090115-r4708.zip

Now copy the unzipped jar file into the Eclipse plugins directory

$ cp edu.rice.cs.drjava_0.9.9.20090115-r4708.jar /opt/eclipse/plugins/edu.rice.cs.drjava_0.9.9.20090115-r4708.jar

(Change the Eclipse path to suit your installation)

Now fire up Eclipse and go to Window ->Open Perspective ->Other and you will see an option for 'Dr Java', check this and the view as below should appear, with the Dr Java Interactive pane at the bottom.

Eclipse Dr Java view.

That is all there is to installing the Dr Java plugin in Eclipse.

Monday, 3 December 2012

Centos 6/RHEL install & uninstall Calibre Ebook Reader


Calibre is a fine cross platform Desktop Ebook reader developed by Kovid Goyal, available both from repos and as source files, although compiling from source is not recommended due to the large dependency requirement. 

Some of it's features include

  • Library Management
  • E-book conversion
  • Syncing to e-book reader devices
  • Download news from the web and convert into e-book form
  • Comprehensive e-book viewer
  • Content server for online access to your book collection 

Calibre supports many file formats and reading devices. The e-book formats can be edited by changing the font or the font size and by adding an auto-generated table of contents.

Conversion and editing is only possible after DRM restrictions have been removed from commercial e-book files. It doesn’t natively support this removal, but you can add plugins to accomplish this.


Calibre helps to organize the personal e-book library by allowing the user to sort and group e-books by metadata fields which can be pulled from many different sources such as ISBNdb.com,

Google_Books, Amazon.com, LibraryThing.

You can search for author, title or keyword in the whole library and you can import e-books either by adding files manually, or by syncing an e-book reading device. On-line content-sources can be harvested and converted to e-books. E-books can then be exported to all supported reading devices via USB or via the integrated mail-server.

Mailing e-books enables, for example, sending personal documents to the Kindle family of e-book readers.
The content of the library can be remotely accessed by a web browser, if the hosting computer is running and pushing content from content sources is supported on a regular interval.
 
So with Calibre you can not only read ebooks, but also convert .html documents into ebooks that can be published through both Amazon and Barnes & Noble.

It is straighforward to install using the supplied binaries on your Centos 6/RHEL box, first install the required dependencies.

$ sudo yum -y install glibc xdg-utils python

although it is likely that you have these already if you followed this tutorial to install your minimal Centos 6.

Now issue the command to download and install Calibre

$ sudo python -c "import sys; py3 = sys.version_info[0] > 2; u = __import__('urllib.request' if py3 else 'urllib', fromlist=1); exec(u.urlopen('http://status.calibre-ebook.com/linux_installer').read()); main(install_dir='/opt')"

Changing the install_dir and the end of the line from /opt to the one you require if necessary.

At the end of the download and install process you will simply see a message saying 'run with calibre'

$ calibre                      


You will find a Calibre library in your home directory and a sample Ebook to which you can add more.

To uninstall Calibre you can run the uninstaller script

$ sudo python /usr/bin/calibre-uninstall

Then delete the remaining files

$ sudo rm -rf /opt/calibre

For an Ebook program with a smaller footprint try FBReader.

Fluxbox users see Fluxbox key bindings for more information.

More repos.


Centos 6/RHEL install FBReader Ebook Reader


FBReader is a lightweight cross platform Ebook reader written by Nikolay Pultsin, originally for the Sharp Zaurus platform but now supporting multiple operating systems, including Android, Blackberry, OSX and others. Features include Network Library, Book Preview, White on Black, Text Search and more. It is not as well equipped as Calibre and doesn't have the Ebook publishing capability but is still a very useful Ebook program, especially if you are looking for one with a small footprint. 
Below are some of the features of FBReader.

  • It is a multi-platform e-book reader. Free for use, sources are available under the GPL.
  • Supports popular e-book formats like ePub, fb2, mobi, html, plain text, and a lot of other formats.
  • Provides access to popular network libraries that contain a large set of e-books. Download books for free or for a fee. Add your own catalog.
  • It is highly customizable. Choose colors, fonts, page turning animations, etc to make reading as convenient as you want.
Installing is easy as long as you have the Epel repo enabled, so go to the repositories page if you haven't, and scroll down to third party repos.
    Once Epel is installed, a simple command (--enablerepo=epel flag if not permanently done so)

    $ sudo yum -y install fbreader-gtk



    will bring the required dependencies and install FBReader for you.



    To run it you need the first letters in upper case as in

    $ FBReader


    The Adventures of Sylvia Scarlett - Ebook

    A useful lightweight addition to your Centos/RHEL desktop.

    For other Operating Systems see the FBReader website

    For a more advanced reader see Calibre.

    Fluxbox users see Fluxbox key bindings for more information.