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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
mapAB Challlenge 35 128
Java Jpanels and Jframe 8 28
VB Script to add site to Java Exception List 4 54
Opening PDF on button click and fill new document 2 23
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Viewers will learn about arithmetic and Boolean expressions in Java and the logical operators used to create Boolean expressions. We will cover the symbols used for arithmetic expressions and define each logical operator and how to use them in Boole…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:

863 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now