Archived

This topic is now archived and is closed to further replies.

Fibonacci One

System() equilivent in java

Recommended Posts

Fibonacci One    284
A friend of mine came up with a decent idea for a program that he can lock on his active desktop. The idea is to have a text box where he''ll type in what he wants to be his away message and press enter, then it would run the command: aim:goaway?message= (away message here) This command will work in either a browser or the run line. I have two ideas about how to get this to work. The first is to make an applet that will make a call to the java equilivent of the c++ System("command"). Problem with this is: 1) I don''t know any java command that will do that. 2) I don''t know if applets are even allowed to do something like that. My second, and favorite, idea is: normally in html you can make something like (a href="command")(/a) and it will provide a link that when clicked on, will run that command. Problem is I don''t want him to have to click a link. Is there a way I can have it automatically run the command? Kind of like websites that automatically link to you another. Any help for either of those ideas would be appreciated. Thanks in advance.

Share this post


Link to post
Share on other sites
Mr_Ridd    130
If you look in the Runtime class there are methods called exec()

SO what you do is:


Runtime run = Runtime.getRuntime();
run.exec("c:\windows\cmd.exe");


That will run cmd.exe

Share this post


Link to post
Share on other sites
Fibonacci One    284
Sorry to bump this, but I''ve encountered another problem. How do I get an applet to ignore access denied exceptions? I''ve heard there is a way to do this by letting it know it is being run from a local system.

Thanks in advance.

Share this post


Link to post
Share on other sites
Palidine    1315
if you''re running it through a browser, you can''t ignore those warnings. at least i pray to god you can''t, or people will be writing format c:\ applets all over the web. otherwise, um, i don''t really know how else you run applets, but i''m assuming it''s a configuration thing with the program that runs them. but then i don''t really know...never really played around with applets, just striaght up apps & webapp nonsense.

-me

Share this post


Link to post
Share on other sites
yaroslavd    150
Look up WebStart. I''m pretty sure you can sign your applet. Then, the user will see a dialog saying something along the lines of: "The applet wants more access to your computer. This could be dangerous. Accept/Decline/Cancel."

Share this post


Link to post
Share on other sites
AndreTheGiant    329
Look up policy files for java and applets and stuff.

I had to do something similar a few months ago (but now I completely forget how to do it). All I remember is that it turned out to be waaay more complicated than it should be. Thats why I hate using applets or java for anything that it wasn''t meant to do. Java has a lot of built in security-type features, and if you ever need to write a program that tries to get around any of the security, even though its possible, its one hell of a headache.

I recommend looking into Java Web Start. Im not sure what it is exactly, but thats what people recommended to me when I was having trouble with ''regular Java''. Either that, or swithc languages alltogether. Is there a specific reason you''re using java?

Share this post


Link to post
Share on other sites
Fibonacci One    284
Well, I''m writing this for a friend that wants to add this to his active desktop. I''ve never used active desktops so I''m not sure what type of files you are allowed to use. The only thing I do know is that you can use applets.

thus java...

Share this post


Link to post
Share on other sites