Java Compilers For Mac



In most Java compilers, so long as the two java files are in the same folder they can work with each other using constructor methods; however that doesn’t seem to be the same in Jedona. I wish I could work on some of my bigger projects that require several Java files, but overall simple projects work well on this. JDoodle is a free Online Compiler, Editor, IDE for Java, C, C, PHP, Perl, Python, Ruby and many more. You can run your programs on the fly online and you can save and share them with others. Quick and Easy way to compile and run programs online.

(P)Bookmarks.dev - Open source Bookmarks and Codelets Manager for Developers & Co. See our How To guides to help you get started. Share your favorites bookmarks with the community and they might get published on Github -

Well, I’ve recently gone to the “silver” side and acquired a MacBook Pro to use it for development when I am not at my PC. By development I mean here mainly Java + Javascript development. So I’ve written this post to remember what I had to install/configure to achieve this goal.

I need to mention that until now I’ve been a user of Windows (XP/7) and Linux (Ubuntu/Mint/Cent OS) operation systems.

Run Java In Terminal Mac

At the time of this writing MacBook Pro runs on OS X Yosemite Version 10.10.5. The new version El Capitan was available, but I didn’t do the upgrade first because it had to many bad reviews…

Contents

  • JDK
  • Extras
    • Keyboard shortcuts
    • MySQL
    • Terminal window

JDK

So first things first- installe a Java Development Kit (JDK), which is a software development environment used for developing Java applications and applets. It includes the Java Runtime Environment (JRE), an interpreter/loader (java), a compiler (javac), an archiver (jar), a documentation generator (javadoc) and other tools needed in Java development.

Download the Mac OS X x64 .dmg files version

You can find out where the JDK is installed, by executing the /usr/libexec/java_home -v 1.7 , on the terminal command:

You will need to know this when setting up a project in IntelliJ for example.

Set JAVA_HOME

JAVA_HOME is just a convention, usually used by Tomcat, other Java EE app servers and build tools such as Maven to find where Java lives.

In Mac OSX 10.5 or later, Apple recommends to set the $JAVA_HOME variable to /usr/libexec/java_home, just export $JAVA_HOME in file ~/.bash_profile or ~/.profile

Maven

With the JAVA_HOME environment variable configure, go to the Apache Maven Downloads website, download the .tar.gz or .zip archive and unpack it in a folder of your choice – I put it under the /opt directory:

It is also recommended to create a symbolic link to the Maven home, so that when let’s say you update your Maven version, you’ll only have to change the symbolic link target:

Then set Maven in the environment variables

Close the terminal and open a new one. When you try now to get the maven versioning you should get something like the following:

An alternative is to use Homebrew and execute the following command:

GIT

Open a terminal window and type the following command for example:

At the next moment you will be asekd to install Xcode. This is the a complete developer toolset for building apps that run on Apple TV, Apple Watch, iPhone, iPad, and Mac. It includes the Xcode IDE, simulators, and all the required tools and frameworks to build apps for iOS, watchOS, tvOS, and OS X (it also contains GNU Compiler Collection-gcc).

You can do the above, but if you do not want everything from that package you can install Homebrew (“Homebrew installs the stuff you need that Apple didn’t.”) and run the following commands:

Either way once Git is installed the initial command git –version will bring the installed version:

If you are working with Github, I recommend you also install the Github Desktop

IntelliJ

In the mean time IntelliJ has become my favorite IDE, mainly because you have almost the same feature support when doing front-end development. To install it, go to the download page and follow the installation instructions:

INSTALLATION INSTRUCTIONS

  • Download the idea-15.dmg OS X Disk Image file.
  • Mount it as another disk in your system.
  • Copy IntelliJ IDEA to your Applications folder

Once done you need to get acquainted with key shortcuts for OS X – IntelliJ IDEA Mac OS X Keymap

Extras

Keyboard shortcuts

General

