arduino / Arduino

Arduino IDE 1.x
https://www.arduino.cc/en/software
Other
14.17k stars 7.02k forks source link

Mac OS X 10.9 Java 1.7 only #1665

Closed dbsqp closed 10 years ago

dbsqp commented 11 years ago

Current Mac version of the IDE only work with Java 6 runtime from Apple. On a clean install with only Oracle 1.7 SDK installed IDE does not run and prompts to install Java 6 from Apple.

I think the issue does not relate to the core but to the way the application is bundled for Mac OS as Arduino.app. This uses the documented procedure from Apple and is only applicable to their install of Java 1.6.

See here for more info: http://stackoverflow.com/questions/14806709/application-is-using-java-6-from-apple-instead-of-java-7-from-oracle-on-mac-os-x

ffissore commented 11 years ago

Are you using version 1.0.x ? If so, can you try latest 1.5.x?

dbsqp commented 11 years ago

Am using 1.0.5 but same issue with 1.5.4. Rebuilding from source didn't help using but is clear from build.xml that this is the older way of making app bundles as compared to what oracle recommend for 1.7 i.e. using appbundler-1.0.jar

http://docs.oracle.com/javase/7/docs/technotes/guides/jweb/packagingAppsForMac.html

okrause commented 10 years ago

Just tested with 1.5.5. Still asks to download Java6. Still no Arduino GUI for me :(

ericontech commented 10 years ago

I had the same issue on a clean OS X 10.9 machine. Had to pollute it with Java 6 to get the IDE to run. http://support.apple.com/kb/DL1572

haavar commented 10 years ago

After working trough some issues, I finally have a build of the IDE that works with java 7. You do not need java 6 installed to run this, but you do need java 7 from oracle. I did not bundle the JRE with the app.

Here is what I did: 1) Change the build to use appbundler-1.0.jar from oracle to create the app 2) Invoking Toolkit.getDefaultToolkit() in the Platform constructor because of the issue: http://mail.openjdk.java.net/pipermail/macosx-port-dev/2013-January/005261.html. 3) Replaced RXTXcomm with nrjavaserial. RXTXcomm did not run in 64 bit mode, and the JRE would not run in 32.

I'm not sure what the process for integrating changes back into this project, but I'd delighted if my changes made it back into the project. Does anyone know how to make that happen?

You can download the binaries that I created here (updated to the 1.5 branch): [deleted see post below for updated link]

I've tested on OS X 10.9.1, with java 1.7.0_45 and an Arduino Uno.

dbsqp commented 10 years ago

Hi, your binary also works for me on OS X 10.9.1 with an Uno. Great work and thanks for all your help. Unfortunately I have no idea how to integrate this back into the main project.

haavar commented 10 years ago

That's great. I did some work with the IDE yesterday, and I noticed that the IDE was taking 300%+ CPU. I've not been diving deep into what's causing that, but I'm guessing it has to do with the serial lib that I used. It would also be more reasonable to include these changes in a 1.5.x release.

I made a new build of the 1.5.x branch. That uses a different serial lib, and initial tests looks good. If anyone wants it, it's here: https://citrix.sharefile.com/d/sec90014164743969

choepie commented 10 years ago

Great work ! Thank you very much for this. Can you tell me what serial lib you used ? I'm trying to get this one up and running for some time now without success : http://www.cheap-thermocam.net/download-section-v1/ I'm afraid the rxtxcomm is a reason.

haavar commented 10 years ago

Thanks. I didn't change the serial lib for the 1.5.x branch. All I did was to use the appbundler to create the application instead of the template app. I also added the Toolkit.getDefaultToolkit() hack.

I made some changes to the appbundler project to support file associations. I've published those changes to an appbundler jira taks, but the project seems pretty dead, and I'm not sure if they are gong to pick it up. I didn't want to make a pull request to the arduino project until the changes were in for the appbundler.

I did see that someone branched the appbundler project. That might be something to look at if the main project is dead.

ffissore commented 10 years ago

@haavar does the bundled Arduino IDE work well even if file associations are not supported? If so, I would love to see a PR from you. Also mind that we don't have particular problems in forking and patching it accordingly or (better) in using a fork of it: for example, take a look at this https://bitbucket.org/infinitekind/appbundler , it looks active

haavar commented 10 years ago

It works well, but there is some regression in functionality.

Yes, that's the project I was looking at earlier. I think they have all features required. Another option would be to keep the application template technique that's already there, but I thought that was a bit messy.

When I get a chance, I'll make a PR with the alternative appbundler task.

Knitter commented 10 years ago

@haavar can you publish the instructions on how to make a build with the appbundler? Or when can we see this change in the nightly builds?

I tried starting Arduino manually using the java command but I may be missing something on either the required libs (and classpath) or the required properties (is javaroot used for anything?) as Arduino's icon shows but the main class just hangs without ever showing any UI, I have to kill the process to stop it.

I'm currently unable to use the Arduino IDE on OSX as I can't get it to start, I suspect this will cause issues to any other user that doesn't want an older JRE on their machine.

haavar commented 10 years ago

Sorry, I've not been able to put this together in a pull request. I don't see any time in my near future where I'll be able to do this. I'll share my patch, if someone can put together a pull request.

There are 3 parts to my change. 1) Updating the build.xml file to use appbundler 2) Adding a call to Toolkit.getDefaultToolkit() because of this issue: http://mail.openjdk.java.net/pipermail/macosx-port-dev/2013-January/005261.html 3) Making a change to the appbundler to allow file associations and allow versions to be set. The link below contains an appbunlder jar that has those changes. The patch can be found here: https://java.net/jira/browse/APPBUNDLER-1. The patch for setting the version is here: https://java.net/jira/browse/APPBUNDLER-24

You can download the patched appbunlder and the code changes to the IDE here: https://citrix.sharefile.com/d/scc82fd895c24ac69

I tried using this project: https://bitbucket.org/infinitekind/appbundler, but I was not able to get the app running.

Knitter commented 10 years ago

Thanks for the details.

I've made a first attempt at applying the patch and making my own build and though I can build the project and make an application bundle, the IDE doesn't show any UI, it does seem to start (the process is running and there usual Arduino icon shows) but doesn't show any window. I'll retry again later this week.

haavar commented 10 years ago

That's what happened to me before I figured out that I had to add the Toolkit.getDefaultToolkit() call. Did you add that? Did you try doing a thread dump? Did you try starting the app by calling java on the command line?

Knitter commented 10 years ago

I did add add that line, I applied the path (it lacks the import for the Toolkit class though) and the line is part of the constructor. I did not try to make a thread dump, will try that.

I tried starting in command line, it throws an exception as it doesn't find some packages (probably a classpath issue) but I did not continue to test. If I use either the open command or double click the bundle I can access the settings screen (using the app menu), but no main IDE window shows.

Also, I placed the appbuldler from the link you posted in the expected folder but it complains that it doesn't support the "documentType" element. I had to comment that from the build.xml file to allow it to build.

I'll try to build the IDE again today/tomorrow, thanks for the help.

haavar commented 10 years ago

That's strange. Maybe there have some more resent changes that broke this.

I might have given you an appbundler jar that does not have my changes. Just comment out the document association element for now.

I've not seen the one where you can see the settings screen. When I tried starting the app without the toolkit hack, nothing would show up.

This is how I ran the app from the command line (current dir is the application bundle): haavar:Arduino.app haavar$ export CLASSPATH=find . -name *.jar | while read l; do echo -n "$l:"; done; haavar:Arduino.app haavar$ java -Djavaroot=pwd/Contents/Java processing.app.Base

The output when I ran it like that was usually helpful when I was debugging.

cmaglie commented 10 years ago

@haavar I've just made a pull request with all your patches. It seems to work great, may you or anyone else check this out?

https://github.com/arduino/Arduino/pull/2102

haavar commented 10 years ago

Thanks for doing that. The change looks good to me. There are probably some cleanup that can happen in the template app. The ant task is doing the creation of the .app structure, and we don't really need a template any more. However we are probably still using a few files from the template, and they should be moved elsewhere.

On Thu, May 29, 2014 at 3:37 AM, Cristian Maglie notifications@github.com wrote:

@haavar https://github.com/haavar I've just made a pull request with all your patches. It seems to work great, may you or anyone else check this out?

2102 https://github.com/arduino/Arduino/pull/2102

— Reply to this email directly or view it on GitHub https://github.com/arduino/Arduino/issues/1665#issuecomment-44519408.

Lauszus commented 10 years ago

I just tried is as well, but looks like all shadows are missing. Please see the screenshot below: screenshot

The left is Arduino 1.5.6-r2 while the right is the one build using appbundler.

Am I the only one having this issue?

Also you should properly add "appbundler-1.0-arduino.jar" to .gitignore

cmaglie commented 10 years ago

Added appbundler in .gitignore

I can confirm that the shadows are dimmed, they are still there but they are not so strong. I've no idea on how to solve this, any suggestion welcome.

Personally I'm fine with this new "style", so I'm going to merge this change upstream anyway (and fix the style later when we figure out how).

damellis commented 10 years ago

Guys, the font / text on this new app bundler / Java 7 IDE look terrible, at least to my eyes (I think I get about the same as the screenshot that Lauszus posted). I think this is bad enough that it's worth switching back to Apple's Java 6 instead (which, anyway, is what you get prompted to install when you try to run a Java application on newer version of Mac OS X).

Knitter commented 10 years ago

As one affected by this I prefer the patch, and its associated font issues instead of reverting to Java 6. If I'm faced with choosing between not having the IDE (I don't and won't install Java 6) or having some font issues, I prefer the font issues anytime :)

dbsqp commented 10 years ago

Would just like to say thank you to everyone who worked on this.

xaljox commented 10 years ago

With the eclipse arduine plugin which is also java based and now uses Java 7 or above, the small font issue on the mac can be solved by removing the line: -Dorg.eclipse.swt.internal.carbon.smallFonts from some sort of ini file on how to run java. the rest of the file content is: -startup ../../../plugins/org.eclipse.equinox.launcher_1.3.0.v20140415-2008.jar --launcher.library ../../../plugins/org.eclipse.equinox.launcher.cocoa.macosx.x86_64_1.1.200.v20140603-1326 -perspective it.baeyens.arduino.application.perspective --launcher.defaultAction openFile --launcher.XXMaxPermSize 256M --launcher.appendVmargs -vmargs -Dosgi.requiredJavaVersion=1.7 -Xms40m -Xmx512m -XstartOnFirstThread

I'm no Java expert, but is seems that the size of the font in Java can be controlled in some manner.

On 03 Jul 2014, at 00:03, David A. Mellis notifications@github.com wrote:

Guys, the font / text on this new app bundler / Java 7 IDE look terrible, at least to my eyes (I think I get about the same as the screenshot that Lauszus posted). I think this is bad enough that it's worth switching back to Apple's Java 6 instead (which, anyway, is what you get prompted to install when you try to run a Java application on newer version of Mac OS X).

— Reply to this email directly or view it on GitHub.

cmaglie commented 10 years ago

It seems that this is a bug in JRE 7:

http://bbs.archbang.org/viewtopic.php?id=2468

cmaglie commented 10 years ago

Err... sorry, posted the wrong link:

https://bugs.openjdk.java.net/browse/JDK-8023794 https://netbeans.org/bugzilla/show_bug.cgi?id=216655

Does anyone knows a workaround for this?

damellis commented 10 years ago

Another consideration is compatibility with older versions of Mac OS X. According to the statistics* I can find, it seems that 20 percent or so of users are on 10.6 or earlier, which won't run Java 7 (I believe).

If there was a compelling need to use Java 7, it might be worth these trade-offs -- but it's not clear to me what that need is, aside from some people not wanting to install Java 6 (for reasons that aren't clear to me). What's the advantage of switching to Java 7?

[*] http://mobilephoneadvise.com/osx-mavericks-already-powering-more-than-50-macs

dbsqp commented 10 years ago

