How to run native program with Java program?

Hello
I've got following problem. I'd like to write file browser which would work for Linux and
Windows. Most of this program would be independent of the system but running programs not. How to run Linux program from Java program (or applet) and how to do it in Windows?.
Cheers

Try this:
Runtime rt = Runtime.getRuntime();
Process proc = rt.exec("ls -l");
InputStream stream = proc.getInputStream();
InputStreamReader isr = new InputStreamReader(stream);
BufferedReader br = new BufferedReader(isr);
String line = null;
while ( (line = br.readLine()) != null) .....
"if the program you launch produces output or expects input, ensure that you process the input and output streams" (http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html)

Similar Messages

  • How to run sscript shell with java program

    Hi everybody,
    i want to know how can i do to execute a script shelle (bash) with program java (if it s possible)
    for example this script:
    #!/bin/bash
    echo "hello"
    can i run it with java program or i have to make dome modifications .
    thank you for your help in advance.

    Well, if you want to be portable across platforms, you should write as much code in Java as possible and not rely on native scripts (I'm sure your script is more complex than this 'echo' example ;-) ).
    Having said that, you can use the java.lang.Runtime class and in particular its various exec() methods.
    Try something like this:
    Process p;
    try {
        p = Runtime.getRuntime().exec("myscript.sh");
    } catch (IOException ioe) {
    }You can then "interact" with the spawned process with the Process object returned by the exec method.
    Note you need to have the appropriate security rights.
    For more details, look at the API documentation here:
    http://java.sun.com/j2se/1.4.2/docs/api/
    hth,
    -Alexis

  • How to run an applet with .java files in 2 dirrerent directories ?

    I have an applet with :
    5 .java class files and its .html file in one directory and
    2 .java class files ( with identical names) and its .html file in another directory .
    How do I go about executing this applet ? In the past all the applets
    I have run had all the classes in one directory.
    Thank you in advance

    If you want them both in the same page, put both applet tags in 1 page,
    I could do that but both directories have a SpaceDunes.class
    and both directories have a Shot class (diffferent immplementations
    but the same name)
    so the applet tag
    <APPLET CODE="SpaceDunes.class"
    CODE="SpaceDunes.class"
    This can't be the right approach ? ?
    Thank you for your advice
    <HTML>
    <HEAD>
      <TITLE>SpaceDunes Applet
      </TITLE>
    </HEAD>
        <BODY>
         <H1>SpaceDunes Applet
        </H1>
          <HR>
            <APPLET CODE="SpaceDunes.class"
                              CODE="SpaceDunes.class"
                         WIDTH=500
                         HEIGHT=500
                           CODEBASE=".">
                ALT="Your browser understands the <APPLET>
                         tag but isn't running the applet, for some reason."
                          Your browser is ignoring the <APPLET> tag!
          </APPLET>
         <HR>
        </BODY>
    </HTML>

  • How to run Struts program with the help of tomcat

    Hello Everybody
    This is Adesh.I am a newcomer of java and facing a problem with struts, so if any one know how to set the path of struts and how to run struts program, so plz inform me.
    THX in Advance.............................................

    struts-config.xml
    <struts-config>
    <action-mappings>
         <action path  = "/welcome"
                    type  = "Welcome"
                    scope="session">
                <forward name="success" path=".welcome"/>
                <forward name="failure" path=".base.error"/>
         </action>
    </action-mappings>
        <plug-in className="org.apache.struts.tiles.TilesPlugin">
            <set-property property="definitions-config" value="/WEB-INF/tiles-defs.xml"/>
            <set-property property="definitions-debug" value="1"/>
            <set-property property="definitions-parser-details" value="0"/>
            <set-property property="definitions-parser-validate" value="true"/>
        </plug-in>
    </struts-config>tiles-defs.xml
    <tiles-definitions>
         <definition name = ".base" path = "/include/template.jsp">
              <put name = "title" value = "${title}"/>
              <put name = "header" value = "/include/top.jsp"/>
              <put name = "body" value = "${body}"/>
              <put name = "footer" value = "/include/footer.jsp"/>
         </definition>
    </tiles-definitions>web.xml
    <servlet>
            <servlet-name>action</servlet-name>
            <servlet-class>org.apache.struts.action.ActionServlet</servlet-class>
            <init-param>
                <param-name>config</param-name>
                <param-value>/WEB-INF/struts-config.xml</param-value>
            </init-param>
    <init-param>
                <param-name>definitions-config</param-name>
                <param-value>/WEB-INF/tiles-defs.xml</param-value>
            </init-param>
            <load-on-startup>1</load-on-startup>
        </servlet>
    <servlet>
            <servlet-name>init</servlet-name>
            <servlet-class>Init</servlet-class>
            <load-on-startup>2</load-on-startup>
        </servlet>
        <servlet-mapping>
            <servlet-name>action</servlet-name>
            <url-pattern>*.do</url-pattern>
        </servlet-mapping>
      <jsp-config>
        <taglib>
            <taglib-uri>/WEB-INF/struts-bean.tld</taglib-uri>
            <taglib-location>/WEB-INF/struts-bean.tld</taglib-location>
        </taglib>
        <taglib>
            <taglib-uri>/WEB-INF/struts-html.tld</taglib-uri>
            <taglib-location>/WEB-INF/struts-html.tld</taglib-location>
        </taglib>
        <taglib>
            <taglib-uri>/WEB-INF/struts-logic.tld</taglib-uri>
            <taglib-location>/WEB-INF/struts-logic.tld</taglib-location>
        </taglib>
        <taglib>
            <taglib-uri>/WEB-INF/wall.tld</taglib-uri>
            <taglib-location>/WEB-INF/wall.tld</taglib-location>
        </taglib>
        <taglib>
            <taglib-uri>/WEB-INF/c.tld</taglib-uri>
            <taglib-location>/WEB-INF/c.tld</taglib-location>
        </taglib>
        <taglib>
            <taglib-uri>/WEB-INF/fn.tld</taglib-uri>
            <taglib-location>/WEB-INF/fn.tld</taglib-location>
        </taglib>
        <taglib>
            <taglib-uri>/WEB-INF/fmt.tld</taglib-uri>
            <taglib-location>/WEB-INF/fmt.tld</taglib-location>
        </taglib>
    </jsp-config>
        <resource-ref>
            <description>DB Connection</description>
            <res-ref-name>jdbc/SQLServerDB</res-ref-name>
            <res-type>javax.sql.DataSource</res-type>
            <res-auth>Container</res-auth>
        </resource-ref>
    </web-app>This should help....

  • How to run the program in back ground with out selection screen ?

    Hi,
    I want to run the program in back ground but don't have selection screen. How to run this program in back ground
    as program has no selection screen.
    Waiting for quick response.
    Best Regards,
    Padhy
    Moderator message: basic, please search for available information/documentation.
    Edited by: Thomas Zloch on Feb 21, 2011 12:43 PM

    Hi,
    Go to transaction SE38 --> Execute --> Background.
    If your program contains selection screen, you have to pass your input values as variants.

  • How to run labview program in debugging mode in windows 95 version

    Respected all,
    I am facing probelm while running probe.vi.
    I received this command "connection to acquisition board was not found" when i run labview program.
    I  am using labview 5.1, fieldpoint FP 1000, NI-DAQ 6.5, Field point explorer version 1.6, Measurement and Automation Explorer 1.0.1.
    I would kindly request you please help me how to run my program probe.vi in debugging mode in windows 95 version, so that i can locate where error occurs.
    Thanking You
    Yours faithfully
    M.Vijay

    Respected Norbert,
    Thank you very much to for your help.
    Norbert : Possible reasons are e.g. wrong IDs for measurement devices. If the error is connect to the FieldPoint, it is possible that it isn't configured correctly.
     I am using Field point explorer 1.6, The Field point instrument FP 1000 and RS-232 port is using. It is confirmed that the field point instrument is working properly by LED light indication test.
    Norbert: It sound like you are using DAQ devices (like PCI MIO 6952E) in the application. Are you sure that you select the correct device ID for this?
    I am asking you to know, If i using Labview and  Fieldpoint instrument FP 1000 to monitor my parameter interms of All, Channel 0, Channel 1, Channel 2, Channel 3, Channel 4, Channel 5, Channel 6, Channel 7 for my measurement.
    But now i need to solve the command connection to acquisition board was not found, The expert say this command is due to there was no AT-AO-10 Analog Output board was present in CPU.
    I do not find AT-AO-10 Analog Output board in my CPU, Previously the instrument was worked perfectly by other person who assembled everthing to measure temperature.
    The only aswer know send by previous person is if my task does not imply the use of a DAQ you probably have to locate where the DAQ driver is called and exclude it from the program. try to run the program in debugging mode so that you can locate where the error occurs.
    I do not know how to proceed his instruction. So i would kindly request you to please help me to solve my probelm.
    I also removed AT-AO-10 software from device manager >> Data Acquisition system >>  AT-AO-10 just now.
    I also find GPIB version 1.30, when i remove in add or remove program, it say that Error removing the GPIB.
    I am eagerly waiting for your help.
    Thanking You
    Yours faithfully
    M.vijay

  • NetBeans IDE: How to run a prog with arguments

    Hi:
    I have the following code that copies contents of inputFile to outputFile.
    The inputFile is taken as argument to the java program.
    ie java Copy fileA
    public class Copy {
    public static void main(String[] args) throws IOException {
        String dir_sep = System.getProperty("file.separator");
            String inputFileLoc;       
            inputFileLoc = args[1];
             File outputFile = new File("C:" + dir_sep + "temp" + dir_sep + "out.xml");      
            File inputFile = new File(inputFileLoc);
            FileReader in = new FileReader(inputFile);
            FileWriter out1 = new FileWriter(compstopFile, true);
            int c;
            while ((c = in.read()) != -1)
                         out1.write(c);     
            in.close();       
            out1.close();
    }I need to know how to run this program by passing the argument to it within the IDE? Just running the program from the IDE Run menu option, causes ArrayIndexOutOfBounds exception.
    Thanks a lot in advance!

    sourcecode's filenode -> ContextMenu -> Properties -> In the second block, there's one called "Arguments" -> Edit that -> You're done.
    Yours,

  • How to run JavaFX Jar with JRE 7 on MAC OS Lion 10.7.5 ?

    I had java 1.6 installed on my MAC OSX Lion 10.7.5. When I am trying to run that JavaFX application jar
    java -jar application.jar
    It always shows a dialog "The application require a newer version of Java Run-time" with download link. Even I have downloaded and successfully installed it on my MAC machine but it still shows me the same window.
    It installed jre-7u10-macosx-x64.dmg but java -version is always point to 1.6.
    Then I searched for Java Preferences to point the current JRE 1.7 but I could find Java Preferences at Applications -> Utilities -> Java -> Java Preferences.
    I found an Java Icon on System Preference. When I am trying to open that widow it's showing me error -- the java control panel opens in a separate window and nothing happens when we click on Re-open the Java Control Panel.
    http://avats.s3.amazonaws.com/JavaRunningError.txt
    I would like to know -- how to run JavaFX jar with JRE7 on MAC OS Loin 10.7.5? Is their any other way to run the JavaFX application JAR with JRE7?

    To find a copy of LP7 you would need to look for a copy on eBay.. However, the protection method used with LP7 no longer functions so you cannot register it and therefore you cannot use it. unless you have already registered LP7 yourself in the past using the security key dongle provided
    Any version of LP7 from a torrent would be an illegal (and most likely non working) version due to the protection that was used at that time... and so posting about it here, was not be wise.
    So.. thats why my previous answer was so brief... Simply put, you cannot use LP7 unless you already have a validated and registered security dongle... even if you found a copy of LP7 somewhere
    The only practical solution is to find some kind soul who already has a working version of LP7 installed, that you can send the projects to... for them to do the conversion for you.
    I would, but I no longer have LP7 installed here on any of my testbed Macs...

  • How to run JavaFX jar with JRE7 on MAC OS Lion 10.7.5 ?

    I have created a bundled JavaFX application jar with ANT on Windows 8 O.S. , 64 bit machine. I have JavaFx2.0 and Java 1.7.0_09 installed on my Window O.S.
    <target name="CreatingJars" depends="Compiling" description="generate the distribution" >
                        <taskdef resource="com/sun/javafx/tools/ant/antlib.xml"     
                                 uri="javafx:com.sun.javafx.tools.ant" classpath="${env.JAVA_HOME}/lib/ant-javafx.jar"/>
                              <mkdir dir="${WorkingFolder}/temp/libs"/>
                             <copy todir="${WorkingFolder}/temp/libs">
                             <fileset file="${WorkingFolder}/CustomJars/ProjectLib.jar">
                             </fileset>
                             </copy>
                             <copy todir="${WorkingFolder}/temp/libs">
                             <fileset dir="${WorkingFolder}/libs">
                             </fileset>
                        </copy>
                        <fx:jar destfile="${WorkingFolder}/${app.name}.jar">
                        <fx:application mainClass="${main.class}"/>
                        <fx:resources>
                             <fx:fileset dir="${WorkingFolder}/temp/"/>
                        </fx:resources>
                        <fileset dir="${WorkingFolder}/build"/>
                        <fileset dir="${WorkingFolder}/resources"/>
                        </fx:jar>
         </target> When I am trying to run that JavaFX application jar on MAC OS Lion 10.7.5 using
    java -jar application.jar
    It always shows a dialog "The application require a newer version of Java Run-time" with download link. Even I have downloaded and successfully installed it on my MAC machine but it still shows me the same window.
    java -version is always point to 1.6.
    Then I searched for Java Preferences to point the current JRE 1.7 but I could find Java Preferences at Applications -> Utilities -> Java -> Java Preferences.
    I would like to know -- how to run JavaFX jar with JRE7 on MAC OS Lion 10.7.5? Is their any other way to run the JavaFX application JAR with JRE7?

    Do I need to download the whole JAVA 1.7 on MAC to run the JAR? No
    Can not I run the Jar file with Jre7?Yes, you can.
    This may be because I have downloaded the JRE 1.7Yep, that's correct, the java_home command only works for jdk's - sorry for the confusion.
    For jre7+ versions, only a single Oracle jre version is allowed to be installed on the machine at a time - making a tool like java_home redundant for jre checking.
    Weirdly, jre7u10 does not supplant the Apple Java on the command line path by default. If you just type java -v, then the Apple java version will displayed if you have an old Java 6 from Apple and a new Oracle jre7+.
    The Oracle jre is always located under (also somewhat strangely):
    /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/javaTo test jar launching, I used the willow JavaFX browser pre-release jar available here:
    http://code.google.com/p/willow-browser/downloads/detail?name=Willow-0.1-prerelease.jar
    Then I launched the jar from the command line using:
    /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home/bin/java -jar Willow-0.1-prerelease.jar The JavaFX jar ran fine on jre7 with the above machine.
    The test machine was running Mac OS X 8 with Oracle jre7u10 installed as well as the Apple Java 6 runtime, but no Oracle jdk7+ installed.

  • How to run ear file in java application server

    i want how to run .ear file in java application server
    1. i m created ear file
    2. i m created jar file (bean,home,remote)
    3.i m created war file(in the form of jsp)
    but till now i couldnt run ear file
    how to run
    please hel me

    You must create :
    1.Jar file
    2.War file
    And then put them into an ear file
    Exemple : myapp.ear contains
    myappEJB.jar
    myappWEB.war
    META-INF/application.xml
    and application.xml looks like this :
    <application xmlns="http://java.sun.com/xml/ns/j2ee" version="1.4"
        xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
        xsi:schemaLocation="http://java.sun.com /xml/ns/j2ee
                            http://java.sun.com/xml/ns/j2ee/application_1_4.xsd">
        <display-name>myapp</display-name>
        <description>Demo application</description>
        <module>
            <ejb>myappEJB.jar</ejb>
        </module>
        <module>
          <web>
             <web-uri>myappWAR.war</web-uri>
             <context-root>/myapp</context-root>
          </web>
        </module>
    </application>Good luck

  • How to connect oracle database with JAVA

    how to connect oracle database with JAVA....
    using j2sdk and Jcreator . which connector to use .. what are the code for that ..

    PLEASE .... Ask in an Oracle Java forum.
    And read the documentaiton. There is a whole document devoted to doing that. http://download.oracle.com/docs/cd/B19306_01/java.102/b14355/toc.htm has examples.
    PLEASE ... do not ask product questions in a forum which clearly has a title saying it is devoted to assisting with download problems.

  • How to run execute immdiate with variables

    Hi friends,
    How to run execute immdiate with variables in v_stmt below?
    I dont know how to declare the value of i here.
    Set serveroutput on;
    DECLARE
       i        VARCHAR (20);
       v_stmt   VARCHAR2 (100);
       CURSOR c
       IS
          SELECT sqlid FROM temp1;
    BEGIN
       OPEN c;
       LOOP
          FETCH c INTO i;
          EXIT WHEN c%NOTFOUND;
          DBMS_OUTPUT.put_line (i);
          v_stmt := 'select * from table(dbms_xplan.display_cursor('&i',null))'
          execute immediate v_stmt;
       END LOOP;
       CLOSE c;
    END;
    /Regds,
    Kunwar.

    You first need to use a bind variable (named ':v' in SQL statement in my example):
    set serveroutput on;
    DECLARE
       i        VARCHAR (20);
       v_stmt   VARCHAR2 (100);
       CURSOR c
       IS
           -- modified for a quick test
          SELECT sql_id FROM v$sql where child_number > 2;
    BEGIN
       OPEN c;
       LOOP
          FETCH c INTO i;
          EXIT WHEN c%NOTFOUND;
          DBMS_OUTPUT.put_line (i);
          v_stmt := 'select * from table(dbms_xplan.display_cursor(:v,null))';
          execute immediate v_stmt using i;
       END LOOP;
       CLOSE c;
    END;
    /However because your SELECT statement returns several rows you need to adapt your code to process all rows returned (as already suggested in first reply to your message).
    Instead of using PL/SQL, I recommend to generate a SQL file using only SQL and then to run the generated SQL file.
    For example:
    spool edx.sql
    set serveroutput on
    declare
    v_stmt varchar2(100);
    v_q char(1):='''';
    begin
    dbms_output.put_line('spool edx.log');
    for s in (select sql_id from v$sql where child_number >2)
    loop
      dbms_output.put_line('select * from table(dbms_xplan.display_cursor(' || v_q || s.sql_id || v_q || ',null));');
    end loop;
    dbms_output.put_line('exit');
    end;
    spool ofThis generates a SQL file similar to :
    spool edx.log
    select * from table(dbms_xplan.display_cursor('5rygsj4dbw6jt',null));
    select * from table(dbms_xplan.display_cursor('5rygsj4dbw6jt',null));
    select * from table(dbms_xplan.display_cursor('5rygsj4dbw6jt',null));
    select * from table(dbms_xplan.display_cursor('fsbqktj5vw6n9',null));
    select * from table(dbms_xplan.display_cursor('6q42j0018w7t8',null));
    select * from table(dbms_xplan.display_cursor('a5mmhrrnpwjsc',null));
    select * from table(dbms_xplan.display_cursor('3c1kubcdjnppq',null));
    select * from table(dbms_xplan.display_cursor('3c1kubcdjnppq',null));
    select * from table(dbms_xplan.display_cursor('9gkq7rruycsjp',null));
    select * from table(dbms_xplan.display_cursor('f0wj261bm8snd',null));
    select * from table(dbms_xplan.display_cursor('ab3swhv5g138y',null));
    select * from table(dbms_xplan.display_cursor('6vgvyh4xw9c5g',null));
    select * from table(dbms_xplan.display_cursor('ak5crjygnpk60',null));
    select * from table(dbms_xplan.display_cursor('9p6bq1v54k13j',null));
    select * from table(dbms_xplan.display_cursor('19x1189chq3xd',null));
    select * from table(dbms_xplan.display_cursor('7sx5p1ug5ag12',null));
    select * from table(dbms_xplan.display_cursor('730vdzhng6m6g',null));
    select * from table(dbms_xplan.display_cursor('730vdzhng6m6g',null));
    select * from table(dbms_xplan.display_cursor('0v3dvmc22qnam',null));
    select * from table(dbms_xplan.display_cursor('0v3dvmc22qnam',null));
    select * from table(dbms_xplan.display_cursor('a1zv6wju3ftgv',null));
    select * from table(dbms_xplan.display_cursor('7ng34ruy5awxq',null));
    select * from table(dbms_xplan.display_cursor('7ng34ruy5awxq',null));
    select * from table(dbms_xplan.display_cursor('b2gnxm5z6r51n',null));
    select * from table(dbms_xplan.display_cursor('b2gnxm5z6r51n',null));
    select * from table(dbms_xplan.display_cursor('g4gp07gt2z920',null));
    select * from table(dbms_xplan.display_cursor('1gu8t96d0bdmu',null));
    select * from table(dbms_xplan.display_cursor('g00cj285jmgsw',null));
    select * from table(dbms_xplan.display_cursor('g00cj285jmgsw',null));
    select * from table(dbms_xplan.display_cursor('g00cj285jmgsw',null));
    select * from table(dbms_xplan.display_cursor('bn4b3vjw2mj3u',null));
    select * from table(dbms_xplan.display_cursor('38243c4tqrkxm',null));
    select * from table(dbms_xplan.display_cursor('2abjfnvy5rkyg',null));
    select * from table(dbms_xplan.display_cursor('350f5yrnnmshs',null));
    select * from table(dbms_xplan.display_cursor('350f5yrnnmshs',null));
    select * from table(dbms_xplan.display_cursor('3s1yukp05bzg6',null));
    select * from table(dbms_xplan.display_cursor('3s1yukp05bzg6',null));
    select * from table(dbms_xplan.display_cursor('1tgukkrqj3zhw',null));
    exit
    PL/SQL procedure successfully completed.Edited by: P. Forstmann on 20 mars 2013 19:06
    Edited by: P. Forstmann on 20 mars 2013 19:33

  • How to run hardware diagnostic with the help of terminal?

    how to run hardware diagnostic with the help of terminal? any cmds

    Macs newer than 10.7's release just need to boot with the 'D' key.  
    Otherwise you need to find the original installer disk of the Mac, or call AppleCare for it to be able to run the hardware diagnostic.

  • How can i create messenger with java tv API on STB

    deal all.
    how can i create messenger with java tv API on STB.
    how can Xlets communicate each other?
    how?
    i am interested in xlet communications with java tv.
    is it impossible or not?
    help all..

    You can create a messenger-style application using JavaTV fairly easily. JavaTV supports standard java.net, and so any IP-based connection is pretty easy to do. The hard part of the application will be text input, but people have been using cellphone keypads to send SMS messages for long enough that they're familiar with doing this. This doesn't work well for long messages, where you really need a decent keyboard, but for short SMS-type messages it's acceptable.
    The biggest problem that you need to work around is the return channel. Many receivers only have a dial-up connection, ties up the phone line and potentially costs people money if they don't get free local calls. Always-on return channels (e.g. ADSL or cable modem) are still pretty uncommon, so it's something that you nee to think about. Of course, if you do have an always-on connection then this problem just goes away.
    This is really one of those cases that's technically do-able, but the infrastructure may not be there to give users a good experience.
    Steve.

  • How to run SQL files from Java?

    Hi,
    Can someone point me towards a link on how to run sql files in Java? Thanks.
    P.S...if I've been completely blind please go easy on me!

    Sorry forgot the formating code thingy
    public static boolean executeScript(File script, Connection conn){
        boolean success = true;
        success = script.exists();
        if(success){
          DEBUG.print("ES::READING SCRIPT:" + script.getAbsolutePath());
          StringBuffer buffer = new StringBuffer();
          success=readScript(script,buffer);
          if(success){
            try{
              String creationScript = buffer.toString();
              Statement st = conn.createStatement();
              int start = 0;
              int end = 0;
              while (end != -1 && start < creationScript.length()) {
                end = creationScript.indexOf("GO", start);
                if (end != -1) {
                  DEBUG.print(creationScript.substring(start, end));
                  st.executeUpdate(creationScript.substring(start, end));
                  start = end + 2; //2 is the length of "GO"
              st.close();
            }catch(Exception e){
              success=false;
              DEBUG.printStackTrace(e);
        }else{
          DEBUG.print("ES::SCRIPT FILE DOES NOT EXISTS");
          success=false;
        return success;
      public static boolean readScript(File script, StringBuffer buffer){
        boolean success = true;
        DEBUG.print("RS:: reading file :" + script.getAbsolutePath());
        try{
          InputStreamReader isr = new InputStreamReader(new FileInputStream(script),"UTF16");
          int ch;
          while ( (ch = isr.read()) > -1) {
            buffer.append( (char) ch);
          if (isr != null)
            isr.close();
        }catch(Exception e){
          success=false;
          DEBUG.printStackTrace(e);
        return success;
      }

Maybe you are looking for