Execute .bat file from applet?

Posted on 1997-04-04
Last Modified: 2012-06-21

Can I execute a .bat file from Java applet?

I am trying execute a .bat file by using exec(String) method.

My code is:

        Process proceso;

        catch(IOException e)
            System.out.println("bad shell");

        System.out.println("The end");

It do not execute the command system 'tree', but it print "The end".

It is right if I do not use a bat file, like this:


Thank you,


Question by:apico
1 Comment

Accepted Solution

JWBito earned 50 total points
ID: 1219418
Runtime.getRuntime.exec(" /c c:\\sistel\\ejemjava\pt\param.bat");

On NT, would be cmd.exe, instead.  

I would like to know how to get at system environment variables from java.

Featured Post

Free Tool: IP Lookup

Get more info about an IP address or domain name, such as organization, abuse contacts and geolocation.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
servlet example 11 56
java imports not found 4 47
What browser will run Java? 7 123
Pass multiple values or string arrays in java as a parameter 3 36
After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Go is an acronym of golang, is a programming language developed Google in 2007. Go is a new language that is mostly in the C family, with significant input from Pascal/Modula/Oberon family. Hence Go arisen as low-level language with fast compilation…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:

756 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question