This document instructs you on how to set up a Java programming environment for your Mac OS X computer. It also provides a step-by-step guide for creatingand compiling a Java program in IntelliJ and executing itfrom the command line.
You will need a Mac runningMac OS X 10.13 (High Sierra) to Mac OS X 10.15 (Catalina).
- I've been trying to use Java to execute Microsoft Excel in the coding by using the following code: Process pro = Runtime.getRuntime.exec('open -a Microsoft.
- The Best Free Java Software app downloads for Mac: Apple Java for OS X 10.6 PowerPoint 98 Viewer for Macintosh Amaya HTML Editor Xcode Assistant Voodo.
Open TextEdit Application. To write your code, you will use a text editor application included on all. SyncMate for Mac. SyncMate Expert. Requirements: OS X 10.10+. 50.9MB free space.
0. Install the Java Programming Environment |
The installer installs and configures a Java programming environment, includingOpenJDK 11 andIntelliJ IDEA, Community Edition 2020.1.
- Log in to the user account in which you will be programming.Your account must have Administrator privileges.
- Download the Mac OS X installerlift-java.pkg.
- Double-click lift-java.pkg to install the software.Enter your Mac OS X password when prompted and use all of the default options.
Warning
If you have previously used IntelliJ,run this installer only if you want a clean re-install.The installer overwrites IntelliJ IDEA CE.app andany previous IntelliJ 2020.1 settings.
- Delete lift-java.pkg (if it is not automatically deleted).
1. Open a Project in IntelliJ |
You will develop your Java programs in an application called IntelliJ IDEA, Community Edition.
IntelliJ organizes Java programs into projects.In our context, each project corresponds to one programming assignment.A typical project contains Java programs, associated data files, andcourse-specific settings (such as compiler options, style rules, and textbook libraries).
- Download the project for your programming assignment to a convenient location(such as the Desktop).
[ sample project for COS 126 (Princeton) ]
[ sample project for COS 226 (Princeton) ]
[ sample project for Computer Science: Programming with a Purpose (Coursera) ]
[ sample project for Algorithms, Part I (Coursera) ]
Double click the zip file to unzip.This creates a project folder with thename of the corresponding programming assignment (such as
hello
orpercolation
).Delete the zip file.Warning
The project folders contain course-specific information. Be sure to downloadthe one corresponding to your institution and course.
- Launch IntelliJ via Finder → Applications → IntelliJ IDEA CE.app.
- When you launch IntelliJ for the first time,
- IntelliJ may displaytheJetBrains privacy policy.Scroll down and Accept.
- IntelliJ may ask if you want to send anonymous usage statistics to JetBrains. Choose your preferred option.
- To open a project from the Welcome screen,click Open and select the project folder.You should see an assignment logo (in the main editor window) and a list of project files (in the Project View sidebar at left).
When you launch IntelliJ for the first time,it may take a minute or two to index your files;some features (such as auto importing) will be unavailable until this process completes.Warning
Do not select Create New Project;this option is intended for advanced programmers.Also, always use Open with a project folder, not an individual file. - When you are finished working, select the menu optionIntelliJ IDEA → Quit IntelliJ IDEA (⌘Q) to exit IntelliJ.The next time you launch IntelliJ, your recent projectswill appear in the Welcome screen for easy access.
2. Create a Program in IntelliJ |
Now you are ready to write your first Java program.IntelliJ features many specialized programming toolsincluding line numbering, syntax highlighting, bracket matching, auto indenting,auto formatting, auto importing, variable renaming, and continuous code inspection.
- To create a new Java program:
- Re-open IntelliJ and the project (if you closed it in the previous step).
- Click the project name in the Project View sidebar (at left), so that itbecomes highlighted.
- Select the menu option LIFT → New Java Class.When prompted, type HelloWorld for the Name and click OK.
- In the main editor window, complete the Java program
HelloWorld.java
exactly as it appears below.(IntelliJ generates the gray boilerplate code automatically,along with the course header block comment.)If you omit even a semicolon, the program won't work. - As you type, IntelliJ highlights different syntactic elementsin different colors.When you type a left bracket, IntelliJ adds the matching right bracket.When you begin a new line, IntelliJ indents it.
- To save the file, select the menu option File → Save All (⌘S).When you save the file, IntelliJ re-formats it (if necessary).
3. Compile and Execute the Program (from IntelliJ) |
Now, it is time to execute (or run) your program.This is the exciting part, where your computer follows the instructionsspecified by your program.Before doing so, you must compile your program intoa form more amenable for execution on a computer.
- Select the program that you wish to compile and execute in the the Project View sidebar. The program should now appear in the main editor window.
- To compile your program,select the menu optionLIFT → Recompile 'HelloWorld.java' (⌘B).If the compilation succeeds, you will receive confirmationin the status bar (at bottom).
If the compilation fails, a Recompile panel will open up (at bottom),highlighting the compile-time errors or warnings.Check your program carefully for typos, using the error messages as a guide.
- To execute your program,select the menu option LIFT → Run 'HelloWorld' with Arguments (⌘E).Since this program takes no command-line arguments, click OK.
You should see the output of the program (in white), along with a messagethat the program finished normally (with exit code 0).
Tip
Use the LIFT menu to compile and execute your program from IntelliJ.The Build and Run menus support additional options for advanced programmers.
Also be sure that the main editor window is active before using the LIFTmenu (e.g., by clicking the code you want to compile or execute).
4. Compile and Execute the Program (from the command line) |
Java Development On Mac
The command line is a simple and powerful mechanism forcontrolling your programs (e.g., command-line arguments,file redirection, and piping).IntelliJ supplies an embedded terminalfor easy access to the command line.
- Select the menu option View → Tool Windows → Terminal (⌘2).
- This will launch a Bash terminal where you type commands.You will see a command prompt that looks something like this:
The
~/Desktop/hello
is the current working directory, where~
is shorthand for your home directory. - To compile your program,type the following
javac
command.More specifically, type the text in yellow that appears on the same line as thecommand prompt.Assuming that the fileHelloWorld.java
is in the current working directory,you should not see any compile-time errors or warnings. - To execute your program,type the following
java
command:You should see the output of your program beneath the line on which you typed the command.Tip
Typically, you should compile from IntelliJ(because IntelliJ highlights the lines on which anycompile-time errors or warnings occur) and execute from the command line(because the command line makes it is easy to specify command-line argumentsand use file redirection).
5. Textbook Libraries (from the command line) |
To make our textbook libraries accessible to Java from the command line,you will use our wrapper scripts.
- Computer Science: An Interdisciplinary Approach (including COS 126 students).The programBarnsley.javauses our standard drawing and standard random libraries in
stdlib.jar
to draw aBarnsley fern.First download Barnsley.java.Then, use the Finder to move itto a project folder (such ashello
).Finally, to compile and execute it,type the following commands in the terminal:When you execute the program, a standard drawing window will appearand an image like this one will be generated, one point at a time:To get your command prompt back, close the standard drawing window.
- Algorithms, 4th Edition (including COS 226 and Coursera students).The programCollidingDisks.javauses various libraries in
algs4.jar
to simulate the motion of n disks subject to the lawsof elastic collision.First download CollidingDisks.javaThen, use the Finder to move it to a project folder (such aspercolation
).Finally, to compile and execute it,type the following commands in the terminal:When you execute the program, a standard drawing window will appearwith an animation of 20 colliding disks.To get your command prompt back, close the standard drawing window.Frequently Asked Questions - I installed IntelliJ and Java using the lift-java.pkg installerlast semester or year. Should I rerun this semester?
- Yes. This installer includes IntelliJ 2020.1and Java 11.The old installer may have used an earlier version of IntelliJ or Java.
- I previously used either the introcs.app or algs4.app installer.Should I use the lift-java.pkg installer?
- Yes. This installer includes IntelliJand Java 11 (instead of DrJava and Java 8).
- What happens if I rerun the lift-java.pkg installer?
- It will re-install and re-configure OpenJDK 11, IntelliJ,SpotBugs, PMD, Checkstyle, our textbook libraries,and wrapper scripts.
- The installer failed. How can I investigate why?
- Check the installer log at
/var/log/lift.log
. - I have Mac OS X 10.12 (Sierra). Is that too old?
- Yes.Yes. IntelliJ 2020.1 requires Mac OS X 10.13 (or newer).
- How long will the installer take to complete installation?
- Once downloaded, it should take about a minute.If you have anti-malware protection software running (such as McAfee Endpoint), it couldtake 5–10 minutes.
- What does the lift-java.pkg installer do?
- In short, it installs and configures Java, IntelliJ,SpotBugs,PMD,Checkstyle,and our textbook libraries,along with accompanying command-line tools.Here is a more detailed list:
- Installs OpenJDK 11.0.7.
- InstallsIntelliJ 2020.1.1with customized user preferences,available indepedently as lift-intellij.pkg.
- Installs the following command-line tools for Java, available independently aslift-cli.pkg.
- The textbook librariesstdlib.jar andalgs4.jar.
- Java wrapper scripts, includingjavac-algs4 and java-algs4.
- Custom.bashrc,.bash_profile, and.inputrc files.As a precaution, the installer will do this only if detects no preexistingbash configuration files.
- SpotBugs 4.0.3;our SpotBugs configuration file spotbugs.xml;and wrapper script spotbugs.
- PMD 6.15.0;our PMD configuration file pmd.xml;and wrapper script pmd.
- Checkstyle 8.31;various configuration files(checkstyle-cos126.xml,checkstyle-cos226.xml,checkstyle-coursera.xml, andcheckstyle-suppressions.xml);custom checks checkstyle-lift.jar;and wrapper script checkstyle.
- How is the software licensed?
- All of the included software is licensed under various open-source licenses.
- IntelliJ IDEA, Community Edition is licensed under theApache License, Version 2.0.
- OpenJDK 11 is licensed under theGNU General Public License,version 2, with the Classpath Exception.
- SpotBugs is licensed under theGNU Lesser Public License, Version 2.1.
- Checkstyle is licensed under theGNU Lesser Public License, Version 2.1.
- PMD is licensed under a BSD-style license.
- stdlib.jar and algs4.jar are licensed under theGNU General Public License, Version 3.
- What's the sha256sum of lift-java.pkg?
e5ef947039280e0b0520fd7bd3aff8a0373719b96b1745c08a42441f6554fafe
- Can I run the installer from the command line?
- Yes. Use the command
sudo installer -verbose -pkg lift-java.pkg -target /
- How can I uninstall the software?
- To uninstall OpenJDK 11,delete the following directory:
/Library/Java/JavaVirtualMachines/jdk-11.0.7.jdk/
- To uninstall IntelliJ, delete the following:
/Applications/IntelliJ IDEA CE.app
~/Library/Application Support/JetBrains/IdeaIC2020.1/
~/Library/Caches/JetBrains/IdeaIC2020.1/
~/Library/Logs/JetBrains/IdeaIC2020.1/
- To uninstall SpotBugs, PMD, Checkstyle,and our textbook libraries, delete the following directory:
/usr/local/lift/
- To uninstall our wrapper scripts, delete the following files:
/usr/local/bin/javac-{algs4,introcs}
/usr/local/bin/java-{algs4,introcs}
/usr/local/bin/jshell-{algs4,introcs}
/usr/local/bin/spotbugs
/usr/local/bin/pmd
/usr/local/bin/checkstyle
- To uninstall OpenJDK 11,delete the following directory:
- Can I use a vendor and version of Java other than OpenJDK 11?
- Yes.You may use any version of Java 8, Java 9, Java 10, or Java 12, from either Oracle or OpenJDK.However, if you do so, you will need to manually configure the Platform SDK and Project SDK viaIntelliJ via File → Project Structure.
- How can I check which version of Java is installed (and where it is installed)?
- Type the following commands in the terminal:It's important that the Java version numbers match and that you see the number
11
,but the rest is not critical. - How does this custom version of IntelliJ different from the standard one?
- IntelliJis an industrial-strength integrated development environment (IDE),suitable for use by professional programmers.The installer configures your user preferences to make itmore suitable for use by novice programmers:
- Disables all built-in plugins except Terminal and JUnit. Installs the SpotBugs, Checkstyle-IDEA, Run-with-Arguments, Save-Actions, and Archive browser plugins.
- Eliminates or reduces various popup elements (lightbulbs, code folding, breadcrumbs, gutter markers, notifications, parameter hints).
- Simplifies menus and toolbars, hiding advanced options.
- Disables live templates and postfix completion.
- Adopts the Obsidian Black color scheme.
- Auto-configures Java upon installation.
- Adds a few keyboard shortcuts.
The course-specific project folders perform additional customizations:
- Streamlines autocomplete to display only relevant libraries(such as
java.lang
,java.util
, andalgs4.jar
). - Configures SpotBugs and Checkstyle with course-specific rules.
- Provides course-specific libraries (such as
algs4.jar
). - Enables auto-formatting of code on save.
- Enables auto-importing of Java libraries.
- How can I manually configure the Platform SDK and Project SDK in IntelliJ?
- The installer should configure the Platform SDK automatically.To configure it manually,
- Navigate to File → Project Structure → Platform Settings → SDKs.
- Click the + symbol (top left) to add an SDK.
- Locate an SDK. A typical location for a Java SDK onMac OS X is
/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home/
. - Use the shorthand name suggested by IntelliJ(e.g., 11 for version 11.0.7).
To manually configure the Project SDK,
- Navigate to File → Project Structure → Project Settings → Project.
- Choose the desired Project SDK from the drop-down list.
- Be sure to use 8 as the Project language level, as our autogradercurrently supports only Java 8 features.
- What are the most important IntelliJ menu options to remember?
- Here are the most important ones (and their shortcuts).
- LIFT → New Java Class (⌘N). Create a new Java class.
- LIFT → Recompile (⌘B). Compile the current program.
- LIFT → Run with Arguments (⌘E). Run the current program with command-line arguments.
- LIFT → Open in Terminal (⌘T). Open a new Terminal tab.
- File → Save All (⌘S). Save (and reformat) all open files.
- View → Tool Windows → Project (⌘1). Show/hide the Project View sidebar.
- View → Tool Windows → Terminal (⌘2). Show/hide the Terminal window.
- Any special characters to avoid when naming IntelliJ projects or files?
- Do not use an exclamation point (!) as the last characterin the project folder (or any directory name along the path to your project folder);that will confuse both IntelliJ and Checkstyle.
- How can I create a new project in IntelliJ?
- If you want to inherit all of the properties of an existing project,
- Use the Finder to copy the project folder,giving it your preferred name.
- Delete any unwanted files.
- Be sure to keepthe
.iml
file (which defines the project),the.idea
subdirectory (which containsthe IntelliJ course preferences), andthe.lift
subdirectory (which contains the courselibraries).
To create a new project from scratch, you can use the Create New Project option from theWelcome screen. But, we do not recommend this approach for novice programmers.
- Can I use a version of IntelliJ that is more recent than 2020.1.1?
- Yes, though if it is 2020.2 (or above),you will need to migrate your user preferences.
- How I can I restore the original IntelliJ settings(instead of the abbreviated novice-friendly ones)?
- To restore the menus and toolbars: Preferences → Appearances & Behavior → Menus and Toolbars → Restore All Defaults.
- To restore all settings: Help → Find Action → Restore Default Settings.
- When I compile or execute a program from the command line that uses one of thetextbook libraries, I get an error that it cannot find the library. How can I fix this?
- Make sure that you are using the appropriate wrapper script,such as
javac-algs4
orjava-algs4
. - How should I configure Bash?
- If you followed our instructions, our wrapper scripts (such as
javac-algs4
andjava-algs4
)should already be available.Our autoinstaller customizes the command line in a few ways by copying these three configuration files:
.bashrc
,.bash_profile
, and.inputrc
.Note that the autoinstaller will copy these files only if none of them already exists.If you had previous versions and wish to replace your versions with ours, type the following commands: - How do I break out of a program in an infinite loop?
- Type
Ctrl-C
. - How do I specify EOF to signal that standard input is empty?
- On Mac OS X and Linux, type
Enter
Ctrl-D
.On Windows, typeEnter
Ctrl-Z
Enter
,even in Git Bash. - How can I run SpotBugs, PMD, and Checkstyle from the command line?
- The installer includes wrapper scripts to simplify this process.
- To run SpotBugs 4.0.3, type the following command in the terminal:The argument must be a list of
.class
files.Here is a list ofbug descriptions. - To run PMD 6.15.0, type the following command in the terminal:The argument must be either a single
.java
file ora directory containing one or more.java
files.Here is a list of bug patterns. - To run Checkstyle 8.31, type one ofthe following commands in the terminal, depending on whether you are COS 126, COS 226, or Coursera student:The argument must be a list of
.java
files.Here is a list ofavailable checks.
- To run SpotBugs 4.0.3, type the following command in the terminal:The argument must be a list of
Java FAQCommand-Line / Embedded Terminal FAQ
- Class
Class Mac
This document instructs you on how to set up a Java programming environment for your Mac OS X computer. It also provides a step-by-step guide for creatingand compiling a Java program in IntelliJ and executing itfrom the command line.
You will need a Mac runningMac OS X 10.13 (High Sierra) to Mac OS X 10.15 (Catalina).
- I've been trying to use Java to execute Microsoft Excel in the coding by using the following code: Process pro = Runtime.getRuntime.exec('open -a Microsoft.
- The Best Free Java Software app downloads for Mac: Apple Java for OS X 10.6 PowerPoint 98 Viewer for Macintosh Amaya HTML Editor Xcode Assistant Voodo.
Open TextEdit Application. To write your code, you will use a text editor application included on all. SyncMate for Mac. SyncMate Expert. Requirements: OS X 10.10+. 50.9MB free space.
0. Install the Java Programming Environment |
The installer installs and configures a Java programming environment, includingOpenJDK 11 andIntelliJ IDEA, Community Edition 2020.1.
- Log in to the user account in which you will be programming.Your account must have Administrator privileges.
- Download the Mac OS X installerlift-java.pkg.
- Double-click lift-java.pkg to install the software.Enter your Mac OS X password when prompted and use all of the default options.
Warning
If you have previously used IntelliJ,run this installer only if you want a clean re-install.The installer overwrites IntelliJ IDEA CE.app andany previous IntelliJ 2020.1 settings.
- Delete lift-java.pkg (if it is not automatically deleted).
1. Open a Project in IntelliJ |
You will develop your Java programs in an application called IntelliJ IDEA, Community Edition.
IntelliJ organizes Java programs into projects.In our context, each project corresponds to one programming assignment.A typical project contains Java programs, associated data files, andcourse-specific settings (such as compiler options, style rules, and textbook libraries).
- Download the project for your programming assignment to a convenient location(such as the Desktop).
[ sample project for COS 126 (Princeton) ]
[ sample project for COS 226 (Princeton) ]
[ sample project for Computer Science: Programming with a Purpose (Coursera) ]
[ sample project for Algorithms, Part I (Coursera) ]
Double click the zip file to unzip.This creates a project folder with thename of the corresponding programming assignment (such as
hello
orpercolation
).Delete the zip file.Warning
The project folders contain course-specific information. Be sure to downloadthe one corresponding to your institution and course.
- Launch IntelliJ via Finder → Applications → IntelliJ IDEA CE.app.
- When you launch IntelliJ for the first time,
- IntelliJ may displaytheJetBrains privacy policy.Scroll down and Accept.
- IntelliJ may ask if you want to send anonymous usage statistics to JetBrains. Choose your preferred option.
- To open a project from the Welcome screen,click Open and select the project folder.You should see an assignment logo (in the main editor window) and a list of project files (in the Project View sidebar at left).
When you launch IntelliJ for the first time,it may take a minute or two to index your files;some features (such as auto importing) will be unavailable until this process completes.Warning
Do not select Create New Project;this option is intended for advanced programmers.Also, always use Open with a project folder, not an individual file. - When you are finished working, select the menu optionIntelliJ IDEA → Quit IntelliJ IDEA (⌘Q) to exit IntelliJ.The next time you launch IntelliJ, your recent projectswill appear in the Welcome screen for easy access.
2. Create a Program in IntelliJ |
Now you are ready to write your first Java program.IntelliJ features many specialized programming toolsincluding line numbering, syntax highlighting, bracket matching, auto indenting,auto formatting, auto importing, variable renaming, and continuous code inspection.
- To create a new Java program:
- Re-open IntelliJ and the project (if you closed it in the previous step).
- Click the project name in the Project View sidebar (at left), so that itbecomes highlighted.
- Select the menu option LIFT → New Java Class.When prompted, type HelloWorld for the Name and click OK.
- In the main editor window, complete the Java program
HelloWorld.java
exactly as it appears below.(IntelliJ generates the gray boilerplate code automatically,along with the course header block comment.)If you omit even a semicolon, the program won't work. - As you type, IntelliJ highlights different syntactic elementsin different colors.When you type a left bracket, IntelliJ adds the matching right bracket.When you begin a new line, IntelliJ indents it.
- To save the file, select the menu option File → Save All (⌘S).When you save the file, IntelliJ re-formats it (if necessary).
3. Compile and Execute the Program (from IntelliJ) |
Now, it is time to execute (or run) your program.This is the exciting part, where your computer follows the instructionsspecified by your program.Before doing so, you must compile your program intoa form more amenable for execution on a computer.
- Select the program that you wish to compile and execute in the the Project View sidebar. The program should now appear in the main editor window.
- To compile your program,select the menu optionLIFT → Recompile 'HelloWorld.java' (⌘B).If the compilation succeeds, you will receive confirmationin the status bar (at bottom).
If the compilation fails, a Recompile panel will open up (at bottom),highlighting the compile-time errors or warnings.Check your program carefully for typos, using the error messages as a guide.
- To execute your program,select the menu option LIFT → Run 'HelloWorld' with Arguments (⌘E).Since this program takes no command-line arguments, click OK.
You should see the output of the program (in white), along with a messagethat the program finished normally (with exit code 0).
Tip
Use the LIFT menu to compile and execute your program from IntelliJ.The Build and Run menus support additional options for advanced programmers.
Also be sure that the main editor window is active before using the LIFTmenu (e.g., by clicking the code you want to compile or execute).
4. Compile and Execute the Program (from the command line) |
Java Development On Mac
The command line is a simple and powerful mechanism forcontrolling your programs (e.g., command-line arguments,file redirection, and piping).IntelliJ supplies an embedded terminalfor easy access to the command line.
- Select the menu option View → Tool Windows → Terminal (⌘2).
- This will launch a Bash terminal where you type commands.You will see a command prompt that looks something like this:
The
~/Desktop/hello
is the current working directory, where~
is shorthand for your home directory. - To compile your program,type the following
javac
command.More specifically, type the text in yellow that appears on the same line as thecommand prompt.Assuming that the fileHelloWorld.java
is in the current working directory,you should not see any compile-time errors or warnings. - To execute your program,type the following
java
command:You should see the output of your program beneath the line on which you typed the command.Tip
Typically, you should compile from IntelliJ(because IntelliJ highlights the lines on which anycompile-time errors or warnings occur) and execute from the command line(because the command line makes it is easy to specify command-line argumentsand use file redirection).
5. Textbook Libraries (from the command line) |
To make our textbook libraries accessible to Java from the command line,you will use our wrapper scripts.
- Computer Science: An Interdisciplinary Approach (including COS 126 students).The programBarnsley.javauses our standard drawing and standard random libraries in
stdlib.jar
to draw aBarnsley fern.First download Barnsley.java.Then, use the Finder to move itto a project folder (such ashello
).Finally, to compile and execute it,type the following commands in the terminal:When you execute the program, a standard drawing window will appearand an image like this one will be generated, one point at a time:To get your command prompt back, close the standard drawing window.
- Algorithms, 4th Edition (including COS 226 and Coursera students).The programCollidingDisks.javauses various libraries in
algs4.jar
to simulate the motion of n disks subject to the lawsof elastic collision.First download CollidingDisks.javaThen, use the Finder to move it to a project folder (such aspercolation
).Finally, to compile and execute it,type the following commands in the terminal:When you execute the program, a standard drawing window will appearwith an animation of 20 colliding disks.To get your command prompt back, close the standard drawing window.Frequently Asked Questions - I installed IntelliJ and Java using the lift-java.pkg installerlast semester or year. Should I rerun this semester?
- Yes. This installer includes IntelliJ 2020.1and Java 11.The old installer may have used an earlier version of IntelliJ or Java.
- I previously used either the introcs.app or algs4.app installer.Should I use the lift-java.pkg installer?
- Yes. This installer includes IntelliJand Java 11 (instead of DrJava and Java 8).
- What happens if I rerun the lift-java.pkg installer?
- It will re-install and re-configure OpenJDK 11, IntelliJ,SpotBugs, PMD, Checkstyle, our textbook libraries,and wrapper scripts.
- The installer failed. How can I investigate why?
- Check the installer log at
/var/log/lift.log
. - I have Mac OS X 10.12 (Sierra). Is that too old?
- Yes.Yes. IntelliJ 2020.1 requires Mac OS X 10.13 (or newer).
- How long will the installer take to complete installation?
- Once downloaded, it should take about a minute.If you have anti-malware protection software running (such as McAfee Endpoint), it couldtake 5–10 minutes.
- What does the lift-java.pkg installer do?
- In short, it installs and configures Java, IntelliJ,SpotBugs,PMD,Checkstyle,and our textbook libraries,along with accompanying command-line tools.Here is a more detailed list:
- Installs OpenJDK 11.0.7.
- InstallsIntelliJ 2020.1.1with customized user preferences,available indepedently as lift-intellij.pkg.
- Installs the following command-line tools for Java, available independently aslift-cli.pkg.
- The textbook librariesstdlib.jar andalgs4.jar.
- Java wrapper scripts, includingjavac-algs4 and java-algs4.
- Custom.bashrc,.bash_profile, and.inputrc files.As a precaution, the installer will do this only if detects no preexistingbash configuration files.
- SpotBugs 4.0.3;our SpotBugs configuration file spotbugs.xml;and wrapper script spotbugs.
- PMD 6.15.0;our PMD configuration file pmd.xml;and wrapper script pmd.
- Checkstyle 8.31;various configuration files(checkstyle-cos126.xml,checkstyle-cos226.xml,checkstyle-coursera.xml, andcheckstyle-suppressions.xml);custom checks checkstyle-lift.jar;and wrapper script checkstyle.
- How is the software licensed?
- All of the included software is licensed under various open-source licenses.
- IntelliJ IDEA, Community Edition is licensed under theApache License, Version 2.0.
- OpenJDK 11 is licensed under theGNU General Public License,version 2, with the Classpath Exception.
- SpotBugs is licensed under theGNU Lesser Public License, Version 2.1.
- Checkstyle is licensed under theGNU Lesser Public License, Version 2.1.
- PMD is licensed under a BSD-style license.
- stdlib.jar and algs4.jar are licensed under theGNU General Public License, Version 3.
- What's the sha256sum of lift-java.pkg?
e5ef947039280e0b0520fd7bd3aff8a0373719b96b1745c08a42441f6554fafe
- Can I run the installer from the command line?
- Yes. Use the command
sudo installer -verbose -pkg lift-java.pkg -target /
- How can I uninstall the software?
- To uninstall OpenJDK 11,delete the following directory:
/Library/Java/JavaVirtualMachines/jdk-11.0.7.jdk/
- To uninstall IntelliJ, delete the following:
/Applications/IntelliJ IDEA CE.app
~/Library/Application Support/JetBrains/IdeaIC2020.1/
~/Library/Caches/JetBrains/IdeaIC2020.1/
~/Library/Logs/JetBrains/IdeaIC2020.1/
- To uninstall SpotBugs, PMD, Checkstyle,and our textbook libraries, delete the following directory:
/usr/local/lift/
- To uninstall our wrapper scripts, delete the following files:
/usr/local/bin/javac-{algs4,introcs}
/usr/local/bin/java-{algs4,introcs}
/usr/local/bin/jshell-{algs4,introcs}
/usr/local/bin/spotbugs
/usr/local/bin/pmd
/usr/local/bin/checkstyle
- To uninstall OpenJDK 11,delete the following directory:
- Can I use a vendor and version of Java other than OpenJDK 11?
- Yes.You may use any version of Java 8, Java 9, Java 10, or Java 12, from either Oracle or OpenJDK.However, if you do so, you will need to manually configure the Platform SDK and Project SDK viaIntelliJ via File → Project Structure.
- How can I check which version of Java is installed (and where it is installed)?
- Type the following commands in the terminal:It's important that the Java version numbers match and that you see the number
11
,but the rest is not critical. - How does this custom version of IntelliJ different from the standard one?
- IntelliJis an industrial-strength integrated development environment (IDE),suitable for use by professional programmers.The installer configures your user preferences to make itmore suitable for use by novice programmers:
- Disables all built-in plugins except Terminal and JUnit. Installs the SpotBugs, Checkstyle-IDEA, Run-with-Arguments, Save-Actions, and Archive browser plugins.
- Eliminates or reduces various popup elements (lightbulbs, code folding, breadcrumbs, gutter markers, notifications, parameter hints).
- Simplifies menus and toolbars, hiding advanced options.
- Disables live templates and postfix completion.
- Adopts the Obsidian Black color scheme.
- Auto-configures Java upon installation.
- Adds a few keyboard shortcuts.
The course-specific project folders perform additional customizations:
- Streamlines autocomplete to display only relevant libraries(such as
java.lang
,java.util
, andalgs4.jar
). - Configures SpotBugs and Checkstyle with course-specific rules.
- Provides course-specific libraries (such as
algs4.jar
). - Enables auto-formatting of code on save.
- Enables auto-importing of Java libraries.
- How can I manually configure the Platform SDK and Project SDK in IntelliJ?
- The installer should configure the Platform SDK automatically.To configure it manually,
- Navigate to File → Project Structure → Platform Settings → SDKs.
- Click the + symbol (top left) to add an SDK.
- Locate an SDK. A typical location for a Java SDK onMac OS X is
/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home/
. - Use the shorthand name suggested by IntelliJ(e.g., 11 for version 11.0.7).
To manually configure the Project SDK,
- Navigate to File → Project Structure → Project Settings → Project.
- Choose the desired Project SDK from the drop-down list.
- Be sure to use 8 as the Project language level, as our autogradercurrently supports only Java 8 features.
- What are the most important IntelliJ menu options to remember?
- Here are the most important ones (and their shortcuts).
- LIFT → New Java Class (⌘N). Create a new Java class.
- LIFT → Recompile (⌘B). Compile the current program.
- LIFT → Run with Arguments (⌘E). Run the current program with command-line arguments.
- LIFT → Open in Terminal (⌘T). Open a new Terminal tab.
- File → Save All (⌘S). Save (and reformat) all open files.
- View → Tool Windows → Project (⌘1). Show/hide the Project View sidebar.
- View → Tool Windows → Terminal (⌘2). Show/hide the Terminal window.
- Any special characters to avoid when naming IntelliJ projects or files?
- Do not use an exclamation point (!) as the last characterin the project folder (or any directory name along the path to your project folder);that will confuse both IntelliJ and Checkstyle.
- How can I create a new project in IntelliJ?
- If you want to inherit all of the properties of an existing project,
- Use the Finder to copy the project folder,giving it your preferred name.
- Delete any unwanted files.
- Be sure to keepthe
.iml
file (which defines the project),the.idea
subdirectory (which containsthe IntelliJ course preferences), andthe.lift
subdirectory (which contains the courselibraries).
To create a new project from scratch, you can use the Create New Project option from theWelcome screen. But, we do not recommend this approach for novice programmers.
- Can I use a version of IntelliJ that is more recent than 2020.1.1?
- Yes, though if it is 2020.2 (or above),you will need to migrate your user preferences.
- How I can I restore the original IntelliJ settings(instead of the abbreviated novice-friendly ones)?
- To restore the menus and toolbars: Preferences → Appearances & Behavior → Menus and Toolbars → Restore All Defaults.
- To restore all settings: Help → Find Action → Restore Default Settings.
- When I compile or execute a program from the command line that uses one of thetextbook libraries, I get an error that it cannot find the library. How can I fix this?
- Make sure that you are using the appropriate wrapper script,such as
javac-algs4
orjava-algs4
. - How should I configure Bash?
- If you followed our instructions, our wrapper scripts (such as
javac-algs4
andjava-algs4
)should already be available.Our autoinstaller customizes the command line in a few ways by copying these three configuration files:
.bashrc
,.bash_profile
, and.inputrc
.Note that the autoinstaller will copy these files only if none of them already exists.If you had previous versions and wish to replace your versions with ours, type the following commands: - How do I break out of a program in an infinite loop?
- Type
Ctrl-C
. - How do I specify EOF to signal that standard input is empty?
- On Mac OS X and Linux, type
Enter
Ctrl-D
.On Windows, typeEnter
Ctrl-Z
Enter
,even in Git Bash. - How can I run SpotBugs, PMD, and Checkstyle from the command line?
- The installer includes wrapper scripts to simplify this process.
- To run SpotBugs 4.0.3, type the following command in the terminal:The argument must be a list of
.class
files.Here is a list ofbug descriptions. - To run PMD 6.15.0, type the following command in the terminal:The argument must be either a single
.java
file ora directory containing one or more.java
files.Here is a list of bug patterns. - To run Checkstyle 8.31, type one ofthe following commands in the terminal, depending on whether you are COS 126, COS 226, or Coursera student:The argument must be a list of
.java
files.Here is a list ofavailable checks.
- To run SpotBugs 4.0.3, type the following command in the terminal:The argument must be a list of
Java FAQCommand-Line / Embedded Terminal FAQ
- Class
Class Mac
- javax.crypto.Mac
- All Implemented Interfaces:
- Cloneable
This class provides the functionality of a 'Message Authentication Code' (MAC) algorithm.A MAC provides a way to check the integrity of information transmitted over or stored in an unreliable medium, based on a secret key. Typically, message authentication codes are used between two parties that share a secret key in order to validate information transmitted between these parties.
A MAC mechanism that is based on cryptographic hash functions is referred to as HMAC. HMAC can be used with any cryptographic hash function, e.g., SHA256 or SHA384, in combination with a secret shared key. HMAC is specified in RFC 2104.
Every implementation of the Java platform is required to support the following standard
Mac
algorithms:- HmacMD5
- HmacSHA1
- HmacSHA256
- Since:
- 1.4
Constructor Summary
Constructors
Modifier Constructor and Description protected
Mac(MacSpi macSpi, Provider provider, String algorithm)
Method Summary
Methods
Modifier and Type Method and Description Object
clone()
Returns a clone if the provider implementation is cloneable.byte[]
doFinal()
byte[]
doFinal(byte[] input)
Processes the given array of bytes and finishes the MAC operation.void
doFinal(byte[] output, int outOffset)
String
getAlgorithm()
Returns the algorithm name of thisMac
object.static Mac
getInstance(String algorithm)
Returns aMac
object that implements the specified MAC algorithm.static Mac
getInstance(String algorithm, Provider provider)
Returns aMac
object that implements the specified MAC algorithm.static Mac
getInstance(String algorithm, String provider)
Returns aMac
object that implements the specified MAC algorithm.int
getMacLength()
Provider
getProvider()
Returns the provider of thisMac
object.void
init(Key key)
void
init(Key key, AlgorithmParameterSpec params)
Initializes thisMac
object with the given key and algorithm parameters.void
reset()
void
update(byte input)
Processes the given byte.void
update(byte[] input)
void
update(byte[] input, int offset, int len)
Processes the firstlen
bytes ininput
, starting atoffset
inclusive.void
update(ByteBuffer input)
Processesinput.remaining()
bytes in the ByteBufferinput
, starting atinput.position()
.Methods inherited from class java.lang.Object
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
Constructor Detail
Mac
- Parameters:
macSpi
- the delegateprovider
- the provideralgorithm
- the algorithm
Method Detail
getAlgorithm
Returns the algorithm name of thisMac
object.This is the same name that was specified in one of the
getInstance
calls that created thisMac
object.- Returns:
- the algorithm name of this
Mac
object.
getInstance
Returns aMac
object that implements the specified MAC algorithm.This method traverses the list of registered security Providers, starting with the most preferred Provider. A new Mac object encapsulating the MacSpi implementation from the first Provider that supports the specified algorithm is returned.
Note that the list of registered providers may be retrieved via the
Security.getProviders()
method.- Parameters:
algorithm
- the standard name of the requested MAC algorithm. See the Mac section in the Java Cryptography Architecture Standard Algorithm Name Documentation for information about standard algorithm names.- Returns:
- the new
Mac
object. - Throws:
NoSuchAlgorithmException
- if no Provider supports a MacSpi implementation for the specified algorithm.- See Also:
Provider
getInstance
Returns aMac
object that implements the specified MAC algorithm.A new Mac object encapsulating the MacSpi implementation from the specified provider is returned. The specified provider must be registered in the security provider list.
It grabs Safari, Firefox and Flock bookmarks and also gives you access to 1Password 1Click bookmarks so you can navigate, fill a form and submit it with ease. DockSpacesis a small application that allows you to have up to 10 different docks, and swap them from the menu bar. You can also link a Dock with a so you can redefine your productivity. The tool is a Universal Binary application which means that it works on Intel or PowerPC Macs, running OS X 10.4 (Tiger) or Mac OS X 10.5 (Leopard).14. Gtd for mac os. With Growl notification, you know which dock you are using.
Note that the list of registered providers may be retrieved via the
Security.getProviders()
method.- Parameters:
algorithm
- the standard name of the requested MAC algorithm. See the Mac section in the Java Cryptography Architecture Standard Algorithm Name Documentation for information about standard algorithm names.provider
- the name of the provider.- Returns:
- the new
Mac
object. - Throws:
NoSuchAlgorithmException
- if a MacSpi implementation for the specified algorithm is not available from the specified provider.NoSuchProviderException
- if the specified provider is not registered in the security provider list.IllegalArgumentException
- if theprovider
is null or empty.- See Also:
Provider
getInstance
Returns aMac
object that implements the specified MAC algorithm.A new Mac object encapsulating the MacSpi implementation from the specified Provider object is returned. Note that the specified Provider object does not have to be registered in the provider list.
- Parameters:
algorithm
- the standard name of the requested MAC algorithm. See the Mac section in the Java Cryptography Architecture Standard Algorithm Name Documentation for information about standard algorithm names.provider
- the provider.- Returns:
- the new
Mac
object. - Throws:
NoSuchAlgorithmException
- if a MacSpi implementation for the specified algorithm is not available from the specified Provider object.IllegalArgumentException
- if theprovider
is null.- See Also:
Provider
getProvider
- Returns:
- the provider of this
Mac
object.
getMacLength
Returns the length of the MAC in bytes.- Returns:
- the MAC length in bytes.
init
- Parameters:
key
- the key.- Throws:
InvalidKeyException
- if the given key is inappropriate for initializing this MAC.
init
Initializes thisMac
object with the given key and algorithm parameters.- Parameters:
key
- the key.params
- the algorithm parameters.- Throws:
InvalidKeyException
- if the given key is inappropriate for initializing this MAC.InvalidAlgorithmParameterException
- if the given algorithm parameters are inappropriate for this MAC.
update
- Parameters:
input
- the input byte to be processed.- Throws:
IllegalStateException
- if thisMac
has not been initialized.
update
Processes the given array of bytes.- Parameters:
input
- the array of bytes to be processed.- Throws:
IllegalStateException
- if thisMac
has not been initialized.
update
Processes the firstlen
bytes ininput
, starting atoffset
inclusive.- Parameters:
input
- the input buffer.offset
- the offset ininput
where the input starts.len
- the number of bytes to process.- Throws:
IllegalStateException
- if thisMac
has not been initialized.
update
Processesinput.remaining()
bytes in the ByteBufferinput
, starting atinput.position()
. Upon return, the buffer's position will be equal to its limit; its limit will not have changed.- Parameters:
input
- the ByteBuffer- Throws:
IllegalStateException
- if thisMac
has not been initialized.- Since:
- 1.5
doFinal
Finishes the MAC operation.A call to this method resets this
Mac
object to the state it was in when previously initialized via a call toinit(Key)
orinit(Key, AlgorithmParameterSpec)
. That is, the object is reset and available to generate another MAC from the same key, if desired, via new calls toupdate
anddoFinal
. (In order to reuse thisMac
object with a different key, it must be reinitialized via a call toinit(Key)
orinit(Key, AlgorithmParameterSpec)
.- Returns:
- the MAC result.
- Throws:
IllegalStateException
- if thisMac
has not been initialized.
doFinal
Finishes the MAC operation.A call to this method resets this
Mac
object to the state it was in when previously initialized via a call toinit(Key)
orinit(Key, AlgorithmParameterSpec)
. That is, the object is reset and available to generate another MAC from the same key, if desired, via new calls toupdate
anddoFinal
. (In order to reuse thisMac
object with a different key, it must be reinitialized via a call toinit(Key)
orinit(Key, AlgorithmParameterSpec)
.The MAC result is stored in
output
, starting atoutOffset
inclusive.- Parameters:
output
- the buffer where the MAC result is storedoutOffset
- the offset inoutput
where the MAC is stored- Throws:
ShortBufferException
- if the given output buffer is too small to hold the resultIllegalStateException
- if thisMac
has not been initialized.
doFinal
Processes the given array of bytes and finishes the MAC operation.A call to this method resets this
Mac
object to the state it was in when previously initialized via a call toinit(Key)
orinit(Key, AlgorithmParameterSpec)
. That is, the object is reset and available to generate another MAC from the same key, if desired, via new calls toupdate
anddoFinal
. (In order to reuse thisMac
object with a different key, it must be reinitialized via a call toinit(Key)
orinit(Key, AlgorithmParameterSpec)
.- Parameters:
input
- data in bytes- Returns:
- the MAC result.
- Throws:
IllegalStateException
- if thisMac
has not been initialized.
reset
Resets thisMac
object.A call to this method resets this
Mac
object to the state it was in when previously initialized via a call toinit(Key)
orinit(Key, AlgorithmParameterSpec)
. That is, the object is reset and available to generate another MAC from the same key, if desired, via new calls toupdate
anddoFinal
. (In order to reuse thisMac
object with a different key, it must be reinitialized via a call toinit(Key)
orinit(Key, AlgorithmParameterSpec)
.
clone
Returns a clone if the provider implementation is cloneable.- Overrides:
clone
in classObject
- Returns:
- a clone if the provider implementation is cloneable.
- Throws:
CloneNotSupportedException
- if this is called on a delegate that does not supportCloneable
.- See Also:
Cloneable
Java Program For Banking Atm Machine
- Class
- Summary:
- Nested |
- Field |
- Constr |
- Detail:
- Field |
- Constr |
Submit a bug or feature
For further API reference and developer documentation, see Java SE Documentation. That documentation contains more detailed, developer-targeted descriptions, with conceptual overviews, definitions of terms, workarounds, and working code examples.
Copyright © 1993, 2020, Oracle and/or its affiliates. All rights reserved. Use is subject to license terms. Also see the documentation redistribution policy.
Airplay apple tv for mac. Scripting on this page tracks web page traffic, but does not change the content in any way.