Help coderanch get a
new server
by contributing to the fundraiser
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Devaka Cooray
  • Liutauras Vilda
Sheriffs:
  • Jeanne Boyarsky
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Tim Moores
  • Carey Brown
  • Mikalai Zaikin
Bartenders:
  • Lou Hamers
  • Piet Souris
  • Frits Walraven

Running exe files with java

 
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I'm having a problem with running exe files with Java. I want to add a program onto a banner with Java that will execute from a hosting website on any computer. The program is 500kb and it is an exe. How would i accomplish this?

PS: i just started with Java a few days ago and i have been searching for an answer for hours now , please help
[ August 08, 2008: Message edited by: Semir xx ]
 
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
To make Java run an external application, you should use the Runtime. Read this JavaWorld article to get a good working start.

I have a feeling, though, that that is not quite what you want to do, so you will have to be a bit more specific.

And just to nitpick:
"running exe files with Java ... on any computer"
If the computer isn't a Windows computer, then you can't expect it to run exes.
 
Semir Muratovic
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i just want it to execute a file that i will be hosting on a website
 
Marshal
Posts: 28288
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
"Semir xx", please check your private messages for an important administrative message.
 
Semir Muratovic
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
can anyone help me?
 
Steve Luke
Bartender
Posts: 4179
22
IntelliJ IDE Python Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by Semir xx:
i just want it to execute a file that i will be hosting on a website



It is that 'from a website' that scares me now. What type of Java application are you running? An Applet? WebStart? Servlets? I think you will run into serious troubles with any of these technologies, but different problems for each.
 
Semir Muratovic
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
i want to host an exe file that can be launched using a java applet from any location, the file is around 500kb in size. is it possible at all?
 
Paul Clapham
Marshal
Posts: 28288
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You still haven't told us the most important requirement. Where do you want to run this executable? On your web server, or on the computer of the client who downloads your applet?
 
Semir Muratovic
Greenhorn
Posts: 5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
on the computer of the client who downloads the applet
 
Rancher
Posts: 5012
38
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
And how are you getting permission from the client to run this exe file?
If you have permissions, you can read the exe file from the server, write it to a folder on the client and then user Runtime class to execute it.
 
author
Posts: 23956
142
jQuery Eclipse IDE Firefox Browser VI Editor C++ Chrome Java Linux Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
As Norm mentioned, by default, Applets are not allowed to do a ton of stuff needed for the task. To enable it, you need to first sign the applet. Then you need to enable that sign applet to do those normally restricted tasks. And this needs to be done on every client that you want to run the applet.

Henry
 
Paul Clapham
Marshal
Posts: 28288
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
If you just want to casually put an executable program on your server and have it run on the client system (which is what your original post sounds like) then forget it. Don't even try. Running executable programs on other people's computers is a serious no-no as it's how malware gets spread around the Internet.
 
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi!!
I have built a mulitple cilents one server chat type application.
Now I also want to autorun an exe file through java applets on clients whenever they connect with server.This file will definitely contain some code.Can you help how can i make this exe file autorun???
Please help.........
Waiting for reply.....
 
Saloon Keeper
Posts: 15702
367
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Sehrish, welcome to CodeRanch.

Have you read and understood the posts in this thread?
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Welcome to the Ranch.

What you want: automatically running an exe on a client when someone visits a server via a website with an applet, is fortunately not possible. It would be a huge security problem if this would be possible.
 
Don't get me started about those stupid light bulbs.
reply
    Bookmark Topic Watch Topic
  • New Topic