<< Chapter < Page Chapter >> Page >

Writing, compiling, and running Java programs

Writing Java code

Fortunately, writing Java code is straightforward. You can write Java code using any plain text editor. You simply need to cause the output file to havean extension of .java.

There are a number of high-level Integrated Development Environments (IDEs) available, such as Eclipse and NetBeans, but they tend to be overkill for the relatively simple Java programs described in this module.

There are also some low-level IDEs available, such as JCreator and DrJava, which are very useful for sighted students. However, I don't know anything abouttheir level of accessibility. I normally use a free version of JCreator, mainly because it contains a color-coded editor, but that feature wouldn't be usefulfor a blind student.

So, just find an editor that you are happy with and use it to write your Java code.

Preparing to compile and run Java code

Perhaps the most complicated thing is to get your computer set up for compiling and running Java code in the first place.

The java development kit (JDK)

You will need to download and install the free Java JDK from (External Link)

I notice that Java SE 7 has been released very recently. However, my SVG graphics library was tested using Java SE 6 Update 26, and that is what I wouldrecommend. Also there is a 64-bit version, but my library has not been tested with the 64-bit version. If your operating system will accommodate it, Irecommend that you stick with the 32 bit version just in case the 64-bit version is not compatible with my library.

You will find installation instructions on the download page shown above.

JDOM version 1.1.1

You will also need to download and install a class library named JDOM 1.1.1 at (External Link)

When you do that download, you will receive a zip file that also contains some installation instructions. However, my experience is that thoseinstallation instructions are overkill, at least that is the case on a Windows machine.

All you need to do is to extract the file named jdom.jar from the zip file (look for it in the build directory in the zip file) , store it somewhere on your disk, and put it on the classpath at compile time and runtime. (I will explain the bit about the classpath a little later.)

In my case, I'm running Windows Vista Premium Home Edition and I elected to store the jdom.jar file in the following folder :

C:\Program Files (x86)\Java\jdom-1.1.1\build\jdom.jar

It doesn't really matter where you store it as long as you know how to specify that location in the classpath later.

Compiling and running Java code

There are a variety of ways to compile and run Java code. The way that I will describe here is the most basic and, in my opinion, the most reliable. These instructionsapply to a Windows operating system. If you are using a different operating system, you will need to translate the instructions to your operating system.

Write your Java program

Begin by writing your Java program into a text file with an extension of .java. Save it in a folder somewhere on your disk. Make sure that you adhere tothe earlier instructions regarding the name of the class and the name of the file, and remember that everything is case sensitive.

Get Jobilize Job Search Mobile App in your pocket Now!

Get it on Google Play Download on the App Store Now




Source:  OpenStax, Accessible physics concepts for blind students. OpenStax CNX. Oct 02, 2015 Download for free at https://legacy.cnx.org/content/col11294/1.36
Google Play and the Google Play logo are trademarks of Google Inc.

Notification Switch

Would you like to follow the 'Accessible physics concepts for blind students' conversation and receive update notifications?

Ask