Nicht aus der Schweiz? Besuchen Sie lehmanns.de

Java Essentials For Dummies (eBook)

eBook Download: EPUB
2024
274 Seiten
For Dummies (Verlag)
978-1-394-29698-9 (ISBN)

Lese- und Medienproben

Java Essentials For Dummies - Doug Lowe, Paul McFedries
Systemvoraussetzungen
12,99 inkl. MwSt
(CHF 12,65)
Der eBook-Verkauf erfolgt durch die Lehmanns Media GmbH (Berlin) zum Preis in Euro inkl. MwSt.
  • Download sofort lieferbar
  • Zahlungsarten anzeigen

Swiftly brush up on the foundations of Java programming

Java Essentials For Dummies is a reliable and succinct reference on the core components of Java-the multifaceted general-purpose language used for desktop, mobile, and web applications. This straightforward book gets right to the point-eliminating review material and wordy explanations-so you get what you need, fast.

  • Strengthen your understanding of the basics of coding with Java
  • Review what you've already learned or pick up key skills
  • Use Java to build a variety of applications and more
  • Jog your memory on the essentials as you work and get clear answers to your questions

Perfect for supplementing classroom learning, reviewing for a certification, or staying knowledgeable on the job, Java Essentials For Dummies is a direct reference that's great to keep on hand as an everyday desk reference.

Doug Lowe is a computer programming guru and author of more than 30 tech books, including Java All-in-One For Dummies.

Paul McFedries is a long-time technical author with more than 100 published titles, including Web Coding & Development All-in-One For Dummies.

Chapter 1

Installing and Using Java Tools


IN THIS CHAPTER

Downloading Java from the Oracle website

Installing Java

Identifying your version of Java

Java development environments have two basic approaches. On the one hand, you can use a sophisticated integrated development environment (IDE) such as NetBeans or Eclipse. These tools combine a full-featured source editor that lets you edit your Java program files with integrated development tools, including visual development tools that let you create applications by dragging and dropping visual components onto a design surface.

At the other extreme, you can use just the basic command-line tools that are available free from Oracle’s Java website (https://java.oracle.com). Then you can use any text editor you want to create the text files that contain your Java programs (called source files), and compile and run your programs by typing commands at a command prompt.

As a compromise, you may want to use a simple development environment, such as TextPad. TextPad is an inexpensive text editor that provides some nice features for editing Java programs (such as automatic indentation) and shortcuts for compiling and running programs. It doesn’t generate any code for you or provide any type of visual design aids, however. TextPad is the tool we used to develop all the examples shown in this book. For information about downloading and using TextPad, see Chapter 2.

If you prefer a free alternative, you can also investigate Notepad++ at https://notepad-plus-plus.org.

You can also compile and run simple Java programs online at sites such as JDoodle (www.jdoodle.com/online-java-compiler) or Programiz (www.programiz.com/java-programming/online-compiler). At these sites, you can enter simple Java programs, compile them, and run them. They’re a great way to dip your toes into the shallow end of the Java programming pool without having to install anything.

Downloading and Installing the Java Development Kit


Before you can start writing Java programs, you have to download and install the correct version of the Java Development Kit (JDK) for the computer system you’re using. Oracle’s Java website provides versions for Windows, macOS, and Unix. The following sections show you how to download and install the JDK.

If you prefer, you can download and install the open-source version of Java from https://openjdk.org.

Downloading the JDK


To get to the download page, point your browser to www.oracle.com/java/technologies. Then follow the appropriate links to download the latest version of Java SE for your operating system. (At the time we wrote this, the latest version was 18.0.1.1. However, Java 19 was available in early release form. By the time this book hits the shelves, Java 19 or later should be available from www.oracle.com/java/technologies.)

When you get to the Java download page, you’ll need to select your operating system; Java is available for Linux, macOS, and Windows. In this chapter, we show you how to deploy Java to a Windows 10 or 11 computer. The procedures for deploying Java to Linux or macOS are similar.

The JDK download comes in three versions: a compressed.zip file, an executable installer (.exe), or a Windows installer package (.msi). All are about the same size (under 200MB). We find it easier to download and run the .exe installer.

Installing the JDK


After you download the JDK file, you can install it by running the executable file you downloaded. The procedure varies slightly depending on your operating system, but basically, you just run the JDK installation program file after you download it, as follows:

  • On a Windows system, open the folder in which you saved the installation program and double-click the installation program’s icon.
  • On a Linux or macOS system, use console commands to change to the directory to which you downloaded the file and then run the program.

After you start the installation program, it prompts you for any information that it needs to install the JDK properly, such as which features you want to install and what folder you want to install the JDK in. You can safely choose the default answer for each option.

Perusing the JDK folders


When the JDK installs itself, it creates several folders on your hard drive. The locations of these folders vary depending on your system and how you installed Java. The three most likely places to find the Java home folder in Windows are the root of your C: drive, the folder C:/Program Files/Java, or the folder C:/Program Files (x86)/Java. Within one of these locations, you’ll find the Java home folder, whose name starts with jfk- and ends with the version number. For version 19, the home folder is named jdk-19.

Table 1-1 lists the subfolders created in the JDK home folder. As you work with Java, you’ll refer to these folders frequently.

TABLE 1-1 Subfolders of the JDK Home Folder

Folder

Description

bin

The compiler and other Java development tools

conf

Configuration file

include

This library contains files needed to integrate Java with programs written in other languages

jmods

Modules for the Java Module System

legal

Copyright and license information for various Java components

lib

Library files, including the Java API class library

Setting the JAVA_HOME and path variables


After you install the JDK, you need to configure your operating system so that it can find the JDK command-line tools. To do that, you must set two environment variables: JAVA_HOME, which provides the location of the Java home folder, and Path, which lists the folders that the operating system uses to locate executable programs. Follow these steps:

  1. Open File Explorer, right-click This PC, and choose Properties.

    This brings up the System Properties page.

  2. Click the Advanced System Settings link.
  3. Click the Environment Variables button.

    The Environment Variables dialog box appears, as shown in Figure 1-1.

  4. In the System Variables list, click the New button.

    The New System Variable dialog box, shown in Figure 1-2, appears.

  5. Type JAVA_HOME in the Variable Name text box.
  6. Click the Browse Directory button, browse to the Java home folder, and then click OK.

    This action inserts the path to the home folder in the Variable Value text box.

  7. Click OK.

    The JAVA_HOME variable is created.

  8. Scroll to the Path variable in the System Variables list, select it, and then click the Edit button.

    This brings up a handy dialog box that lets you add or remove paths to the Path variable or change the order of the paths, shown in Figure 1-3.

    FIGURE 1-1: The Environment Variables dialog box.

    FIGURE 1-2: Creating the JAVA_HOME variable.

  9. Peruse the list of entries in thePathvariable. If you find one that references a previous version of Java, delete it.

    Specifically, look for an entry that begins with C:/Program Files/Java. If you find such an entry, select it and then click Delete.

  10. Click the New button.

    This opens a line for you to create a new path entry.

    FIGURE 1-3: Editing the Path variable.

  11. Type %JAVA_HOME%/bin as the new path entry.

    The percent signs insert the value of the JAVA_HOME variable in your new path entry. For example, if JAVA_HOME is set to C:/Program Files/Java/jdk19, the new path entry will be C:/Program Files/Java/jdk19/bin.

  12. Click OK three times to exit.

    The first OK gets you back to the Environment Variables dialog box; the second OK gets you back to the System Properties dialog box; and the third OK closes the System Properties dialog box.

For Linux, the procedure depends on which shell you’re using. For more information, consult the documentation for the shell you’re...

Erscheint lt. Verlag 13.11.2024
Sprache englisch
Themenwelt Informatik Programmiersprachen / -werkzeuge Java
Schlagworte beginner Java • beginning java • beginning java book • beginning java guide • dummies java book • easy java • java dummies book • java for beginners • java for beginners book • java guide • Java practice • java practice questions • java programming beginners • java quick reference • java tips • java tricks • java tutorials • quick java review
ISBN-10 1-394-29698-3 / 1394296983
ISBN-13 978-1-394-29698-9 / 9781394296989
Haben Sie eine Frage zum Produkt?
EPUBEPUB (Adobe DRM)
Größe: 925 KB

Kopierschutz: Adobe-DRM
Adobe-DRM ist ein Kopierschutz, der das eBook vor Mißbrauch schützen soll. Dabei wird das eBook bereits beim Download auf Ihre persönliche Adobe-ID autorisiert. Lesen können Sie das eBook dann nur auf den Geräten, welche ebenfalls auf Ihre Adobe-ID registriert sind.
Details zum Adobe-DRM

Dateiformat: EPUB (Electronic Publication)
EPUB ist ein offener Standard für eBooks und eignet sich besonders zur Darstellung von Belle­tristik und Sach­büchern. Der Fließ­text wird dynamisch an die Display- und Schrift­größe ange­passt. Auch für mobile Lese­geräte ist EPUB daher gut geeignet.

Systemvoraussetzungen:
PC/Mac: Mit einem PC oder Mac können Sie dieses eBook lesen. Sie benötigen eine Adobe-ID und die Software Adobe Digital Editions (kostenlos). Von der Benutzung der OverDrive Media Console raten wir Ihnen ab. Erfahrungsgemäß treten hier gehäuft Probleme mit dem Adobe DRM auf.
eReader: Dieses eBook kann mit (fast) allen eBook-Readern gelesen werden. Mit dem amazon-Kindle ist es aber nicht kompatibel.
Smartphone/Tablet: Egal ob Apple oder Android, dieses eBook können Sie lesen. Sie benötigen eine Adobe-ID sowie eine kostenlose App.
Geräteliste und zusätzliche Hinweise

Buying eBooks from abroad
For tax law reasons we can sell eBooks just within Germany and Switzerland. Regrettably we cannot fulfill eBook-orders from other countries.

Mehr entdecken
aus dem Bereich
Einführung, Ausbildung, Praxis

von Christian Ullenboom

eBook Download (2023)
Rheinwerk Computing (Verlag)
CHF 36,55
Moderne GUIs für RIAs und Java-Applikationen

von Ralph Steyer

eBook Download (2022)
Springer Fachmedien Wiesbaden (Verlag)
CHF 41,95