Changing java code using Java program

hi All,
I have some java classes, which i need to modify. The changes are mechanical, like putting finally block for the methods where there is a try block.
Please suggest on how to write a small java program that will accomplish the task. Some code snippets may be helpful.
Thanks,
Raj.

no, you got me wrong. After i add the finally blocks,
i will perform the clean up tasks there. The first
part of adding the finally blocks,i want to perform
using a program.No you really don't want to do this.
a) This will not be easy and in fact will be quite messy.
b) It doesn't gain you anything anyway. As you yourself just noted you will have to put appropriate code in all those blocks anyway.
So give this up and do it manually and for next time you will have learned that you should follow the standards from your project from the start.

Similar Messages

  • Invoke exe through java code(using java.lang.Runtime)

    Iam trying to invoke an exe from java code.If i give the complete path for that exe it is running fine .But if i set the environment variable and directly execute the exe through command prompt it iss running fine , but it fails to run when i do the same using java code i.e. java.lang.Runtime.exec function

    Give "//" for directory seperator.
    E.g. r.exec("c://test//test.exe",null);
    Why? That doesn't look correct.It is correct. It will work fine. Try it out.But it doesn't add or solve anything. A forward slash
    does not need to be escaped.'
    It's not even escaping. It's just doubling up. If that works, I'd bet "C://///test///////test.exe" does also.

  • How to check special characters in java code using Java.util.regex package

    String guid="first_Name;Last_Name";
    Pattern p5 = Pattern.compile("\\p{Punct}");
    Matcher m5 =p5.matcher(guid);
    boolean test=m5.matches();
    I want to find out the weather any speacial characters are there in the String guid using regex.
    but above code is always returning false. pls suggest.

    Pattern.compile ("[^\\w]");The above will match any non [a-zA-Z0-9_] character.
    Or you could do
    Pattern.compile("[^\\s^\\w]");This should match anything that is not a valid charcter and is not whitespace.

  • Can i change system time using java

    hi guys can i change system time using java iam doing one app in that i have to change the system time (my os is windowsXP) please tell me how to change the time

    What does this have to do with Swing?
    Well, there is no Java API that I'm aware of.
    However you can execute any Windows command by using the Runtime class. So you should be able to invoke the Time command.
    Search the Java Programming forum. There are plenty of examples on using the Runtime.exec(...) command.

  • Execute MSIL code using JAVA

    How can I execute MSIL code using java?

    Thanks for your reply. I did it in google and didn't find any useful think.
    I just want to know is there any technique in java or already written product that can do that.
    Any advice will be helpful. Thanks

  • Change file mode using java?

    Hi
    Can I change file mode using java method other than
    Runtime.exec()
    thx
    Jacinle

    Hi
    Thank you Roopasri. But what I want is not using Runtime.exec
    I am using Unix and I want to change some image file access mode
    so not a RandomAccess File.
    So is there anything like chmod command on Unix?
    something like maybe java.io.File.chmod("755");
    I read that's a feature requested early on 1.2
    Will it be included in 1.4?
    Jacinle

  • How can i return object from oracle in my java code using pl/sql procedure?

    How can i return object from oracle in my java code using pl/sql procedure?
    And How can i returned varios rows fron a pl/sql store procedure
    please send me a example....
    Thank you
    null

    yes, i do
    But i can't run this examples...
    my problem is that i want recive a object from a PL/SQL
    //procedure callObject(miObj out MyObject)
    in my java code
    public static EmployeeObj callObject(Connection lv_con,
    String pv_idEmp)
    EmployeeObj ret = new EmployeeObj();
    try
    CallableStatement cstmt =
    lv_con.prepareCall("{call admin.callObject(?)}");
    cstmt.registerOutParameter(1, OracleTypes.STRUCT); // line ocurr wrong
    //registerOutParameter(int parameterIndex, int sqlType,String sql_name)
    cstmt.execute();
    ret = (EmployeeObj) cstmt.getObject(1);
    }//try
    catch (SQLException ex)
    System.out.println("error SQL");
    System.out.println ("\n*** SQLException caught ***\n");
    while (ex != null)
    System.out.println ("SQLState: " + ex.getSQLState ());
    System.out.println ("Message: " + ex.getMessage ());
    System.out.println ("Vendor: " + ex.getErrorCode ());
    ex = ex.getNextException ();
    System.out.println ("");
    catch (java.lang.Exception ex)
    System.out.println("error Lenguaje");
    return ret;
    Do you have any idea?

  • Need a java code using swing that can do master configuration

    I need a java code using swing that can do master configuration.For example, in the 1st screen it will show all configuration checke boxes . According to those selected check box, it will show the needed panels sequentially and finnaly it will update many xml files.

    TapasB wrote:
    I need a java code .......and I wish you much luck in creating it. Please come back if you have a specific question on a specific part of your code that is not working quite right.

  • Changing Windows Registry using Java

    hi...all,
    Any1 knows how to change windows registry using java. wheather is it possible ?? or there is any other alternative for same....

    Write a Java class which will create a temporary REG file... use regedit /s from Runtime.exec() and pass that file as argument.
    ***Annie***
    (Where the hell do these ideas come in my head!)

  • Deploying no java applications using Java Web Start

    Hi,
    I am new to java web start. Is it possible to distribute non java applications using java web start. I have an APP which can run on a desktop in standalone mode. The app has jusy HTML and Java script files. Is it possible to package this app and deploying using java web start? I am assuming If it is possible, I can make updates to the packaged app in the web servers and the updates will be downloaded next time the app is used provided configurations are correct?
    thx

    The app has jusy HTML and Java script files. Is it possible
    to package this app and deploying using java web start? Not really. Resources for JWS need to be zipped,
    while this HTML/JS app. will (I guess) not work from
    inside the depths of a Jar (or Zip) archive.
    Note that you can organise for those files to be
    downloaded and expanded onto a known place
    on the user's disk, by using an 'installer' element,
    but..
    ...I am assuming If it is possible, I can make updates to the
    packaged app in the web servers and the updates ..installers are only called once, and do not 'update'.

  • Get Native Java Window using Java Access Bridge 2.0.1 & Java 1.6 and above

    I want to get the native java window (Like Java Monkey Application and Java Ferret Application) using java only, for that I tried different ways/options but unable to get the native java window and perform actions on that.
    It would be really great if you could guide me for that. I am still unable to start the Java Access Bridge.
    Please let me know the steps to get native java window using Java Access bridge and JDK 1.6.20.
    Also Note that, As per your previous suggestion, I tried to search and call initializeAccessBridge() and shutdownAccessBridge(), But unable to succeed it. I did not find such method in Accessbridge.jar.
    Please help me out.
    Best Regards

    You might want to check out this thread:
    Java Access Bridge and JRE 1.6
    If you have Java 6, you'll need to manually install Java Access Bridge 2.0.1. The JAB 2.0.2 installer for Java 6 is also available as a beta:
    http://jdk6.java.net/6uNea.html

  • Error -- Java code using OIM API to find no of users in OIM

    Hi Experts,
    I hav a requirement that I need to query OIM to find out the total no of active users in the system using a stand alone java program to determine some other process. So I have developed a simple java code but it fails in the below line
    rset=userIntf.findAllUsers(map);  -- It throws null pointer exception
    I have tried with deleteUser() instead of findUsers() , still it throws the null pointer exception on the same line.I have checked the other posts in the forum but could not find out where is the mistake. Can u please suggest me??
    Here is the code
    System.setProperty("XL.HomeDir","D:/bea-oim/xellerate");
    System.setProperty("java.security.auth.login.config","D:/bea-oim/xellerate/config/authwl.conf");
    System.setProperty("java.security.policy","D:/bea-oim/xellerate/config/xl.policy");
    System.setProperty("log4j.configuration","D:/bea-oim/xellerate/config/log.properties");
    tcUtilityFactory utilityFactory = null;
    tcUserOperationsIntf userIntf = null;
              try
                   tcResultSet rset;
                   ComplexSetting config = ConfigurationClient.getComplexSettingByPath("Discovery.CoreServer");
                   final Hashtable env = config.getAllSettings();
                   tcSignatureMessage moSignature = tcCryptoUtil.sign("xelsysadm","PrivateKey");
                   utilityFactory = new tcUtilityFactory(env, moSignature);
                   userIntf=(tcUserOperationsIntf)utilityFactory.getUtility("Thor.API.Operations.tcUserOperationsIntf");
                   HashMap map = new HashMap();
                   map.put("Users.Status","Active");
                   rset=userIntf.findAllUsers(map);
    System.out.println(rset.getRowCount());
         catch(NullPointerException ne)
         System.out.println(ne.getMessage());
         ne.printStackTrace();
         catch(Exception e)
         System.err.println(e.getMessage());
         e.printStackTrace();
    Thanks & Regards
    INIYA

    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    import java.util.HashMap;
    import java.util.Properties;
    import java.util.*;
    import Thor.API.tcUtilityFactory;
    import Thor.API.Operations.*;
    import Thor.API.tcResultSet;
    import com.thortech.xl.crypto.tcCryptoUtil;
    import com.thortech.xl.util.config.ConfigurationClient;
    * @author Rajiv
    public class CreateBulkUsers {
    public static void main(String args[])
    System.setProperty("XL.HomeDir", "E:\\oim\\server\\xellerate");
    System.setProperty("java.security.auth.login.config", "E:\\oim\\server\\xellerate\\config\\auth.conf");
    System.setProperty("java.security.policy", "E:\\oim\\server\\xellerate\\config\\xl.policy");
              tcUtilityFactory utilityFactory = null;
    tcUserOperationsIntf userIntf = null;
    try
    com.thortech.xl.util.config.ConfigurationClient.ComplexSetting config = ConfigurationClient.getComplexSettingByPath("Discovery.CoreServer");
    java.util.Hashtable env = config.getAllSettings();
    com.thortech.xl.crypto.tcSignatureMessage moSignature = tcCryptoUtil.sign("xelsysadm", "PrivateKey");
    utilityFactory = new tcUtilityFactory(env, moSignature);
    // System.out.println((new StringBuilder()).append("utilityFactory = ").append(utilityFactory).toString());
    userIntf = (tcUserOperationsIntf)utilityFactory.getUtility("Thor.API.Operations.tcUserOperationsIntf");
    HashMap map = new HashMap();
    map.put("Users.Status", "Active");
    tcResultSet rset = userIntf.findAllUsers(map);
    System.out.println(rset.getRowCount());
    catch(NullPointerException ne)
    System.out.println(ne.getMessage());
    ne.printStackTrace();
    catch(Exception e)
    System.err.println(e.getMessage());
    e.printStackTrace();
    Include all the JARs to run this class from outside not only of OIm of JBoss or Weblogic also.
    eg: jboss\client and jboss\lib

  • Login codes using java database (validates with Microsoft Access File)

    hi all pro-programmer, can you show me the code to login with the username and password using java database. When the user enters the username and password in the login page then it will go to the requested page. may i know how to do it?

    no one will give you complete code.
    i'll lay out the pieces for you, though:
    (1) start with a User object. give it username and password attributes.
    (2) write a UserDAO interface with CRUD operations for a User object.
    (3) write a UserDAOImpl for your Microsoft Access database
    (4) write an AuthenticationService interface
    (5) write an implementation of the AuthenicationService that works with the UserDAO to authorize a User.
    Use a servlet to accept request from your login page and pass it off to the service. Voila.
    PS - Here's skeleton to start with. UI, servlet, and controller are your responsibility:
    package model;
    public class User implements Serializable
        private String username;
        private String password;
        public User(String u, String p)
            this.username = u;
            this.password = p;
        public String getUsername() { return username; }
        public String getPassword() { return password; }
    public interface UserDAO
        public User findByUsername(String username);
        public void saveOrUpdate(User user);
        public void delete(User user);
    public class UserDAOImpl implements UserDAO
        private Connection connection;
        public UserDAOImpl(Connection connection)
            this.connection = connection;
        public User findByUsername(String username)
            String password = "";
            // logic for querying the database for a User
            return new User(username, password);
        public void saveOrUpdate(User user)
            // save or update a User
        public void delete(User user)
            // delete a User
    public interface AuthenticationService
        public boolean isAuthorized(String username);
    public class AuthenticationServiceImpl implements AuthenticationService
        private UserDAO userDAO;
        public AuthenticationServiceImpl()
            // Create a database connection here and the UserDAO, too.
        public boolean isAuthorized(String username)
            boolean isAuthorized = false;
            // Add logic to do the database query and decide if the username is authorized
            return isAuthorized;       
    }

  • CHANGE SECURITY SETTING USING JAVA

    Hi all,
    Please Help!!!
    I am using, JAVA / STRUTS for developing an web application.
    In the Client/ Server Technology, I need to set the client Browser Security Level.
    Can it be done through JavaScript or how it can be achieved.
    Thanks & Regards
    Glass_Fish.........

    I am using, JAVA / STRUTS for developing an web application.
    In the Client/ Server Technology, I need to set the client Browser Security Level.Not possible.
    Can it be done through JavaScript or how it can be achieved.By asking the end user to change their Security level if your application really needs them. For example there are ways to detect whether scripting language is enabled or not, whether cookies are enabled or not. If your application really needs that features, Ask user to enable the particular feature by displaying proper messages.

  • Monitor java code using BAM

    Hi,
    I am new to BAM, and I have a specific use case, for which I couldnt find any doc in the web. I want to monitor a java code at different point using BAM. To be in more detail, I would like to add sensors at different location in my java code, which would possible push it to JMS queue and BAM monitors those data objects.
    Thanks,
    Sudarsan M

    Hi Sudarshan,
    Please look in the blog entry below that demonstrate how you can feed BAM Data objects by listening to JMS Queue/Topic.
    http://beatechnologies.wordpress.com/2011/05/20/integrating-oracle-bam-11g-with-bpel-jms-sensor-action/
    The example in the blog illustrate how a BPEL process uses a JMS Sensor action to publish Data to a JMS Queue and from there how it is picked up by External Message Sources in BAM.
    For your use case you can write a small client code to post an XML message from your Java Class to a Queue in Weblogic.
    Hope it helps.

