Win a copy of Cross-Platform Desktop Applications: Using Node, Electron, and NW.js this week in the JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to perform actionListener with Runtime class?  RSS feed

 
vinoth vino
Ranch Hand
Posts: 67
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I've coded with MenuItem to open Notepad,Skype with Runtime Class but it throws an exception to me.I tried "throws Exception with main function"but i didn't get proper output.How to handle this? please anyone help me


Thanks in advance
 
ab singh
Greenhorn
Posts: 20
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
first check for application which you want run are installed and you need to write Runtime.getRuntime().exec(); method in try catch block rather than whole actionperformed block in try catch block
e.g.


i have modified the code it worked for me


use dialogue to get error report
 
ab singh
Greenhorn
Posts: 20
  • Likes 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
also you have used actionlistener interface whose method have been not implemented so either implement actionlistener unimlemented method and add action on the selection of sub menu
else exclude the action listener as i have done in given code also use try and catch block for each runtime.getruntime() method else ue can make this class abstract and call the method in inheriting class to handle the action.
 
vinoth vino
Ranch Hand
Posts: 67
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ab singh wrote:first check for application which you want run are installed . . .
use dialogue to get error report


Thnqqqqqqqqq so much... It works fyn
 
vinoth vino
Ranch Hand
Posts: 67
Eclipse IDE Java Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Campbell Ritchie wrote:Please don't quote the whole of the preceding post (which I have mostly removed). There is no need to read that sort of thing twice.
Avoid fyn and Thqqqqqq; please read this.

Okay,Hereafter i won't write like that
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!