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

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
servlet doXXX methods 3 61
Windows 10 IE Certificate Issue 10 51
jsp insert to database example 2 43
mysql jsp example issue 32 48
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers will learn about the regular for loop in Java and how to use it. Definition: Break the for loop down into 3 parts: Syntax when using for loops: Example using a for loop:

792 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