Results 1 to 7 of 7

Thread: Java button to open external .exe

  1. #1
    Join Date
    Aug 2005
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Java button to open external .exe

    That would be the code to run external exe file in Java:

    Process p = rt.exec("Program.exe") ;

    But what I want is a button that runs an exe file from your HDD (eg. C:\program_files\Program.exe) or from my ftp.

    I tried these in flash:

    on(release){
    fscommand("exec", "c:\yourdir\yourapp.exe");
    }

    But no luck, any ideas??

    I had theat silly idea... I uploaded Shortcut of the exe file to my ftp, linked it to buttom and it worked, but you have to press run when the security warning pops up. I want to execute it without popup.

  2. #2
    Join Date
    Aug 2004
    Location
    Brighton
    Posts
    1,563
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    "I want to execute it without popup."

    Unfortunately, you wouldn't be able to run an executable on a visitors system without a popup. It'd be silly if you could, think of the security holes!

    cr3
    A retired member, drop me a line through my site if you'd like to find me!
    cr3ative media | read the stickies

  3. #3
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Yup, that's a security feature of applets - you can only do certain things (read/write the user's hard drive, execute code, connect to servers other than the one from which the applet was served...) with the user's permission. The only way to do one of these things without the popup is to get the user to download the JAR archive first, then run it as an application rather than an applet.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  4. #4
    Join Date
    Aug 2005
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Download the JAR archive? Can you explain that a bit more please?

    Anyway I think my first post isn't clear enuff.. What I want to do is run a program that is allready installed on customers computer. For eg. I want that notepad.exe (%SystemRoot%\system32\notepad.exe) runs on computer when ppl press the button. I don't want to execute the exe that isn't allready on customers computer.

  5. #5
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    The same principle applies.
    As for the JAR... the .jar file you upload with your classes in it, with some modification, can be executed by the user with a double-click. All you need to do is define a public static void main(String[]) to your Main-Class as defined in your manifest.
    Last edited by Twey; 08-05-2005 at 05:36 PM.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  6. #6
    Join Date
    Aug 2005
    Posts
    21
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Well that would be like clicking on shortcut, except you would have to download it first, so that wouldnt solve the problem, but tnx for the tip.

    Looks like the "popup" solution is the quickest one.

  7. #7
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    Yup.
    You COULD just say "Open your favourite text editor." And I hope you'll be including support for other operating systems as well.
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •