0

I am unable to launch "javaws -viewer". I am on "Windows10" and when I type the below command in Run window, I get an error message. Please find the screenshot for the same below.

javaws –viewer

javaws viewer

Clicking on Details, I see the following trace. Any help would be appreciated.

java.io.FileNotFoundException: –viewer (The system cannot find the file specified)
    at java.base/java.io.FileInputStream.open0(Native Method)
    at java.base/java.io.FileInputStream.open(Unknown Source)
    at java.base/java.io.FileInputStream.<init>(Unknown Source)
    at java.base/java.io.FileInputStream.<init>(Unknown Source)
    at jdk.javaws@9.0.4/com.sun.javaws.jnl.LaunchDescFactory.buildDescriptor(Unknown Source)
    at jdk.javaws@9.0.4/com.sun.javaws.Main.prepareLaunchDesc(Unknown Source)
    at jdk.plugin@9.0.4/sun.plugin2.main.WebStart.launchApp(Unknown Source)
    at jdk.plugin@9.0.4/sun.plugin2.main.WebStart.continueInSecureThread(Unknown Source)
    at jdk.plugin@9.0.4/sun.plugin2.main.WebStart.access$000(Unknown Source)
    at jdk.plugin@9.0.4/sun.plugin2.main.WebStart$1.run(Unknown Source)
    at java.base/java.lang.Thread.run(Unknown Source)

Additional Details:

  • I have two versions of Java installed on my windows machine (Java8 and Java9). In environment variables, I have set the JAVA_HOME to point to Java8 and the Path is also pointing to "C:\Program Files\Java\jdk1.8.0_162\bin" but somehow I see the Java-9 version in the command prompt result

(Note: Restarted command prompt multiple times after setting the environment variables. Not sure if the original issue is tied up with this one).

>java -version
java version "9.0.4"
Java(TM) SE Runtime Environment (build 9.0.4+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.4+11, mixed mode)
Karthick
  • 13
  • 1
  • 5

1 Answers1

1

The oracle installer puts a directory (C:\ProgramData\Oracle\Java\javapath) with links to the installation in front of the path. Check your path variable and check whether you have multiple java executables on the path with "where java".

DrHopfen
  • 752
  • 3
  • 13
  • Yes in the path variable, I see that it is also pointing to "C:\ProgramData\Oracle\Java\javapath", so I have removed it now from the path variable. So it fixes the second issue which I have reported but the original issue still remains the same. – Karthick Feb 23 '18 at 14:30
  • But the stacktrace changed, I guess? What is the current error message? You could also add -verbose to the command call to get more information. – DrHopfen Feb 23 '18 at 14:34
  • Ok, so I am able to launch the "javaws" successfully now. From the command prompt, if I type "javaws -viewer" it is opening fine. But when tried the same command with Run windows, I get the same error message as earlier. Its not a big problem now but if you know the reason for it then please let me know. Thanks a lot for all the help. – Karthick Feb 23 '18 at 15:54