The reasons are clear, Apple will no longer support their build of Java 6. Also to use your argument 80% of people can use Java 7. This number will only increase with time.

With respect to the build of Arduino, if you look into the code it was quite a hack for the Apple Java 6 bundle. Moving to the standard method provides better standards complaint longer support from this community. There is also nothing stopping you installing Apple's or Oracle's version of Java 6.

There is also nothing stopping my riding my horse to work instead of driving I just haven't found the right place to plug in the iPod :-)

cmaglie commented 10 years ago

Sticking to an old technology has its pro and cons.

Pro:

Cons:

Choosing the right time to upgrade is a balance of the above, considering also that delaying a missed update for too long makes the update itself harder and harder (if not impossible). In Arduino we faced similar problems with:

For these reasons I want to upgrade to Java 7 ASAP, but @damellis said a right thing here: 20%, even if low, is still a large amount of users (its 1 out of 5) and we can't suddenly drop support for them.

okrause commented 10 years ago

From my experience all the 10.6 users are non-technical users who use there system for mail and web. Also due to the "upgrade is free" policy of Apple there is no reason not to go with a later release except your hardware is very old. The point I want to make: 20% is already low and I am convinced that the majority of this 20% isn't anyone who will use the Arduino IDE anyway. We talk about a very small number of real users. Please don't push an outdated, not really maintained Java onto the other 80%+ of users. I stopped using the IDE for that reason. I don't want another problem software lurking around, I am already more than busy patching Adobe Flash every week.

Knitter commented 10 years ago

To me it is both a matter of not wanting an old and unsupported version of Java in my system and also a requirement to use newer versions for the development I do, but in the end, I would like the ability to run the IDE on Java 7 and 8 and not to be limited to Java 6.

I don't really care if the IDE runs on Java 6 as long as it also runs on Java 7 properly without forcing me to install a lower version with all the issues of having two very different Java JRE/JDK installed. I could live with Java 6 only if it was trivial to have both versions and all my apps using the latest with only the Arduino IDE using the older version, but it is not.

simonh1000 commented 10 years ago

Just downloaded the built code from the link above and it works with Mavericks + Oracle Java 7, so thanks. Would be great if Arduino would just host this directly on their site (marked as an alternative for those that know they are running Java 7)

Andersos commented 9 years ago

So any updates after @Knitter? Is there an Arduino IDe 1.0.6 version that I can use if I have Java 8? Do I really have to install Java 6 to run this?

cmaglie commented 9 years ago

There is a Java 7 package for IDE 1.5.8 on the download page of arduino.cc site (I guess it works with java 8 too? a report for that may be useful).

There are no plans to package IDE 1.0.6 for Java 7+.

ddm commented 9 years ago

The download page version for Java 7 works with Java 8 too (tested with 1.8.0_25 on OS X 10.10.1). Maybe the download link's text could be changed to "Java 7+" to avoid any confusion.

chenyi1976 commented 9 years ago

I am using Yosemite with Java 7 (1.7.0_72), the Arduino IDEs (Java 6 & Java 7) are not working for me.

_If you have Minecraft.app installed like me, just copy contents/MacOS/JavaApplicationStub from Minecraft.app to Arduino.app contents/MacOS/ folder ( overwrite the existing one) _

Cheers

ffissore commented 9 years ago

Yesterday we pushed a fix for mac. Can you give a spin to the latest nightly build? Il giorno 04/mar/2015 07.44, "chenyi1976" notifications@github.com ha scritto:

I am using Yosemite with Java 7 (1.7.0_72), the Arduino IDEs (Java 6 & Java 7) are not working for me.

_If you have Minecraft.app installed like me, just copy contents/MacOS/JavaApplicationStub from Minecraft.app to Arduino.app contents/MacOS/ folder ( overwrite the existing one) . _

Cheers

— Reply to this email directly or view it on GitHub https://github.com/arduino/Arduino/issues/1665#issuecomment-77105150.

ffissore commented 9 years ago

This is the URL http://arduino.cc/en/Main/Software#nightly

ffissore commented 9 years ago

@ddm fixed with "7+". sorry for having missed your advice