Maybe you are looking for

  • AppleScript do script file completely broken in Acrobat 9 Pro?

    After not being able to use Acrobat 8 at all because of this issue http://www.adobeforums.com/webx/.59b4b95a I plunked down another $170 hoping the issue would be fixed in Acrobat 9. But with Acrobat 9 Pro (9.0.0, OS X 10.5.5), calling do script file

  • Playlist on iPhone doesn't show same number of songs in library

    The playlist on my iPhone 4S shows that I've downloaded from my library 893 songs, across 4 playlists.  However when I connect the iPhone to the library, the information bar, that indicates how much of the memory is being used on the phone, shows 103

  • Ul horizontal navigation not displaying correctly in IE6

    I am designing a web site for my psychology department and ideally it will display correctly across browsers, including older versions. I've used CS Live to test how it displays, and everything looks great EXCEPT IE6. What percentage of people out th

  • Lightroom and Sony NEX5 raw files. How can I make them work together?

    Hi All Just got a Sony NEX5. My version of Lightroom 2 doesn't support its RAW files. Can someone let me know what to download or do I need to buy Lightroom 3 upgrade? Thanks

  • OWSM Policy in OSB

    I am trying to build a sample OSB service having the OWSM policy attached to it.I am using the option of "From OWSM Policy Store " and used the policy oracle/wss_username_token_service_policy. When i tried to exceute the OSB,i am getting an error as