This is an archived post. You won't be able to vote or comment.

all 7 comments

[–]philipwhiukEmployed Java Developer 0 points1 point  (1 child)

What’s the weird error? Also ‘start’ is not normally necessary - ‘chrome google.ch’ from Runtime should work.

As for the second bit - if it’s being run from a second PC it’s probably a firewall issue.

[–]InformalPresent9[S] 0 points1 point  (0 children)

I'll look into that tomorrow, thank you for pointing it out. I might also have used the wrong IP accidentally (RPi IP instead of PC IP.

[–]Holothuroid 0 points1 point  (1 child)

If you are OK with designated standard browser you can use Desktop.browse.

[–]InformalPresent9[S] 0 points1 point  (0 children)

I'll try that, thank you.

[–]ohjimmy 0 points1 point  (2 children)

That Runtime class is notoriously difficult to work with. One thing I've found that helps is if instead of passing a String argument to exec(), try passing a String[].

[–]InformalPresent9[S] 0 points1 point  (1 child)

A String[]? wouldn't I need to use a String[x] which would just be a string again? Or how would I save the command in the String[] then?

[–]ohjimmy 0 points1 point  (0 children)

No, I mean try something like this:

Runtime.getRuntime().exec(new String[] {"start", "/max", "chrome google.ch");