Installing BlueJ in ChromeBook


The ChromeBook is a thin layer of web browser + application runner painted on top of a minimal Linux operating system. The rest of Debian Linux, the part that Luddite/retro programmers love and rave about (and mature programmers avoid) is not installed. You may someday want to waste a lot of time learning and using Unix* (Linux is an independent, open-source clone of what was originally Bell Labs Unix), but that's not what we are here for today. We just need it to install Java and the BlueJ programming environment, and then never look at it again.

If you have a ChromeBook provided or managed by your school, some of the instructions here may not work.
 

Make a Restore Drive

Before you do anything, make a Restore drive (it requires an 8+G USB device). If you wait until you see the message "Chrome OS is missing or damaged" it's too late, you need a working ChromeBook (or a desktop computer running the Chrome system, but you still need the model number of the failed ChromeBook, which is only available when it's working) to make the Restore drive. If you have a ChromeBook provided by your school, they probably already have a Restore drive you can use (but you should ask). Otherwise...

I Googled "USB restore ChromeBook" (no quotes) and the instructions there are clear and simple, but skip over the part about all the other things you should try first. You still need the Restore drive after all those other things fail, and you cannot make it after all those other things fail. Do it now. It will cost you $10 (or less) for a thumb drive, and even after you use it, don't erase and repurpose it as they suggest, you may need it again. Put it in a safe place. I needed mine less than an hour after making it. Hopefully you won't make whatever mistake(s) I made, but you never know.

Then save all your data (and apps, if you can) on the cloud (the ChromeBook Sync app will do that) or somewhere safe. You should have backups of everything anyway, you never know what Bad Things Might Happen. The Restore operation (if you need to do it) erases everything. So does getting into developer mode (which is necessary to install Linux and then Java). Java is reasonably safe, but Linux is not.
 

Install Linux

You cannot use your ChromeBook to read these instructions while you are doing this. If you are in a classroom with a projector, this can be shown there, or you can pair up with somebody else's computer to read on one while doing the other, or maybe print it out on paper.

Installing Linux on a ChromeBook requires you to be in Developer mode. You can Google "ChromeBook developer mode" (no quotes) for more information, but basically the Chrome folks don't trust Linux (and neither should you!) so while they will install it for you, it doesn't pass their security check, so you must turn that off. Turning that off puts you in Developer mode. Unlike Linux itself, Chrome makes dangerous things like that harder to do.

First, make sure you back up everything. It will be erased.

Then turn the computer off (hold the power key down for five seconds; it will pop up a confirmation, after which you can keep holding it until the screen goes black, or else press Enter). Then hold both the Esc key and the circular arrow (some people call it "Refresh") keys down at the same time while you tap the Power key. I don't know how long you need to keep the Esc+Refresh keys down, but a couple seconds seems to be enough. It takes several seconds longer to come on.

The startup screen in this mode shows a big yellow exclamation point "!" (or maybe an image of a thumb drive and simm disk for you to choose from) and the announcement that "Chrome OS is missing or damaged." It's a lie, don't believe it. Just press ctrl+d and then when the screen changes, press enter (or just wait). It will go black, then come back on with a (smaller) red exclamation point to give you one more chance to cancel out. I did nothing, so it beeped twice loudly then started erasing stuff, which takes a while, maybe 15 minutes or more. When it finishes it puts the red exclamation point back up (I did nothing and got two loud beeps again) and then it went into its normal initial welcome screen. I got a tiny message (really a link) "Enable debugging features" which is there to tell us that it's in Developer mode, but YMMV. You don't need the debugging features, just press Enter or click the button to continue the sign-on process, beginning with selecting a Wi-Fi node (it forgot everything).

