for the downloading part, you'll need to use binary read/write. see this for further details: working unbuffered streams.
for the executing part, the problem is that the
runtime.exec()-method can't launch your executable file.
at least under linux (i can't test it on windows), you'll need the full path to the executable file (or use
./[file] when the file is in the same directory as your application) to be able to execute it.
only giving the command works for executables which are part of your systems path-variable.
have a look at clickonce: http://en.wikipedia.org/wiki/clickonce we've used that succesfully.
ive used the following with good results to run command line scripts. you can create a batch script that runs the executable or run it directly using the exec method - probably pass "cmd ". this opens a command prompt from which you can run anything.
public static void runscript(string batchfile, boolean waitforexit0, int retrytime)
string runstring = "cmd /c start " + (waitforexit0?"/wait ":"") + "/min " + batchfile;
process p = runtime.getruntime().exec(runstring); // /c start /wait
int exit = p.exitvalue();
if (exit == 0)
system.out.println("completed: " + runstring);
string s = "";
string s = "";
- Download an exe file and run
- How to create a jar file for the eclipse plugin project that should be able to download and run without eclipse software?
- Eclipse and Maven: Run goal after a file is changed
- project will treat maven dependency as a folder instead of a jar file and on run time gives ClassNotFoundError
- I tried to run Java in Eclipse and it asks me to select ant build and either one I choose it says unable to find ant file to run...
- My LWJGL and Slick2d application won't run from runnable jar file
- How to open and run an exported JAR file
- Unable to run java program with a classpath in a file and usage of @ on the cli
- After run Eclipse Product export wizard, I couldn't see exe file on exported\eclipse folder
- eclipse won't run my exe file
- Download ZIP file from GitHub and import in eclipse
- How to make Exe file in RCP 3.x Application using target definition and product export wizard?
- How to run or call an exe file from a JAR file which is present in the same directory?
- How to run a jar file and launch terminal from java program?
- I am trying to run eclipse (java installed). The application can find my javaw.exe but cannot execute it. Here's my .ini file and the error prompt:
- exe file (created from jar) does not run on double click (command prompt program)
- When I run java servlet to view JSON result -- it pops up file download instead of http://localhost:8080/
- Eclipse Run not asking how to run as, and opens wrong file
- Java and jdbc - exe runnable file
- Netbeans -> How to run a file with specific arguments and specific environmental variables?
- How to Create a exe file devolop for Java application by Using Netbeans and MySQL
- How to compile and run individual jsp file in eclipse project
- How to configure External tool in Eclipse to run a jar file and load other class files?
- How to import and run a project of .class file in Eclipse or IntelliJ
- I wnt to run JavaHelp both from IDE and jar file
- run spring boot non web project in eclipse and could specify file to read
- How to use tagger file and exe file as library in eclipse?
- Can't run exe file from cmd in Java
- How to rename a class and its corresponding file in Eclipse?
- How to create default debug and run configuration in Eclipse?
More Query from same tag
- Eclipse ADT Version requires Update 22.6.2 or above but i already Updated it
- Getting data from the web using Android?
- An internal error occurred during: "Launching MyFirstApp". com/android/ide/eclipse/adt/internal/launchController
- What is the difference between tomcat running inside eclipse and tomcat running on a server?
- Eclipse: Unable to build the project
- "A configuration with this name already exists" error in eclipse run configurations
- AJDT on Eclipse/Maven
- Paho MQTT throws undefined reference error during compile
- How can I customize eclipse to format 2d arrays?
- Eclipse Package Structure messed up when importing gradle project
- Browse Nginx Source Code in Eclipse CDT
- Java, client-server communication
- Can I convert a .clang-format file to the Eclipse formatter format?
- How to run existing apache tomcat instance from eclipse (runtime environment configuration)?
- How to generate html image using JUnit Testrunner
- How do I create an Android project such that it does not include Android Kitkat, but works on Jelly Beans
- Cannot cast from Object to int in eclipse
- maven does not print name of tested class; replaces class name with TestSuite
- Eclipse says my class cannot be resolved
- Change mirror of update sites of eclipse plugins
- JButtons move with the JPanel
- Eclipse Pydev interactive console unable to edit previous lines
- Classpath entry org.eclipse.m2e.MAVEN2_CLASSPATH_CONTAINER will not be exported
- Moving Android Eclipse Project to network drive
- GWT Hello World ; java.lang.IllegalArgumentException: No enum constant com.google.gwt.dev.cfg.ModuleDef.ModuleType.LİBRARY
- Filters in Eclipse Birt
- Span class in opennlp is not working
- Android Device Debug stopped after plug other phone
- Where I can find System.out.println output when running Selenium in Eclipse?
- how to add captured image dynamically into a Horizontal scroll view