[General Topics] S0AndS0:
7:4 Methods of installing or unpacking (Part 2)

_______Split

7:4 Methods of installing or unpacking

1. Moving files between android and linux when their dual-booted.

2. Un-zipping packages and the .rar's that sometimes get in the mix.

3. Installing or running .sh formated installers or scripts.

7:4-4. Installing from sources.

Apt-get is great for installing and uninstalling a plethora of fun and usefull software, however, it’s not going to be the magic bullet for installing everything you may want on your new linux system. What follows are the steps that I take when installing experimental and unsupported software to my devices. As always be careful when copying what I suggest here as your system may have differences to mine.

7:4-4.1 Unpacking tar.gz files

At some point you'll run into the need to extract or unpack something that you can't normally install. For this example I'll show you how to unpack java from sun built to run on ARM linux; you may find it at the link bellow and then download and copy to a new folder in your home directory named 'SourceFiles' or something that you'll remember.

http://www.oracle.com/technetwork/java/embedded/downloads/javase/index.html

1. Run the following commands to back out with change directory to the root comand line, then the next to extract the file

# cd /home/[username]/SourceFiles

# sudo tar -xzvf /home/[username]/SourceFiles/ejre-*

2. Input your password and let it sit for a bit

3. Next we'll move to the next section; installing Java for ARM

7:4-4.2 Installing Java for ARM from source

1. First to make sure my system is cleaned or purged of openjdk I ran the following command.

# sudo apt-get purge openjdk*

2. Make a new folder in the "usr/lib" called "jvm" by first "cd" over to it in the command window

# cd /usr/lib

3. Then make the directory or file with:

# sudo mkdir /jvm

4. Then we move the extracted source files over to jvm folder found under the [root directory of your device]/usr/lib/

# sudo cp -rv /home/[username]/SourceFiles/ejrel1.7.0_21/ /usr/lib/jvm/

Note: if you get "cp: cannot stat..." errors; then run

# cd ~

To get back to the root of your bash screen and try again.

Note: the letter 'v' in both the "cp -rv /home*" and the "tar -xzvf /home*" commands can be removed to keep the amount of text whizzing by to a minimum.

5. Then we create a system link in “sbin/java” that points back to where java is located (think of it like a shortcut that your system can use to run Java commands without asking you where it’s installed) with the following command

# sudo ln -fs /usr/lib/jvm/lib/java /sbin/java

Note: in the above command; the "-fs" part = 'f' forces the link, this makes it so that you can re-run this command if it messes up the first time and the 's' part = create a symbolic link, this is like a short cut... sort of, there are different kinds and you can find more by using

# ln --help

in a terminal window.

Note: the "/usr/lib/jvm/lib/java" part of the command = the full path to wherever the java executable really is and the "/sbin/java" part = where your system normally puts links in. These parts may need changing in odd cases, but, if you've followed along so far without issue then it should be 'safe' to continue.

6. Finally we check that the system can now find java with the following command

# java -version

7. Lone behold you'll likely get an error message stating how "java" isn't a bash command. All is not lost though; we just need to take this to the next guide... 4:2-4.3 Adding Commands to Bash... I know this because you can check your java version by running

# /usr/lib/jvm/lib/java -version

7:4-4.3 Adding Commands to Bash

There be two ways to go about this; one is temporary and uses the alias command in a terminal window, it lasts until your connection ends; the other is getting into your linux bash command file and adding the commands, this will last until you overwrite it again or restore it from a backup of the original or reinstall the entire linux distro, this carries small risk of breaking your install but it seems worth the trouble...

1. Open Remote RDP and log in as a normal user

2. Open the file browser (navigate to the home directory for your user if you're not already there)

3. Mouseover to 'view' at the top of the window (its between 'bookmarks' and 'tools') and select 'show hidden files'

4. Make a new folder for backups of linux system files and a new folder in that explaining where to put the back up. For example mine looks like this: /home/[username]/BackItUP/found_in_home.[username]/[file-that-i-backed-up]

5. Find the file called ".bashrc"

6. Copy the file to the backups folder

7. Open the file ".bashrc" under the original file path eg: "/home/[username]/" with leafpad

8. Ensure the part about aliases has the 'if' statement not commented out. Meaning that if you scroll all the way down in leafpad there should be no '#' before the 'if [ -f ~bash_aliasas*' where you to find one remove it and save the changes

9. Make a new file in your home directory titled '.bash_aliases' by sending the right click command to a blank spot in your home directory and selecting new and selecting create new blank file

Note. If you don't still have hidden files set as visible then the new file will not show up until you do.

10. Open the new file with leafpad and add aliases using the following format

# alias<desired alias>='<linux_command>'

So for this case we'll use this following command to make an alias for java so it can finely run free.

alias java='/usr/lib/jvm/lib/java'

Note: the single quotes around the file path need to be there.

11. Save and test.

Note: you may have to restart your connection ie: log out and back in for the changes to take effect. Totaly worked for me though :)

Note install prossess not yet compleat; running '.jar' files still return errors. Now trying some new commands:

To let the system know there's a new program to play with we'll use the following command

# sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/lib/java" 1

And to make it the default runtime for java commands we'll use the next command

# sudo update-alternatives --set java /usr/lib/jvm/lib/java