After you finish the tedious process of putting everything back the way you want it, open the Settings (gear) panel, which you can find by clicking the time in the lower right corner. You may get something like it as part of the startup process, but it's incomplete, you need the control panel from the time popup. Down the left side is a list of categories you can make changes to, and at the bottom of this list mine says "About Chrome OS" which you can click to confirm (about the middle of the top line under the title) that it is "(64-bit)" which most modern computers are. If you have an older model, it may be different than what I have to tell you, maybe things will work the same, maybe not. 32-bit Java (and therefore 32-bit BlueJ) is incompatible with 64-bit -- it doesn't need to be, the same source code runs the same in both versions, maybe a little faster in 32 (unless you actually need integers bigger than 2 billion, which is almost never), but Americans have this silly notion that "bigger is better," so therefore 64 must be better than 32. But you need to take notice that the software you download in this process matches your hardware. I'm going to assume everything is 64, if yours is different, we need to work something else out for you.
 

Turn Linux On

Just above the "About" line in the list on the left should be an "Advanced" toggle. Click that to open up maybe eight more items. If "< > Developers" isn't one of them, you have a problem, either you did not succeed in getting the Developer mode turned on, or else your ChromeBook is way older (or maybe newer) than what I'm looking at here. If it's there, click it to open up its single-item panel, where you can Turn on the "Linux development environment." Do that. A couple clicks on the Next button (defaults are fine, unless your Chromebook user name starts with a number, you must pick a name that doesn't) and the install process begins. It takes something like ten minutes.

When it finishes installing, it opens a traditional** black console window with white or colored text. This is where you will type your Linux commands, but not yet. The settings panel behind it opens up to let you fiddle with several things that you probably don't need to worry about -- except maybe "Backup" which is a good thing to do anyway (but there is nothing to back up yet).

If you close the console window, it might ask if you really want to do that with unsaved data, but there isn't anything to save except the text, and I could find no way to save that. You can always open the console window again, because it is installed as an app in the second page -- on my ChromeBook the icon was ">_" in a gray circle on the second app screen; there are two tiny little dots in the right margin, clicking one or the other replaces the primary app screen with another showing different apps, and no obvious way to get them all where you can see them, nor to choose which apps should be considered primary. Unix thinking at work. I later learned that the two frames are logically in a vertical strip, so that dragging an app icon off the top or bottom moves it to the next frame in that direction.

Download Files in Chrome, Run them in Linux

You can do this all in Linux, but it's a lot harder.

1. Open up the Chrome browser and go to BlueJ.org. Not far from the top you will see four large icons in a row; click on the one labeled "Ubuntu/Debian" to download the Linux version that will run on your ChromeBook (assuming you have 64-bit).

2. While you are at it, download (from my website) StartHere and Runner. These are both zipped, and although Chrome does not know how to unzip them, Linux does.

3. In the Files app, drag the three new files from your Downloads folder into the "Linux files" folder (the little face icon in the left margin will take the drop). It will make copies there.

4. Now you get to type three Linux commands. Well, maybe four. First get back into the black Linux console window, then to verify that the three files are visible in your Linux folder ("directory") type the two letters "ls" ('L' then 'S' but not caps, no quotes) and enter. The three files should be listed alone on the next line.

5. Then type "unzip runner.zip" to unzip the smallest file.

