Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can not launch ScenicView from within a path containing spaces #50

Open
afester opened this issue Jul 3, 2019 · 1 comment
Open

Can not launch ScenicView from within a path containing spaces #50

afester opened this issue Jul 3, 2019 · 1 comment

Comments

@afester
Copy link
Contributor

afester commented Jul 3, 2019

When installing ScenicView into a directory containing spaces, an URISyntaxException is thrown when launching it:

C:\Program Files\scenicview\bin> scenicView
Platform running
Launching ScenicView v11.0.2
Startup done
Creating server
Server done
Number of running Java applications found: 3
Obtaining properties for Java application with PID:24360
Obtaining properties for Java application with PID:16876
0 JavaFX applications found
java.net.URISyntaxException: Illegal character in path at index 16: file:/C:/Program
Files/scenicview/lib/scenicview.jar
        at java.base/java.net.URI$Parser.fail(Unknown Source)
        at java.base/java.net.URI$Parser.checkChars(Unknown Source)
        at java.base/java.net.URI$Parser.parseHierarchical(Unknown Source)
        at java.base/java.net.URI$Parser.parse(Unknown Source)
        at java.base/java.net.URI.<init>(Unknown Source)
        at java.base/java.net.URL.toURI(Unknown Source)
        at org.scenicview.scenicview/org.fxconnector.remote.RemoteConnectorImpl.findAgent(Unknown Source)
        at org.scenicview.scenicview/org.fxconnector.remote.RemoteConnectorImpl.connect(Unknown Source)
        at org.scenicview.scenicview/org.scenicview.model.update.RemoteVMsUpdateStrategy.getActiveApps(Unknown Source)
        at org.scenicview.scenicview/org.scenicview.model.update.RemoteVMsUpdateStrategy.work(Unknown Source)
        at org.scenicview.scenicview/org.fxconnector.helper.WorkerThread.run(Unknown Source)
Error: Unable to find agent jar file. Exiting Scenic View.

System information from ScenicView help:

Scenic View developed by Amy Fowler, Ander Ruiz and Jonathan Giles

JavaFX Build Information:
    Java FX 11.0.2+1

Required Libraries:
    tools.jar Home: Included in runtime classpath

Operating System:
    Windows 10, amd64, 10.0

Java Version:
    11.0.1, Oracle Corporation, 11.0.1+13

OS version: Windows 10 Version 1803
JDK: openjdk version "11.0.1" 2018-10-16 (supplied with the scenicView download)
Workaround: Move the installation into a directory without spaces

@afester
Copy link
Contributor Author

afester commented Jul 4, 2019

Not sure if I missed something, but is there any reason why the path to scenicview.jar is created as file:// URL, then parsed into a URL and converted back to an URI in RemoteConnectorImpl.findAgent() (in the "jrt" case)? The following patch fixes the URISyntaxException by simply passing the path directly to the File(String) constructor which allows spaces in the path without any further encoding:

diff --git a/src/main/java/org/fxconnector/remote/RemoteConnectorImpl.java b/src/main/java/org/fxconnector/remote/RemoteConnectorImpl.java
index 9440678..6ae8ba0 100644
--- a/src/main/java/org/fxconnector/remote/RemoteConnectorImpl.java
+++ b/src/main/java/org/fxconnector/remote/RemoteConnectorImpl.java
@@ -429,7 +429,7 @@ class RemoteConnectorImpl extends UnicastRemoteObject implements RemoteConnector
                 /**
                  * Find jar distributed in custom image
                  */
-                tempf = new File(new URL("file:///" + System.getProperty("java.home") + "/lib/scenicview.jar").toURI());
+                tempf = new File(System.getProperty("java.home") + "/lib/scenicview.jar");
             }
         } catch (MalformedURLException | URISyntaxException e) {
             ExceptionLogger.submitException(e, "Attempting to get agent jar.");

afester added a commit to afester/scenic-view that referenced this issue Jul 8, 2019
JonathanGiles added a commit that referenced this issue Jan 5, 2021
Issue #50: Allow to launch ScenicView from within a path containing spaces
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant