- Install Maven on Mac. Maven is the most widely used build and project dependency management tool for Java-based applications. We can install Maven on Mac OS using a package manager such as HomeBrew or through XCode Command Line Tools.
- A: If you have not yet installed Apple's Java Mac OS X 2012-006 update, then you are still using a version of Apple Java 6 that includes the plug-in and the Java Preferences app. See Note for Users of Macs that Include Apple Java 6 Plug-in. There can be multiple JDKs installed on a system – as many as you wish.
Since Lion 10.7.1 10.6.8 MacOSx Snow Leopard (correct me if wrong), Mac OS X comes with Apache Maven 3 built in, and can be located at /usr/share/maven. To verify the Maven installation, in terminal, issue the command mvn -version. I re-downloaded Java and again went to the website and it said that my Java was working. However the Xmage launcher continued to download as a.Jar file and wouldn't work. It seems like Java is properly installed, I assume some other thing is going wrong but then again I am an idiot. Software Download. Login to view your download history LOG IN NOW. Most Popular - No recent downloads for this product - Select a Product.
Hello, World in Java on Mac OS X
This documents instructs you on how to setup a Java programmingenvironment for your Mac OS X computer and provides a step-by-stepguide to creating, compiling, and executing a Java program.We assume you are running at least OS X 10.2.3.All of the software is freely available on the Web.
You will use the Java compiler javac to compile your Java programs andthe Java interpreter java to run them.Mac OS X includes implementation of Java 2 Standard Edition (J2SE) 1.4.1,so there is nothing to do in this step.
You will type commands in an application called the Terminal.You might enjoy reading Neal Stephenson's light-heartedessay In the Beginningwas the Command Line.
- Open a terminal window. You can find this underGo -> Applications -> Utilities. Drag the Terminal to your dock sinceyou will be using it frequently.
- You should now have a Terminal window somewhere on the screen.It will have a command prompt that looks something like:
- To check that you have the right version of Java installed, typethe text in boldface below.
If Java is installed, you should see something like:
Now, check that the Java compiler is accessible.
If it is installed, you should see something like
If not, install the Developers Tools CD that came with your Mac anduse Software Update to make sure you have the latest version.
- Now, create a directory to store your Java programs.In the window containing the Command Prompt, type the bold commandsbelow:
The mkdir command creates a new directory;the cd command changes the current working directory.After executing these commands, your working directoryis the newly created ~username/introcs/hello/. All of yourfiles for Assignment 0 will go here.Don't be scared by the Terminal - you will only need to use afew basic commands. Keep this window open since you will need it laterin the assignment.
- Since you will be using the Terminal frequently, we recommend customizingWe recommend customizing the default settings....
- To check that you have the right version of Java installed, typethe text in boldface below.
You will type and edit your programs in a text editor called JEdit.JEdit is similar to conventional word processors like MS Word,but it features many specialized programming tools includingsyntax highlighting, bracket matching, auto indenting, indentshifting, line numbering, and commenting out code. It's even written in Java.
- Downloadthe latest stable version of JEdit using the MacOSX package link.
- We recommend the following JEdit customizations.
- Enable Mac OS style menubar inUtilities -> Global Options -> Plugins -> Mac OS Settings
- Change the default indentation to four spaces viaUtilities -> Global Options -> Editing -> Indent Width andUtilities -> Global Options -> Editing -> Tab Width. Global Options -> Editing -> Soft tabs.-->
- Change the default tab width when printing to four spaces viaUtilities -> Global Options -> Printing -> Tab width when printing
- Add line numbers by checking Utilities -> Global Options -> Gutter -> Line Numbering
- Allow at most 80 characters per line byUtilities -> Global Options -> Editing -> Word wrap -> hard andUtilities -> Global Options -> Editing -> Wrap margin -> 80.
- Change the default line separator to Unix viaUtilities -> Global Options -> Loading & Saving -> Default Line Separator
- Remove the annoying . that marks the end of a line by uncheckingUtilities -> Global Options -> Text Area -> End of Line Markers
- To associate .java files with JEdit so that when you double-click a .java file,it opens it in JEdit:
- Right click a .java file (or click then shift-right click it if using Windows NT)
- Choose Open With...
- Select JEdit from the list of programs or locate JEdit by selecting Otherif necessary.
- Check the Always use this program to open this file type box
Now you are ready to write your first Java program.
- Launch JEdit Start -> jEdit.
- In the JEdit window, type the Java program exactly as it appears below.If you omit even a semicolon, the program won't work.
- When you're done, save the program usingFile -> Save As, chose the directory C:introcshelloand type in the file name HelloWorld.java.The file name is case sensitive and must exactly match the name of the classin the Java program. Don't forget to include the .java extension in thefile name.
It is now time to convert your Java program into a form more amenable for executingon a computer.
- From the Command Prompt, type
If javac complains in some way, you mistyped something, and you should check your program carefully. Ask for help if you can't see the mistake.
- If everything went well, you should see the followingin the Command Prompt:
Silence is golden in computer science.
- If everything went well, you should see the followingin the Command Prompt:
Now it is time to run your program. This is the fun part.
- At the Command Prompt, type
- If all goes well, you should see
- You may need to repeat this edit-compile-execute cycle a few times before it all goes smoothly.Use the up and down arrow keys to repeat previous commands and avoid extra typing.
When I try to run java I get: Exception in thread 'main'java.lang.NoClassDefFoundErrorYour CLASSPATH may have been set by some other program so that it no longer includes the current working directory in the search path. Try running your program with the command line
This page tells you how to download and install Java 8 and Eclipse on Mac OS X, and how to configure Eclipse.
Installing Java 8
Go to the Oracle website. You'll see something like this:
Scroll down until you see a heading beginning 'Java SE 8u65/8u66.' On the right, you'll see a Download button under the JDK header. Click it. The next screen will look like this:
Click the radio button next to 'Accept License Agreement' and then click on jdk-8u65-macosx-x64.dmg. You'll be asked whether to save the file that is going to be downloaded; click on Save File.
Open your Downloads folder, and double-click on jdk-8u65-macosx-x64.dmg. You'll see this window:
Double-click on the package icon, and follow the instructions to install. When the installation has completed, click on Done. At this point, you may close up the window and drag jdk-8u65-macosx-x64.dmg to the Trash.
Xmage Launcher Download
Installing Eclipse
If you already have Eclipse installed on your Mac, you need to get rid of it. To do so, first quit Eclipse if you're currently running it. Then, go to your workspace folder (probably in Documents/workspace) and save anything there that you want to keep, because you're about to get rid of this folder. Next, drag the workspace folder to the Trash.
Go to your Applications folder. One way to get there is, from the Finder, type command-shift-A. You'll a folder named eclipse in there; drag the eclipse folder to the Trash. If you have an Eclipse icon in your dock, remove it from the dock.
Now you're ready to download and install the newest version of Eclipse. Go to this website. You'll see a window like this:
Scroll down until you see 'Eclipse IDE for Java Developers' and click where it says 64 bit under Mac OS X.
You will see this window:
Click on the yellow download button. If asked, click on 'Open with Archive Utility (default)' and then click OK. The download might take a few minutes. You should not feel compelled to donate.
After the download completes, folders should automatically expand. If they don't, double-click on the .tar file. When that's done, you should see a folder named eclipse in your Downloads folder. When you open your Downloads folder, if you see Applications under the Favorites on the left side of the window, you should drag the eclipse folder into Applications. If you don't see Applications, then open a new window for Applications (from the Finder, command-shift-A), and drag the eclipse folder into Applications.
Open your Applications folder, and then open the eclipse folder. You'll see an item named Eclipse; if you like, drag its icon into the dock so that you'll be able to launch Eclipse easily.
Launch Eclipse. If you're asked whether you want to open it, of course you do; click Open. You'll see a window like this:
It will have your user name rather than mine (scot). Select where you want your workspace to be; I recommend the default of your Documents folder. Click the checkbox for using this location as the default, and then click OK.
You'll see a window like this:
Click on the Workbench arrow in the upper right that I've circled. You shouldn't see this screen again, even if you quit Eclipse and relaunch it.
You'll get an empty workbench like this:
We won't be using the 'Task List' and 'Connect Mylyn' windows. Click the 'x' on each to close it. Press the mouse on the Window menu item, then choose 'Perspective', and finally choose 'Save Perspective as...'. Enter 'cs10' for the name of this perspective and press return. Your workbench will now look like this:
You have now installed Eclipse!
Configuring Eclipse
You don't have to configure Eclipse the way I do, but you'll probably avoid some confusion if you do. Here's how.
X Mage Java Download Mac Os X
In the Eclipse menu bar, click on the Eclipse menu and then on 'Preferences...'. You'll see a window with two panes. On the left pane is a list of types of things you can configure.
Click on the triangle to the left of General. Then click on the triangle to the left of Appearance. Then click on 'Colors and Fonts.' You should see a window like this:
In the window in the middle, click on the triangle next to Java. Then double-click on 'Java Editor Text Font':
You'll see this window:
On the right, where you can select the size, click 12. Then close this window by clicking on the window's close button.
Close up the General preferences by clicking on the triangle to the left of General. Click the triangle next to Java and then click the triangle next to 'Code Style.' Then click Formatter. Here's what you should see:
Click the button that says 'New...'. You'll see a window such as this one:
You can type in any profile name you like. I used 'CS 10':
Click OK.
You should see a window like this:
Change the tab size to 2:
You'll see that the indentation size automatically changes as well.
Click on 'Blank Lines,' and after 'Between import groups' and 'Before declarations of the same kind,' change the values 1 to 0:
Click on 'Control Statements,' and check the first four boxes as I've done here:
Click OK.
Now click on triangles to close up Java. Click on the triangle next to Run/Debug, and then click on Console:
Click on the green color sample next to 'Standard In text color.' You'll get a color picker:
Slide the slider on the right down, so that you get a dark green. (You're at Dartmouth. What other color could you possibly want?)
Close the color picker window by clicking its close button, and click OK again to close the Preferences window.
And you're done!