Please visit](https://support.apple.com/en-us/HT201236) for usual keyboard shortcuts (Cut, copy, paste, and other common shortcuts, document shortcuts etc.)

Finder

  • Shift + cmd + C > go to Computer
  • Shift + cmd + H > go to Home folder
  • Shift + cmd + D > go to Desktop

A quick access with the mouse to the same folders is by dragging and dropping them on the sidebar under Favorites

As long as we are by sidebar subject, a good productivity gain can be achieved by using Smart Folders – these folders let you save a search to reuse in the future. Smart Folders are updated continuously, so they always find all the files on your computer that match the search criteria. Watch the following video to see how you can easily add them to the sidebar

NodeJS

Node.js® is a JavaScript runtime built on Chrome’s V8 JavaScript engine. Node.js uses an event-driven, non-blocking I/O model that makes it lightweight and efficient. Node.js’ package ecosystem, npm, is the largest ecosystem of open source libraries in the world. Recently is a must have tool if you need to do fancier stuff on your front-end part of your application.

Go to https://nodejs.org/ and download the latest version for OS X (x64). Double click on the node-v4.2.2.pkg file (latest stable version at the writing of the post) and follow the installation instructions steps.

When ready open a terminal window and check the version installed to see if it is working:

MySQL

Go to Downloads page – http://dev.mysql.com/downloads/mysql/, download the Mac OS X 10.10 (x86, 64-bit), DMG Archive and follow the steps described in the installation guide.

Start, stop server

The MySQL Installation Package includes a MySQL preference pane that enables you to start, stop, and control automated startup during boot of your MySQL installation.

This preference pane is installed by default, and is listed under your system’s System Preferences window, which can be found under Applications.

Access MySQL from command line

Basically need to add MySQL to the PATH variable. Edit the /~.bash_profile with the following:

To test that it’s working start a new terminal and verify mysql version from command line:

Install MySQL Workbench

If you want to have also a GUI on top of it I recommend you install the MySQL Workbench that can be also found in the downloads section. Installation instruction is the same as the MySQL server installation.

Terminal window

Set background black

Open Terminal, then go to the Terminal menu -> Preferences, choose the Settings tab and set the Pro theme as the default.

Jump to beginning/end of a line

To jump at

  • beginning of a line – Ctrl+A
  • end of a line – Ctrl+E
  • jump between words – Alt+</>
Java Compilers For Mac

Open terminal in here

Go to:

Enable New Terminal at Folder. There’s also New Terminal Tab at Folder, which will create a tab in the frontmost Terminal window (if any, else it will create a new window). These Services work in all applications, not just Finder, and they operate on folders as well as absolute pathnames selected in text.

You can even assign command keys to them.

Services appear in the Services submenu of each application menu, and within the contextual menu (Control-Click or Right-Click on a folder or pathname).

The New Terminal at Folder service will become active when you select a folder in Finder. You cannot simply have the folder open and run the service “in place”. Go back to the parent folder, select the relevant folder, then activate the service via the Services menu or context menu.

In addition, Lion Terminal will open a new terminal window if you drag a folder (or pathname) onto the Terminal application icon, and you can also drag to the tab bar of an existing window to create a new tab.

Finally, if you drag a folder or pathname onto a tab (in the tab bar) and the foreground process is the shell, it will automatically execute a “cd” command. (Dragging into the terminal view within the tab merely inserts the pathname on its own, as in older versions of Terminal.)

You can also do this from the command line or a shell script:

This is the command-line equivalent of dragging a folder/pathname onto the Terminal application icon.

Use aliases

To ease your life for long and usual commands use aliases. For example to connect remote instead of typing ssh ama@x.y.z.q and having to remember ip address or server name, you could just type rmcon (or whatever it’s easy for you to remember). To do that append to the .bash_profile in your home directory the alias command and then source the file:

I can’t stress enough, how much comfortable your life can become, if you are using aliases the right way - A developer’s guide to using aliases

Commands

Find out who is listening on port (e.g. 8080)

iTerm2

A very nice alternative to the “classic” terminal is iTerm, now in version 2:

iTerm2 is a replacement for Terminal and the successor to iTerm. It works on Macs with OS 10.5 (Leopard) or newer. iTerm2 brings the terminal into the modern age with features you never knew you always wanted

Look under Preferences > Keys for shortcuts to easily navigate/move the tabs…

Generate ssh keys

Open a terminal window and execute the following command:

Man pages:

ssh-keygen generates, manages and converts authentication keys for ssh(1).ssh-keygen can create RSA keys for use by SSH protocol version 1 and DSA, ECDSA, ED25519 or RSA keys for use by SSH protocol version 2.The type of key to be generated is specified with the -t option.If invoked without any arguments, ssh-keygen will generate an RSA key for use in SSH protocol 2 connec-tions.

You will be asked then where to store the key (default under /Users/YOUR_USERNAME/.ssh/id_rsa)

When asked for a passphrase you can enter a passphrase to add it to the key. If you choose to add a passphrase every time you want to use your key with ssh, you’ll have to enter this passphrase. It is a little bit more inconvenient, but more secure.

Once that is done, you should get a message like the following:

You can now use the generated id_rsa.pub key and upload it to the systems you want to connect to over ssh.

Install Programs from Unidentified Developers {.title}

By default, Mac OS only allows users to install applications from ‘verified sources.’ To change that open the System Preferences > Security & Privacy > General and select “Allow applications downloaded from: Anywhere“. Follow this link, to see a more detailed description with pictures.

Often used UNIX keys on the German/Swiss keyboard

I bought the Mac Book to use it as developer machine on the go and one of my initial surprises was the missing of some keys a developer/terminal user uses pretty often like []|{}~

Find below a map for these keys:

Run Java On Mac

So here it is, my personal keyboard map reminder for the Mac OS X:

| pipe symbol alt7
backslash alt shift 7 = alt/
[ left (opening) square bracket alt 5
] right (closing) square bracket alt 6
{ left (opening) curly bracket alt 8
} right (closing) curly bracket alt 9
~ Tilde alt n followed by the space key
@ “At” symbol alt g (lowercase G) alt L German Keyboard

How to test everything is working

A smoke test to verify if everything installed is functioning properly “together” is to generate an application with JHipster and push it to a git repository.

JHipster is a Yeoman generator, used to create a Spring Boot + AngularJS project.

For any suggestions please leave a comment. Thank you.

References

Adrian Matei

Creator of Podcastpedia.org and Codepedia.org, computer science engineer, husband, father, curious and passionate about science, computers, software, education, economics, social equity, philosophy - but these are just outside labels and not that important, deep inside we are all just consciousness, right?
Java is one of the most famous and favored languages by computer programmers. Although easier language like Python is becoming common, due to the availability of resources and libraries, Java is still preferred by many developers.
Developing a Java code for a program or project is much easier with an IDE or Integrated Development Environment. Apart from code editing, these can be used for building Java applications, testing, debugging, code inspections, and code assistance.
They offer the environment for visual GUI builder and code editor, Java, Maven build tools and much more. Here are Top 10 Offline Java Compilers. Most of them are also perfect to use when working with many other languages such as PHP, C or C++.

1. NetBeans

NetBeans is an open source integrated environment and a widely used compiler by many of the programmers. NetBeans extends its support to all Java application types including Java SE, JavaFX, Java ME, web, EJB and even mobile applications. Its modular design enables developers to extend its functionality with plugins.
NetBeans can be used for other compiling languages like C/C++ and also to program with scripting languages like PHP. It runs on all popular OS platforms, Microsoft Windows, Mac OS X, Linux, Solaris comprehending the platform independence of JVM.

2. Eclipse

Eclipse is yet another IDE for developers which is mostly written in Java. Eclipse has brilliant features such as integration with Maven, Mylyn, XML editor, Git client, CVS client, PyDev. It also comes with base workspace and an extensible plug-in system so that you can customize the IDE according to your developer needs.
Eclipse supports a lot of other languages such as C, C++, JavaScript, Perl, PHP, Prolog, Python, R, Ruby so that you can work on projects that on codes in different languages. Eclipse is available for Windows, Mac OS X, and Linux.

3. IntelliJ IDEA

InterlliJ IDEA is an IDE, which is suitable for programmers looking for Android development. It comes in two editions, the Community Edition which is well suited for Java, Scala, and Android development.
The Ultimate Edition has all other features which are absent in the Community Edition and can be used for the web, mobile and enterprise development. It has SQL tools along with support for JavaScript, TypeScript, Java EE, Spring, GWT, Vaadin, Play, Grails, and other Frameworks.

4. Android Studio

Primarily designed for Android Development, Android Studio is a product from the Google developers. It is the official IDE for Android and comes with proper coding, editing, and debugging features. Android Studio comes with Pro Guard and app-signing capabilities with built-in support for Google Cloud platform. The projects can be used with Java Development Kit.

It also integrates with version control tools, such as GitHub and Subversion, to keep your team in sync with a project and build changes. You can also import projects from GitHub and right away work on it. There are many readily usable templates in Android Studio that eases up the work for developers.

5. Enide Studio 2014

Although developed as a standalone product for all operating systems, Enide Studio now generates Tool Suite for Node.js, JavaScript, and Java Development. It is available also from the Eclipse Plugin store.
It has some features such as NPM support, support for GitHub and many other plugins. With syntax highlighting and correction suggestions, coding is faster and easier in Enide Studio.

6. BlueJ

BlueJ is a Java Development Environment for beginners. It is useful for educational purposes and small-scale programming and application development. It has a simple interface where objects can be creatively integrated and tested. It runs on Windows, Mac OS X, and Linux platforms.
You can also run it on a USB without installation. It works as a graphical shell/REPL for Java meaning that Java expressions and parameters can be passed and invoked without compiling.

Java Compilers For Mac Operating System

7. jEdit

jEdit works on Windows, Linux, and Mac OS X platforms. It comes with some excellent features such as syntax highlighting for over 200 languages and an extensible plugin architecture with many macros and plugins.
It has many file management functions such as support for over 160 character encoding and multiple data usage simultaneously. Many source code editing options and customization are possible with jEdit.

Java Compiler For Mac Os


Best Java Compilers For Mac

8. jGrasp

jGrasp is a lightweight environment for software visualizations. It produces Control Structure Diagrams for languages such as Java, C++, and Complexity Profile Graphs. It runs on Windows, Mac OS and Linux. Tutorials about the features of jGrasp are available for beginners.

9. jSource

jSource is a lightweight but powerful Java IDE written in Swing. It has good creating, editing, compilation and running tools for developers. It also has syntax highlighting for other languages as well. It has limited features compared to other IDEs but is still an option for systems with limited resources or hardware support.

10. jDeveloper

jDeveloper comes from the Oracle Corporation and is an IDEreleased as freeware. It offers various features for developers dealing with Java, XML, SQL and PL/SQL, HTML, JavaScript, BPEL, and PHP. jDeveloper is ideal for coding, debugging, optimization with extended features for profiling and deploying.
jDeveloper integrates with the Oracle Application Development Framework- an end-to-end Java EE-based framework which further makes the development process easier. jDeveloper comes in 3 editions, which include the Java Edition, J2EE Edition, and Studio Edition.

Final Words

Most of these IDEs make you free from the conventional methods of coding where the programmer has to enter each and every line of the code word by word. Using compilers such as NetBeans or Eclipse, the IDE highlights the errors and comes with suggestions.
You can also use a lot of shortcuts and auto fill options that save the work for hours. With many libraries available and most of which are supported by the IDEs, programming is simplified than ever before. For Android development, Android Studio is the best choice as it can also be used to work with Java to an extent.

Java Compiler Machine Language


Java Compilers For Mac Os

Many function templates are also available in the IDE or can be imported with ease from online sources as they all run smoothly in the IDE. It doesn’t matter if you are a Linux, Mac or Windows user, working with an IDE can make significant progress in the programmer that you are.