linuxnewbie.org.gif
Tuesday, 12-Dec-2000 10:38:26 EST
Newbized Help Files articles discussion board bookshelf sensei's log advertising info

How do I install Java on my Linux Computer?
Written By: Greg Brouelette

1. What is Java?
2. What makes Java so cool?
3. Where can I get Java for Linux?
4. How do I set up Java on my computer?
5. Where can I learn more about Java?

1. What is Java?

Java is a computer language developed by Sun Microsystems and it's spinoff company JavaSoft. It is similar to C++ in many ways, however, many people think that Java is easier to understand and to learn than C++.

2. What makes Java so cool?

Well, there are many things that makes Java a cool language to write code in. But the primary reason is something called "WORA" or Write Once Run Anywhere.

WORA allows you to write a program that will run (without re-compiling) on a Linux computer, a Windows 95, 98 NT or 2000 computer, a Mac, or a computer with Sun OS.
How does it do that you may ask?

As we all know, computers run on ones and zeros. The problem is that the set of ones and zeros that means "Add the numbers 4 and 5" on a PC might mean "Print the letter 'Z'" on a Mac. (It doesn't but this is just a hypothetical example). In any case, programs written on one platform won't run on a different platform.

The problem gets worse when you consider the problem of GUI (Graphical User
Interface) programming. The Windows GUI library, MFC (Microsoft Foundation
Classes) is not supported on any other platform. So any program that uses dialog boxes, windows, buttons, checkboxes, or any of the other gui components we're use to seeing in our software will work only on the platform for which it was written (until now).

Java has a set of gui components, called "Swing", that is core to the language. That's right, the entire gui library is part of the core language. This means you can write programs with a gui that will run on any platform that supports Java.

"OK, That's great!" you say, "But how can Java possibly work on all these different platforms?"

Java source code is written as ASCII text and saved as a .java file. When you run the compiler ( javac ) on a .java file you get one or more .class files.
Normally, a compiler would compile into machine language that is specific to a particular computer platform. But with Java it compiles as far as it can without having to know what kind of computer it's going to run on.

When you run a java program you run it inside a Java Virtual Machine (JVM). This Java Virtual machine knows how to take the .class files and make them run on a particular computer platform. In other workds, there is a JVM for Windows, a different JVM for Linux, a different JVM for Mac OS, and so on.

By installing the correct JVM for your computer you can run any Java program that was properly compiled to a .class file.

3. Where can I get Java for Linux?

The Java Development Kit (JDK) for Linux is available from www.blackdown.org and www.javasoft.com At the time that this FAQ was written the latest version was jdk 1.2.2

4. How do I set up Java on my computer?

Here's how "I" do it. Your mileage may vary.

In my home directory I create a new directory called "devtools". This is where I put all my developer's tools. You may want to put Java in /usr/local so all your users can have access to it easily. [Addition 2-17-2000 the /usr/local is probably the better choice, just make sure that you chmod the directories so your users will have access to the developer tools]

The file I downloaded was jdk1_2_2rc1-linux-i386.tar.gz Your file might have a slightly different name depending on the version number and what kind of system you're using. (i386 is for PC's).

The file is both gzipped and tar'd. I put the file in my ~/devtools directory and decompressed it by typing:

tar -xvzf jdk1_2_2rc1-linux-i386.tar.gz

The 'z' option will automatically filter the tar file through gunzip.

You will now have a new directory under devtools called jdk1.2.2. Under that is a directory called bin. Put this directory in your path. I'm using a bash shell but this example should be similar to what you need to do if you're using a different shell.

Open up your ~/.bashrc file and add the following lines.

export JAVA_HOME=~/devtools/jdk1.2.2
export PATH=$JAVA_HOME/bin:$PATH

[Addition 2-17-2000 It's probably better to put PATH, JAVA_HOME and CLASSPATH environment variables in your .bash_profile file]

You'll add one more line in a minute, but this will be fine for now.


[-NHF Control Panel-]
The Linux Channel at internet.com
Linux Planet
Linux Today
Linux Central
Linuxnewbie.org
PHPBuilder
Just Linux
Linux Programming
Linux Start
BSD Today
Apache Today
Enterprise Linux Today
BSD Central
All Linux Devices
SITE DESCRIPTIONS
[-What's New-]
Order a Linuxnewbie T-Shirt
Easy Webcam NHF
Directory Navigation NHF
Installing Snort 1.6.3 on SuSE 6.x-7.x
Customizing vim
The SysVinit NHF
Installing ALSA for the VT82C686 integrated sound
USB Creative Video Blaster II for Linux
Configuring the Intellimouse Explorer in XFree86 V4+
The beginnings of a distro NHF
Getting Past Carnivore?
Getting and Installing PGP
Getting your ATI Rage 128 Working
How to create a multiple partition system
Using Fdisk
Introduction to Programming in C/C++ with Vim
Adding a Hard drive in Linux -- In five steps
Installing ALSA for the Yamaha DS-XG Sound Card
Getting your Diamond Rio Mp3 Player to work with Linux
Bash Programming Cheat Sheet
Installing NVIDIA Drivers for Mandrake
Setting up Portsentry
Hard Drive Speed Tweak for Linux
Sensei's Log
Chat room
Join: Linuxnewbie.org SETI Black Belts!
Send in your news
Click the image to add Linuxnewbie.org to your MyNetscape Page
[-LNO Newsletter-]

[-Archive-]
The beginnings of a distro NHF
Connecting to the Internet using KPPP
Getting your SBLive to work
Unreal Tournament NHF
LWE Day 2 Pictures
LWE Day 1 Pictures
The LNO FAQ!
WoW (Words of Wisdom)
Other sites news
What is Linux?
What is Linux? part deux (ups & downs)
Search newsgroups
The List
ALS Report
Feedback Form
jobs.linuxtoday.com.gif
Match: Format: Sort by:
Search:
[-Quick Links-]

Copyright 2000 internet.com Corp. All Rights Reserved. Legal Notices Privacy Policy

internet.com.gif