SWI-Prolog and Eclipse PDT for Mavericks - osx-mavericks

Following the instruction, I installed the SWI-Prolog (6.6.5 for MacOSX 10.6 and later) and xquartz (X11).
After I downloaded the latest Eclipse version (both Kepler and Juno) and I installed the PDT plugin.
The prolog console is not active and if I try to consult the .pl file nothing happens.
Is there something I have not done?

Likely the PDT plug-in cannot find where SWI-Prolog is installed. Note that Mac OS X GUI applications don't run on top of the BSD layer and, as such, don't see any environment variables that you define there. The workaround is to define the necessary environment variables (e.g. pointing to the SWI-Prolog binary) in Eclipse itself.

I solved my problem following this http://va.lent.in/prolog-for-mac/

Related

Pycharm 4.5 CE crashes on launch on OS X 10.8.5

I upgraded from Pycharm 4.0 (which worked fine) to 4.5 community edition on Mac OS 10.8.5.
It crashes on launch after bouncing a bit in the dock.
The log files, console, all show nothing.
I'm running java 1.6.0_65, and have Python 2.7, Jython, PyPy via Macports.
Any ideas?
Make sure you've installed Apple's Java for OS X 2014-001 (at least).
Try to delete ~/Library/Java/Extensions, see the issue IDEA-137147.
Similar to the answer for IntelliJ IDEA, if you can't delete ~/Library/Java/Extensions, i.e., because you need it's contents (likely JAI jars) as part of other applications, you can create a file, pycharm.vmoptions in ~/Library/Preferences/PyCharm40 with contents:
-Djava.ext.dirs=/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home/lib/ext
to override OSX Java 6's default behavior of checking the user's ~/Library/Java/Extensions directory in addition to the system's extensions on application start up; but only for PyCharm.

Issue completing the install script for pkgin/pkgsrc for OSX 10.7, segfault running pkgin

In attempting to install pkgin/pkgsrc (NetBSD-based package managment tools), using the saveosx.org instructions and github repository.
The repository has installation instructions, which I followed, up to the point of a specific but uninformative error:
It looks like there was an issue running: sudo /usr/pkg/bin/pkgin -y update
I tried running this file directly, but my terminal reports a segmentation fault.
I'm running OSX 10.7.5 and have Xcode-Command-Line Tools installed, but I find no information about Darwin version compatibility on NetBSD's site. My searches have revealed no one else reporting issues using pkgin.
Version 5.0+ is supported according to www.netbsd.org/docs/pkgsrc/platforms.html#darwin, which according to wikipedia (en.wikipedia.org/wiki/Darwin_%28operating_system%29#Release_history) corresponds to OSX 10.1.1+
What options do I have besides upgrading my operating system and hoping the problem is fixing by having newer libraries or a newer kernel?
For reference:
www.pkgsrc.org/#docs
www.perkin.org.uk/pages/pkgsrc-binary-packages-for-osx.html
wiki.netbsd.org/pkgsrc/pkgsrc_64bit_osx/
Related question: Unable to run pkgin on Mac OSX
It would appear that the pkgin binary currently supplied by saveosx is compiled only for more recent OSX releases. It needs at least a Darwin-14.x kernel, or newer, so it won't even run on 10.9.5. Unfortunately the script fails to check the OSX version before it blindly tries to run the pkgin binary, causing the program to crash.
saveosx is basically a painfully obnoxious, rather ugly, and poorly implemented. set of scripts that are superfluous to actually using pkgsrc on OSX.
I would strongly recommend avoiding saveosx for the time being.
Instead I would recommend trying the following well supported alternative:
OSX binary pkgsrc packages
A 32-bit Snow Leopard version that runs on 10.6.8 and newer is available, and I just checked the distribution directory and I see some 2015Q1 i386 packages are just now available, still supporting 10.6.8:
2015Q1 32-bit (i386) Snow Leopard and newer pkgsrc bootstrap
You can of course also build your own pkgsrc bootstrap for any specific OSX environment:
pkgsrc home

Gdb on Mac OS X v10.7 (Lion)

I am a new Mac user and wonder how to install the latest version of GDB (> 7.1). I prefer to use Homebrew, but I could not find GDB listed.
brew install gdb
Error: No available formula for gdb
What is the best way to do it?
When installed Xcode, it may have installed an older version. Currently,
$ which gdb
/usr/bin/gdb
$ gdb --version
GNU gdb 6.3.50-20050815 (Apple version gdb-1705) (Fri Jul 1 10:50:06 UTC 2011)
Copyright 2004 Free Software Foundation, Inc.
But I need version > 7.1
System version,
Model Name: MacBook Air
System Version: Mac OS X 10.7.1 (11B2118)
Homebrew does not provide gcc and the associated development tool formulas over concerns that custom/non-system compilers could break builds. Two possibilities for easiness:
Use http://www.macports.org/
Look here https://github.com/mxcl/homebrew/wiki/Custom-GCC-and-cross-compilers
This is probably the command for you:
brew install https://raw.github.com/Homebrew/homebrew-dupes/master/gdb.rb
Some new users may find themselves in the same situation given the Mac OS X v10.9 (Mavericks) upgrade.
Solution
Install the development tools and Xcode
Then install Homebrew
Then do:
brew install homebrew/dupes/gdb
You will notice that some applications will not allow you to use the newly added GDB.
This is because it is not signed by Apple any more.
To side step this issue: Follow this; thanks to #andre
I've had some people hit me up on IRC for more detailed instructions for this. I made a post on my site. You can find it here.
This does not directly answer the given question, but if you're like me, what you really want is a simple way to run (something very much like) gdb.
Apple now uses Clang as its compiler, and it turns out that the clang debugger, lldb, is installed along with the other command-line tools. It appears that lldb is designed with a user interface that mimics gdb very closely.
So, the answer to your question may in fact be:
just use lldb!

How to downgrade JRE/JDK on Mac OSX?

Does anyone know how to downgrade the version for JRE/JDK from 1.6.0_24 to 1.6.0_18 on a Mac OSX thru Terminal? I need to downgrade in order to get a Java applet working in Firefox. Any help would be much appreciated.
That does not seem to be accurate any more.
I just managed to downgrade both JRE and compiler from Java 8 to 7 by looking into /Library/Java/JavaVirtualMachines, and moving away the directory with the highest version number, e.g.
sudo mv jdk1.8.0.jdk ~/Desktop/
That's easy. You have to remove de .jdk directory of the JDK 7 in /Library/Java/JavaVirtualMachines.
Now you only have to install the version you like.
=)
More info:
http://docs.oracle.com/javase/7/docs/webnotes/install/mac/mac-jdk.html#uninstall
If the older JDK isn't on your machine, you'd need to use the GUI and download the Java updater. The one closest to yours I could find was for Java 1.6.0_15 for Mac OS 10.5 (you didn't mention which Mac OS X version you were running):
Java for Mac OS X 10.5 Update 5
I didn't see any for Mac OS X 10.6. For that, you would probably have to download the updaters for each 10.6 release, and extract the JDK installer from the updater (using something like Pacifist
Oh, and if you haven't already, try running /Applications/Utilities/Java Preferences.app, which lets you change the default Java on your machine amongst the ones you have installed.
Hope this helps...
I removed the JavaAppletPlugin:
/Library/Internet Plug-Ins/JavaAppletPlugin.plugin
and all 1.8 JDKs:
/Library/Java/JavaVirtualMachines/jdk1.8.0_45.jdk
/Library/Java/JavaVirtualMachines/jdk1.8.0_60.jdk
Then I was able to re-install 1.7.
To downgrade your JDK you will need the JDK installation package and an app called Pacifist, available from http://www.charlessoft.com/ . The usage is pretty straight forward. I have used it to downgrade my JDK before.
Which version of firefox are you running?
I believe you can have more than one version of jdk/jre on a machine as long as you specify the path when compiling/running. However, the jvm is bundled with mac which makes this problematic.
This post may be helpful
How to install a specific JDK on Mac OS X?
These days MAC OS comes with latest java version(8 or later).
Even if you install the old versions, it points to the Newest version. All it need is just pointing to the old version. To downgrade to any version that is preinstalled is to create a symlink of that version.
Follow these simple steps to downgrade your java version.
(1) cd /System/Library/Frameworks/JavaVM.framework/Versions
(2) sudo bash
(3) rm Current
(4) ln -s 1.6.0/Contents/ Current
(5) java -version
This will point the java to last update in java6. And now update all the paths.
Hope it might be helpful and let me know if it works...:)
There is no downgrade mechanism for what you want to do.
The typical suggestion is to roll back to the version you want either through Time Machine or by reinstalling and only update selectively to the version you need by downloading explicitly from Apple and not updating Java through software update.
I'd recommend you look into the problem instead. If you cannot run this in Firefox, then try with Chrome or Safari. If it is the mixed code issue, then this is changed in the Java Settings panel in Programs -> Utilities in the Advanced panel.
I've had the very same problem. You can open the JRE 1.6.0_20 image file with Pacifist software and extract all the folders with the framework into the \System\Library\Frameworks\JavaVM.framework\Versions folders. After that the JRE should appear in your Applications/Utilities/Java Preferences JRE selection menu, where you can switch between the running JRE's.

