Subscribe to Grim's Projects        RSS Feed
-----

A Java OS sorta?

Icon 2 Comments
Curiosity strikes me at odd times. Typically I'm always working on some project which seems utterly preposterous to the people around me, be it code or otherwise. Presently, I'm working on a simplified vacuum forming machine, but that's not the subject at hand.

For whatever reason my interest in Java has been rekindled. I started wondering about various Java apps and wondered if there was even a Java OS. In fact there are. There are four that I located:

JNode looked the most promising, they have screenshots! :clap: Screenshot pandering aside the main issue with it seemed to be the amount of RAM your system needs to have. At a minimum 512 MB is suggested. Sadly, the little Dell Inspiron that always suffers my Linux abuses only has 256 MB RAM.

This left me feeling incomplete and dissatisfied. I thought to myself it takes SO much ram to run a JVM? It seemed preposterous in fact, given that I'm currently running Debian AND a JVM on the same laptop.

My next conclusion was... isn't there a small Linux that would consume minimal RAM and be able to push the rest of the RAM to the JVM? I thought Damn Small Linux, Puppy Linux, and finally I remembered one that I had tinkered with a while back called TinyCoreLinux. Of ALL the distributions I've tinkered with I in fact like TinyCoreLinux the most, but it's also the most frustrating because you have to be a fairly advanced Linux user. Needless to say I am not if you've read my other posts.

My Linux skills are burn ISO image to CD, attempt to boot from CD, sigh in frustration if fail, b*tch about how slow it is if it succeeds. TinyCoreLinux is lightspeed. So I figured, maybe I can turn TinyCoreLinux into my Java development environment since I want to start practicing it.

Well I won't keep you in suspense, I did in fact get Java 6 working on TinyCoreLinux. It even supports full screen exclusive mode on my diminutive Dell. So I'm very content with the results. Perhaps somewhere further down the line something will screw up and piss me off all over again. I was in fact quite pissed/frustrated but thanks to the help of a user on the tinycorelinux IRC channel I was able to sort through the mess and eventually come up with the solution on my own.

Without further adieu here is how I managed in case anyone cares to try it themselves in an easy to follow step-by-step easily reproduced fashion (I hope):
  • Download the most current (3.6) TinyCoreLinux ISO
  • Burn the ISO to the medium of choice (CD in my case) using whatever burning program suits you
  • Turn on your computer of choice and load into the boot menu
  • Eject your drive and load your TinyCoreLinux OS CD into it
  • Choose the option in the boot menu to boot from the CD drive
  • You will now be presented with a small prompt and a flickering cursor preceded by boot: just press Enter as per the instructions
  • You will now see TinyCoreLinux desktop, simple and elegant really

OK, this is where I ran into problems. TinyCoreLinux uses a packaging system like a lot of the major Linux systems (Debian, RedHat, etc.). Assuming you have an internet connection on your laptop you can use Apps application on the taskbar to download the files we require. I however, am not so fortunate. Therefore, I downloaded the following files and placed them on a USB stick:

You need the JRE to be able to run Java code. The Xorg libraries are required in order to support the Swing GUI components. Figuring that second part out was painstaking so be thankful you don't have to friends. Now, back to our procedure:
  • Insert your USB stick with the two aforementioned files into the computer that's currently running TinyCoreLinux
  • Launch the application on the far right of the taskbar called Mount
  • Dependent on your system you should see a series of buttons, click the one that pertains to your USB stick (it's typically denoted by sda#), a file manager app will pop up which you can close
  • Launch the Apps application from the taskbar and then click the Local button in the upper left hand corner
  • Double-click on the ../ within the textarea until you see a // appear at the top
  • Finally, double-click where it says /mnt/sda#/ (the USB stick you mounted previously)
  • Select the file Xorg-7.5-lib.tcz and press OK, you should see the little textbar at the bottom turn yellow and terminate with OK.
  • Click the Local button once more but this time select sun-jre.tcz and click OK.
  • Again the textbar at the bottom should turn yellow and terminate with OK (this one may take a little bit of time because the file is somewhat larger).
  • Close the Apps application by clicking the X on the upper right corner.

At this point you would ask, are we done yet!? Sadly no. TinyCoreLinux uses a non-persistent mode of operation, in other words it's sort of brand new every time you restart your computer. You can do a permanent install but if you just want to preview you don't really want to mess with your system. Here's where it also got tricky for me. In order for the JRE to work you have to either reboot or relogin in order to update the PATH variable to work with standard console command inputs such as "java LaunchThisApp". What does all the jibberish mean in normal? Basically, the computer won't remember what you did and doesn't update quite right without a restart, so we need to manually restart it. DO NOT HIT THE POWER BUTTON! We don't need to restart the WHOLE thing, just the desktop (or Xserver for the linux types). How do we do that? Follow the procedure:
  • Click the Exit button to the far left of the taskbar.
  • Select the Exit to Prompt option and click OK
  • Now you're looking at a black screen with a flickering cursor again preceded by tc@box:~$, type "exit" (without the double quotes)
  • The screen changes once more and reads "Tiny Core Linux" "box login: _", now type "tc" (without the double quotes)

If you've made it this far you should now have a fully operational Java Runtime Environment on your TinyCoreLinux-enabled machine. Congratulations. How do we launch some apps? The same way you would on your Windows console. Using Linux native console commands, navigate your way to the folder where your *.class files are and then type your "java YourClassWithAMainMethodGoesHere" and you should see the results.

I hope this will be of service to someone and save them my troubles. More importantly, that when I forget this procedure in the near future I can browse my blog and remember it.

Phase two will consist of me creating a text pad application as my first application for the Java enabled lappy.

2 Comments On This Entry

Page 1 of 1

heyoman1 Icon

05 June 2011 - 12:43 AM
I always felt that Java IS a (dependent) OS. It's basically like a normal OS, With bytecode as its Assembly, Java as its C, and JRuby as its, well, Ruby.
1

grimpirate Icon

08 August 2011 - 08:24 AM
Found two more:
sanos
TinyOS
0
Page 1 of 1