Menu

Calling other programs

From the beginning back in 2004 the Class Viewer application has called the browser as that was intrinsic to what I wanted early, as back then was tired of going through JavaDocs manually. And today yeah plenty of Java development environments make it easy to get them, but my way is still just as useful. So yeah Class Viewer lets you quickly get to JavaDocs but later I wanted same thing for getting into Java programs. And found was easy. The code for calling the browser is:

Runtime r = Runtime.getRuntime();

                tempStr = locManager.getLocalBrowser()+" ";
                tempStr+=runString;
                r.exec(tempStr);

Which of course is in a try and catch block. And since calling standalone programs which can handle their own process just calls and throws away, which is why so simple. A similar call handles the text editor.

And looking through, found I was even too succinct for my tastes so I think will add more comments around later, but here is what runs the text editor with the tempStr having been built before:

Runtime r = Runtime.getRuntime();

                r.exec(tempStr);

And I found the first by opening the method from ClassViewer, so yeah I used the application to help me write this post. And is a nice quick way to get into a Java file that is local, if you wish to go into a method and know which one as is really quick.

Posted by James Harris 2016-06-01 Labels: code

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.