diff --git a/java/src/processing/mode/java/runner/Runner.java b/java/src/processing/mode/java/runner/Runner.java index 871020e72..9d1dad83d 100644 --- a/java/src/processing/mode/java/runner/Runner.java +++ b/java/src/processing/mode/java/runner/Runner.java @@ -34,6 +34,8 @@ import java.awt.GraphicsEnvironment; import java.awt.Point; import java.io.*; import java.net.ConnectException; +import java.net.InetAddress; +import java.net.UnknownHostException; import java.util.*; import com.sun.jdi.*; @@ -82,6 +84,8 @@ public class Runner implements MessageConsumer { // this.sketch = sketch; this.build = build; + checkLocalHost(); + if (listener instanceof Editor) { this.editor = (Editor) listener; sketchErr = editor.getConsole().getErr(); @@ -116,6 +120,29 @@ public class Runner implements MessageConsumer { } + /** + * Has the user screwed up their hosts file? + * https://github.com/processing/processing/issues/4738 + */ + private void checkLocalHost() throws SketchException { + try { + InetAddress address = InetAddress.getByName("localhost"); + if (!address.getHostAddress().equals("127.0.0.1")) { + System.err.println("Your computer is not properly mapping 'localhost' to '127.0.0.1',"); + System.err.println("which prevents sketches from working properly because 'localhost'"); + System.err.println("is needed to connect the PDE to your sketch while it's running."); + System.err.println("If you don't recall making this change, or know how to fix it:"); + System.err.println("https://www.google.com/search?q=add+localhost+to+hosts+file+" + Platform.getName()); + throw new SketchException("Cannot run due to changes in your 'hosts' file. " + + "See the console for details.", false); + } + + } catch (UnknownHostException e) { + e.printStackTrace(); + } + } + + public VirtualMachine launch(String[] args) { if (launchVirtualMachine(false, args)) { generateTrace(); diff --git a/todo.txt b/todo.txt index 7a770241c..931fde440 100755 --- a/todo.txt +++ b/todo.txt @@ -1,6 +1,12 @@ 0256 (3.2.4 or 3.3) X only require reference.zip (and internet connection) when building dist X set text style properly for Contribution Manager error message +X Detect changes to 'hosts' file in case users modify/remove localhost +_ No sketch window opens after hitting Run if hosts file changed +_ https://github.com/processing/processing/issues/4738 +_ https://github.com/processing/processing/issues/4735 +X https://github.com/processing/processing/issues/1868 +X https://github.com/processing/processing/issues/3123 _ Export Application fails on machines w/ non-ASCII chars in user name @@ -20,10 +26,6 @@ _ https://github.com/processing/processing/commits/master/build/macosx/appbund _ https://github.com/processing/processing/commit/fa27b983e76fdbc5c4c1451a1f0d854c652b1639 _ https://bitbucket.org/infinitekind/appbundler -_ Drew's freeze on startup -_ No PDE window opens when started on MacOS X 10.11 -_ https://github.com/processing/processing/issues/4735 - _ settings() present and pixelDensity() is in setup(), nothing set/no error _ https://github.com/processing/processing/issues/4703