Navigate to the /ect folder on the root of your device and open the enviroment file with LeafPad; add the following lines and save it (of course make a back up befor aplying changes) log out and log back in for changes to take effect

JAVA_HOME="/usr/lib/jvm"

Edit your bashrc file with:

nano ~/.bashrc

And add the following two lines to the tail end and sava and exit:

export JAVA_HOME="/usr/lib/jvm"

export PATH=$PATH:$JAVA_HOME/bin

7:4:4.1- Installing Map Tools

Map tools is Java dependent, meaning that the first steps will involve searching and installing a Java runtime environment with the steps in 7:4-4.1. Then we'll download a map tools zip, unpack it and run the '.jar' file NOT the .sh or .exe as the former is broken and the latter is for windows.

1. Navigate your android browser or iceweasel over to the following link and download ‘maptool-1.3.b89.zip’

http://www.rptools.net/?page=downloads#MapTool

2. Once the download has finished open up a file browser on either OS and copy/past the .zip file over to the following example file path

/home/[your-username]/download

3. Now to unpack/unzip the file...

if this is the first time that your linux distribution you’ll be prompted to select an application to open .zip files with.

in which case you can select the triangle next to ‘other’

scroll down to ‘xarchiver’ and select it and move to step 4 of this mini guide

... or

if this is not the first time that you’ve unzipped something with your linux distribution

just send the ‘right click’ command to the ‘.zip’ file

select extract and move to step 4 of this mini guide

4. Select where you want to extract maptools.zip by ‘clicking’ on the folder icon and in the new window that pops up navigate to the location that you want to extract to.

5. Once maptools has been extracted its time to open a terminal, either though connectbot ssh or by clicking on the programs menu button, mousing up to accessories and clicking on either terminal window option.

6.

7:4:4:2 Solved: Installing jMonkey on Android

1. Download jMonkey from their website. For Linux you’ll want the one ending in ‘*.sh’ and then transfer it to the linux os partition or file structure so you have full read/write permissions over it from the linux side of things

http://jmonkeyengine.org/downloads/?did=2

2. Open a file browser in your prefered RDP GUI application and navigate to the ‘jME3_SDK_3.ORC2-linux.sh’ file; for me I put it in ‘/home/[user-name]/Downloads

3. Right click the ‘*.sh’ file and click ‘Properties’

4. In the ‘File Properties’ window that pops up, after a sec, click on the ‘Permissions’ tab and mouse over to the box that has the words ‘Make the file executable’ and click the box so that it shows a “check mark” instead of a “minus sign or dash”

5. Click the ‘Ok’ button on the ‘File Properties’ window and open a new terminal window (it’s best not to use connectbot ssh or a terminal emulator for running this command as it will need a GUI in a second to load in) and put in the following commands, adjusting the file path to yours would be a good idea.

# sh /home/[user-name]/Downloads/jME3_SDK_3.ORC2-linux.sh

or

# sudo sh /home/[user-name]/Downloads/jME3_SDK_3.ORC2-linux.sh

it’s going to hang out and do nothing for a minute right around line ‘Configuring the installer...’ and again at line ‘Extracting installation data...’ but will eventually start a GUI installation window with a red loading bar and stuff or it’ll throw-up a message like...

...(authers reminder to self ?/home/[UN]/Downloads/jmonkeyUserDump)...

If so then:

6. Assuming all is well and slowly moving you’ll be presented with the jMonkey installation wizard and you can run through the process of selecting where java runtime files can be found and where to extract the jMonkey collection of development tools. It's going to take a minute or sixty but, if you sit back and let it do it’s thing without much else going on on the device, jMonkey will eventually install successfully.

7. It’s not over just yet, once jMonkey is unpacked, installed, knows where “openjdk” or “Java JDK” is (I successfully tested this with openjdk-jdk and it’s family of openjdk packages installed on the device; using an ‘apt-get install’ command’ before running the jMonkey installer) and opens for the first time; you need to mouse over to ‘help’ at the top of the jMonkey window and mouse over to ‘check for updates’ and click it. This step is the one that everyone forgets in their excitement and one of the top reasons for people to search for error fixes right after installing jMonkey. The author on the main page of jMonkey’s install help guide states these steps but there be a lot of words there and it’s right near the top of the text block so I and many others have missed it.

8. After updating jMonkey though the help drop down menu you are ready to rock and roll. Try mousing over to ‘File’ click it and mouse down to ‘new project’ click it and click ‘Next’ and ‘Finish’ to keep default settings, wait a second or two, and start making stuff that can then be exported out to formats that are compatible on just about any device and any os you may want to write a game for.

9. For help with this specific program “jMonkey” you should direct your attention to:

http://jmonkeyengine.org/forum/

and

http://en.wikipedia.org/wiki/JMonkey_Engine

and for help with getting jMonkey to run on android with linux dual booted; then direct your attention here on this document and it’s mirrors.

You can comment on the program itself here too but, as I’m not the developer of the program, my knowledge of what make’s it work and not work is very trial and error at times. My primary concern is making it easy to install on your device so that developers on that site have another method/platform to do developing with.

Next up?... Syncing files between your android, dual booted Linux distro, And your home PC.

Why? Because being able to sync between all your devices seamlessly will allow quicker development for these systems on the whole.