System() equilivent in java

Started by
8 comments, last by Fibonacci One 20 years ago
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.
Advertisement
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
The ability to succeed is the ability to adapt
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.
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
The idea was that you could only ignore them if you do something to make sure the computer knows that it is completly local, thus people couldn''t write "format c:" apps.
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."
The smarter thing to do is to write an asynchronous pluggable protocol for Internet Explorer, so you can execute the function from the Run... dialog, the location bar of an Internet/Windows Explorer window, or a hyperlink.
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?
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...
Get new friends.

This topic is closed to new replies.

Advertisement