How do I use JDK 7 on Mac OSX?

I would like to use the WatchService API as mentioned in this link:
http://download.oracle.com/javase/tutorial/essential/io/notification.html
After reading around, I found out that WatchService is part of the NIO class which is scheduled for JDK 7. So, it is in beta form. It's fine.
http://jdk7.java.net/download.html has the JDK which I downloaded and extracted. I got a bunch of folders. I don't know what to do with them.
Then, I read around some more and found that some nice group of people created JDK 7 as a binary so someone like me can install it easily. It is called Open JDK:
http://code.google.com/p/openjdk-osx-build/
So, I downloaded the .dmg file and install it. Then I open "Java Preference" and see that OpenJDK7 is available.
So, now I feel that I can start trying out WatchService API. From the tutorial in the first link, the author gave a .java file to test it out first and make sure that it is running. Here is the link to the file:
http://download.oracle.com/javase/tutorial/essential/io/examples/WatchDir.java
So, I boot up Eclipse (actually I use STS) and create a new Java project and choose JaveSE-1.7 in the "use an execution environment JRE:". Under the src folder, I copy pasted the WatchDir.java file.
And I still see tons of squiggly red lines. All the "import.java.nio.*" are all red and I cannot run it as a Java app.
What do I need to do?
This is how I got 1.7 to work with Eclipse. I hope it helps.
I Downloaded the latest OpenJDK 1.7 universal (32/64 bits) JDK
from Mac OS/X branch from http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html
copied the jdk to /Library/Java/JavaVirtualMachines/ next to the
default 1.6.0 one
In Eclipse > Preferences > Java > Installed JREs you add a new one, of type MacOS X VM, and set the home as /Library/Java/JavaVirtualMachines/1.7.0.jdk/Contents/Home and
name Java SE 7 (OpenJDK)
Click Finish
Set the added JRE as default
that should be it :)
Oracle has released JDK 7 for OS X.
Java 9, 10, 11
Years ago, Apple joined the OpenJDK project, transferring their formerly proprietary macOS-specific JVM code as free-of-cost open-source. Apple ceased distribution of their own branded JVM/JDK, relying on Oracle’s branded releases to include a version for macOS.
Oracle has recently announced their intention to bring their Oracle-branded JVM release to feature parity with the OpenJDK project, with virtually the same code base. The company even donated their previously commercial tools, Flight Recorder & Mission Control, to the OpenJDK project. This is part of the shift to a new rapid “release train” plan for predictably scheduled versioning of Java and OpenJDK. Notably, the periods for free-of-cost public updates is now shortened. See this 2017-09 announcement and this posting by Mark Reinhold.
As a result of all this, macOS users of Java have a choice of vendors for a Java implementation. At this point, at least three sources are based on OpenJDK for macOS:
Oracle releases of the JDK and JRE, with optional paid support.
Azul Systems releasing:
Zulu line of free-of-cost JVMs with optional paid support.
Zing line of commercial JVMs with special features such as an alternate garbage-collector.
OpenJDK source code, roll-your-own compilation & installation (perhaps not practical for most of us).
Meanwhile, IBM donated code for a JVM to the Eclipse Foundation, now housed in the OpenJ9 project. I wonder if they might support a macOS release as well, though it is too soon to tell.
Personally, I am currently using the Zulu release of Java 10.0.1 from Azul on macOS High Sierra successfully with IntelliJ 2018.2 to produce Java-backed web apps with Vaadin.
Installation/Removal
Both Oracle and Azul provide utterly easy-to-use installers to install the JVM/JDK on your Mac. Verify your installation by using the Terminal.app (or equivalent) to type and run:
java -version
You will find the Java installations in this folder at the root level of your drive (not in your home folder):
/Library/Java/JavaVirtualMachines
Each version from each vendor is found there, in a labeled nested folder. You can delete any installation simply by deleting the nested folder for that version and providing your system password when prompted.
Java 8
You can download the Java Development Kit (JDK) for Java 8 for the supported versions of Mac OS X:
Mountain Lion (10.8.3+)
Mavericks (10.9)
Yosemite (10.10)
El Capitan (10.11)
Each version of JVM you install can be found here:
/Library/Java/JavaVirtualMachines
For more instructions and FAQ, see this Oracle Guide.
Java 7
For every release of Java 7 since Update 4, a Mac version has been ready alongside the other platforms. Runs on Macs with 64-bit hardware on Lion (10.7.3+), Mountain Lion (10.8.3+), and Mavericks (10.9.x).
Oracle announced the official release of the JDK for Java SE 7 Update 4 on Mac OS X (Lion), as of 2012-04-26. No more need for the tricks discussed on this page.
Installation is simple per these instructions:
Download from the usual place on the Oracle web site.
Mount the DMG.
Run the installer.
This release has a few limitations, most notably the lack of support for Java Web Start and the Java Plugin for web browsers. That support is expected later this year.
After installing, read the JDK for Mac ReadMe. Most importantly, if you want Java 7 to be the default, drag it to the top of the list in the Java Preferences app found in your Utilities folder.
Mac OS X easily supports multiple JVMs simultaneously. Each is now found here:
/Library/Java/JavaVirtualMachines
Congratulations to the Apple & Oracle teams for their achievement. This geek gets a thrill seeing Mac OS X listed as a "Certified System Configuration".
Tip: To start Eclipse on a Mac with only Java 7 installed, open the alias file named eclipse rather than the file named Eclipse.app.
Java 6
Apple continues to supply an up-to-date implementation of Java 6 for all versions of Mac OS X up through Mountain Lion.
If you do something that requires Java, such as type "java -version" in Terminal.app, a dialog appears offering to install Java for you. If you accept, installation happens automatically similar to other "Software Updates" from Apple.
You will find Java installed in this location, different than Java 7 & 8:
/System/Library/Java/JavaVirtualMachines
Java 6 has reached end-of-life with Oracle as of 2013-02 (unless you have a commercial support agreement with Oracle). So you should be moving to Java 7 or 8.
Testing New Version
In Terminal.app, type java -version to verify which version is the current default.
Deleting Old Versions
After installing a fresh version, you may want to visit the folder described above to delete old versions. Move the folder to the Trash, and provide your System password complete the move.
By the way, Apple provides a mailing list for developers’ technical issues related to Java on OS X.
An easy way to install Java 7 on a Mac is by using Homebrew, thanks to the Homebrew Cask plugin (which is now installed by default).
Run this command to install Java 7:
brew cask install caskroom/versions/java7
Get cask
brew tap caskroom/cask
Install java7:
brew tap caskroom/versions
brew cask install java7
(I had difficulty finding the download link of java7 on oracle website, as they're just "recommending" java8 )
EDIT January 2018 (As pointed by Ankur):
Use zulu7 cask. Zulu is a certified build of OpenJDK produced by Azul Systems that should be around for a long time (they even offer JDK6 builds still).
brew cask install caskroom/versions/zulu7
I know that some may want to smack me for re-opening old post, but if you feel so do it I just hope this may help someone else trying to set JDK 7 on Mac OS (using IntelliJ).
What I did to get this working on my machine is to:
followed instructions on Oracle JDK7 Mac OS X Port for general installation
in IntelliJ open/create new project so you can add new SDK (File > Project Structure)
select Platform Settings > SDKs, press "+" (plus) sign to add new SDK
select JSDK and navigate to /Library/Java/JavaVirtualMachines/JDK 1.7.0 Developer Preview.jdk/Contents/Home. Do not get it mistaken with /Users/YOUR_USERNAME/Library/Java/. This will link 4 JARs from "lib" directory (dt.jar, jconsole.jar, sa-jdi.jar and tools.jar)
you will need also add JARs from /Library/Java/JavaVirtualMachines/JDK 1.7.0 Developer Preview.jdk/Contents/Home/jre/lib (charsets.jar, jce.jar, JObjC.jar, jsse.jar, management-agent.jar, resources.jar and rt.jar)
after installing the 1.7jdk from oracle, i changed my bash scripts to add:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_13.jdk/Contents/Home
and then running java -version showed the right version.
It's possible that you still need to add the JDK into Eclipse (STS). Just because the JDK is on the system doesn't mean Eclipse knows where to find it.
Go to
Preferences > Java > Installed JREs
If there is not an entry for the 1.7 JDK, add it. You'll have to point Eclipse to where you installed your 1.7 JDK.
If Eclipse can't find a JRE that is 1.7 compatible, I'm guessing that it just uses your default JRE, and that's probably still pointing at Java 1.6, which would be causing your red squiggly lines.
I needed to adapt #abe312's answer since there has been some changes with brew lately.
I installed zulu7 and setup JAVA_HOME by running:
brew install --cask homebrew/cask-versions/zulu7
echo "export JAVA_HOME=/Library/Java/JavaVirtualMachines/zulu-7.jdk/Contents/Home" >> ~/.zshrc
I had to enter my password for installing zulu7. You may need to modify the last command if you are using a different shell.
How about Netbeans, here is an article how to set it up with NB7:
http://netbeanside61.blogspot.com/2011/06/downloading-openjdk7-binary-for-mac-os.html
Maybe similar steps for Eclipse.
As of April 27th there is an offical Oracle release of Java SE 7u4. Download the disk image and run the installer - then see the Mac readme.
As of December 2017, previously posted links don't work, but JDK 7 can still be downloaded from Oracle Archives (login required):
http://www.oracle.com/technetwork/java/javase/downloads/java-archive-downloads-javase7-521261.html
The instructions by peter_budo worked perfectly. I had to add the jars under /Library/Java/JavaVirtualMachines/JDK 1.7.0 Developer Preview.jdk/Contents/Home/jre/lib/ to my IntelliJ project libraries. Now it works like a charm. Note that I didn't need my IDE itself to run under 1.7; rather, I only needed to be able to compile and run against 1.7. I'll most likely continue to use Apple's JRE for running the IDE since it's probably more stable with respect to graphics routines (Swing, AWT). Like the OP, I was really keen on testing out the new NIO2 API. Looking good so far. Thanks, Peter.
What worked for me on Lion was installing the JDK7_u17 from Oracle, then editing ~/.bash_profile to include:
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_13.jdk/Contents/Home
Now, Use command
Update 2020: 04
To install Java7 with homebrew run:
brew tap homebrew/cask-versions
brew cask install java7
Hope this help.
I updated to Yosemite and Android Studio wouldn't clean my projects or Run them on virtual or real device because of the following error:
Failed to complete Gradle execution.Cause:Supplied javaHome is not a valid folder. You supplied: /System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home
After some research and trouble shooting, I found that the JDK file that was being pointed to at "/System/Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home" wasn't there; all of "JavaVirtualMachines/1.6.0.jdk/Contents/Home" was missing from "/System/Library/Java". So, I copied "JavaVirtualMachines/1.6.0.jdk/Contents/Home" over from "/Library/Java/" to "/System/Library/Java/" and cha ching! I was back in business.

Resources