6. You should now have a new "running" file, if you care to look. Type "chmod 777 running" to make Linux recognize it as a "shell script" (a set of command lines that I put in the file so you don't need to type them). If you look again, you will see that the file name is now a different color.

7. Finally, type "./running" to run my program, which after a minute or so, asks you to confirm its installation (taking some 400+megabytes, type the single letter 'y' and enter to accept), and then takes maybe five or ten minutes more. When it finishes correctly there will be "Done..." on the last line before the prompt. If you don't see the prompt, it's still working. If you see anything else, skip down to "Something Went Wrong" below. Otherwise, you are done with Linux. Close the window and go back to the alternate apps screen and you will see the BlueJ icon sharing the gray circle around the Linux icon. You can drag it onto your shelf for convenience (click the gray part of the circle to open it up larger, then drag the bird icon).

8. If you need to unzip additional downloaded files at a future time, if they are folders (most likely) you will need to type in something like this in the Linux console window, where "name" is replaced by the actual file name (remember, case is significant in Linux, be sure to get the capitalization correct):

mkdir name
unzip name.zip -d name


If they are single files see the example in step 5 above, substituting the name of the actual file.

Before you do this, you should probably remove any previous files or folders with the same name(s). That's complicated in Linux, so I suggest you open the "Linux files" line in the Files app (it may take a minute or more the first time) and delete it there.

I don't recommend you try to do anything else in Linux (you could brick the computer, requiring that Restore drive), but if you want to, look online for Linux tutorials and read one or more of them before you start. Linux is a horrible system, so there's a lot of on-line help for newbies.

9. It turns out that there is a way to (effectively) unzip files in the Chrome Files app, I think they made it harder than Linux on purpose, but essentially you do the same thing. First you right-click the folder line in the left column where you want the result, and create a new folder there, then right-click the new folder and rename it to whatever you want to call it, perhaps the same name as the zip file without the ".zip" suffix. Then in the Downloads folder, right-click the zip file you want to unzip, and choose "Open with Files". This gives you in the middle column there, a complete list of what's in the zip file. There's a "Select All" item in the popup menu under the three dots near the top right corner, or you can click in the white space next to the top file in the list and drag down to the bottom, and they will all be selected. Then you can drag any one of the checkmarks to your new folder, and all the files will be unzipped into that folder. You can create this folder in the "Linux Files" folder, or you can create it somewhere else and drag it there.
 

Start BlueJ

Now you can click the BlueJ icon to start it. It takes a minute or so to start, then puts up a blank dashboard window. You should pull down the Project menu and choose Open Project, then select (do not double-click) the "start" folder, then choose the Open button in the lower right corner. That's the first part of the "Begin Here" paragraph in the previous page. ChromeBook doesn't seem to do DragonDrop properly, certainly not across the Linux boundary, so we are stuck with the menus, but it's still better than typing whole file path names. Continue now in the "Begin Here" paragraph in the previous page.
 

Later

After you are more skilled in Java, one of the things you might want to do is use my GameEngine (see "Your Own Java Game"), which you probably need to download (in Chrome, use the link there where it says to download it) then drag the zip file over to the Linux Files line in the File manager, and unzip it using the directions in Step 9 or Step 8 above. The "Linux Files" directory counts as "the BlueJ folder" because that's where BlueJ starts looking for files when you use its "Open" menu. Chromebook does not do proper DragonDrop, so you need to use the "Project -> Open Project" menu inside BlueJ where other systems you can just drag the folder onto the BlueJ program icon. To get the folder as a project, select (but do not double-click) the folder, then choose the Open button in the lower right corner.

The latest BlueJ is incredibly slow -- about 8 minutes to start my GameEngine on a student Chromebook, more than twice the previous version on a much older computer -- with no busy cursor or anything (it's classic comatose unix behavior -- I did say these are student unix programmers who did it)... I finally quit out of BlueJ and copied the "start" folder to some other directory and deleted the original, so BlueJ couldn't find it, which seemed to go faster (4 minutes to re-open it). DO NOT try to open the JavaGame, it hangs (or maybe takes longer than I was willing to wait); if you want to look at the source code, right-click the icon in the Chromebook Files app and "Open with Text", it's almost instantaneous. You can force-quit BlueJ (keep clicking on the close "x" until the operating system notices) and restart it: I saw no ill effects other than another lost 4 minutes.
 

Useless Information (or Something Went Wrong)

If Something Went Wrong, it probably can't be fixed by you or me. Linux is a horrible environment, designed to help the Men In White Coats feel superior to the rest of us. Finding your way around in (any form of) Unix is an esoteric but obsolete skill, something like riding a bucking bronco or cooking bouillabaisse soup from scratch or digging a swimming pool with a pick and shovel, once very useful in some places, now only interesting if you have time to waste, because those things don't need to be done any more.

The short answer -- and I did it a few times myself, preparing this -- is go to the settings screen, the Developers panel, and turn Linux off, then restart from "Turn Linux On" above. If you successfully downloaded the files, you don't need to do that again. In fact, if you do, it will change the names on the new downloaded copies. You need the original names for the Linux steps to work properly.

If that doesn't work the second time, it's probably because one or more of the online files changed. The Cloud is like that, so unstable, "Here today, gone tomorrow." You might be able to find down-rev copies of the things I have version numbers for, or new instructions for doing things. Here's what I did, you might be able to find a work-around for your situation:

1. I Googled "install BlueJ on ChromeBook"

The most helpful site called himself "Pedagogue Padawan" and I adapted most of his code, except I altered some version numbers. I see his site is already different from when I started.

2. I went to the  BlueJ.org website and saw that their preferred release for Buster 10 Debian Linux is 501. Buster 10 Debian is what my ChromeBook installed, yours may be different.

3. I Googled "install Java on ChromeBook"

Most of the hits in the Top Ten said "You can't" but they were using old ChromeBooks or ignorant or facetious. Some said you need to install Linux and gave detailed instructions for downloading and installing some version of Linux. The ChromeBook I have has a single-click button that does everything to install Buster 10 Debian (the preferred Linux for BlueJ when I did it). YMMV.

4. I decided I liked Pedagogue Padawan's instructions as simplest, so I typed them into Linux and BlueJ opened.

5. I didn't want to make Real People (you and me) do that again, so I collected all the Linux steps into a "shell script" -- unix has this awesome feature where all those ugly commands can be typed once into a text file, then fed back into unix and it does them just as if you were typing them fresh. The classic Macintosh could do that with clicks and drags, which was even better, but the Mac is gone and all we have is unix (I still have and use a Mac, it's so much faster than any of its successors, even though scripting no longer works in the last release, sigh) -- anyway, a shell script is just a computer program that is not compiled, it just runs. For all I know, some of the steps it calls up are also shell scripts. Whatever. Here is the script in the file "runner" that you downloaded, you could type these commands into Linux by hand (or some variation, as needed) instead of running my script, if you like:

sudo cp /etc/apt/sources.list sources.list
sudo echo deb https://deb.debian.org/debian stretch main | sudo tee -a /etc/apt/sources.list
sudo apt update
sudo apt install openjdk-11-jdk
sudo mv sources.list /etc/apt/sources.list
sudo apt update
sudo dpkg -i BlueJ-linux-501.deb
mkdir start
unzip StartingHere.zip -d start
echo done..
The second line is very long and probably wraps around to a second line in the listing above, but it should be typed in as a single line (the first seven lines all begin with "sudo").


* Unix The original Unix operating system was designed at (then) Bell Labs for their scientists to use. Scientists are mostly overgrown students, so it was designed to be very easy to program and (as a result) is very hard to use for doing real work. I call it "the conservation of complexity," somebody (either the user or the programmer) must do the hard work of making the computer do what we need it to do, and There Ain't No Such Thing As A Free Lunch (TANSTAAFL). Unix is still today easy to program and hard to use.

The 1984 MacOS was the other way around, and was so successful that everybody else is now trying to be a Mac clone, but underneath the hood they are all either unix or a unix wannabe, because the programmers who write the operating systems are lazy, they want easy-to-program and don't give a rip about easy-to-use. Today, while you are getting started, easy to program is good. After you get good at it, you should transition towards writing software that is easy on the users, because if they like it they will come back for more, which translates into more income for you. The real reason is that it makes the world a better place, and the USA is the richest country in the whole world and in all time because people here do that. TANSTAAFL
 

** Traditional -- I say "traditional" because the human eye is optimized for seeing small dark things in a light background (think: black ink on white paper). The only reason the original consoles were green on black is that the original cathode ray tubes they used were "flying spot" where the electron beam lit up only where the text was. The flicker was awful, so they adopted the raster scan used in televisions, but the electron beam could not focus sharp enough to get readable black letters (TV sets intentionally defocused the beam to get solid colors without visible raster lines), so they preserved the black screen. Green phosphor was cheaper than white. Raster technology improved, and by 1984 the original Macintosh was able to get readable black letters on a white screen. The recent trend toward "dark mode" is nothing more than retrogressive steam punk, a longing for the simpler days of yore. But then Linux is already pretty retro, a 1970's operating system in the 21st century.

Rev. 2022 October 26