How to launch Jar file in Mac Os using java code??

can anyone tell me how can i launch another jar file in my apllication using java code.

define "launch".
- You want to run a new java program in a separate process? (see Runtime.exec())
- You want to run a method in a specific class in the jar? (add jar to application classpath and then simply instantiate the class and call the method)

Similar Messages

  • How can we get requester's user id using java code

    Hi,
    How can we get requester's user id using java code?
    eg: If i had logged in as xelsysadm and request a resource for user uid101 on the userid field it should display uid101 and not xelsysadm.
    also,
    I have a resoure "A" which on revoking should also revoke resources B and C. How can it be done. Resource A, B, and C are 3 different resource objects.
    ==Thanks,
    doki

    Ok, so there is a way, but it's not available during submission. You can use the findRequests api. From the result set, get the "Requests.Consolidated Data Value" value. In this information, you will get an xml formatted data. It provides the list of users on the request on the left side after submission. After the request is completed, this value is available. Upon completion, you could get the request information, get this value, and parse the information for user ids.
    In the same adapter, use the following API:
    formIntf.setObjectFormData(objInstanceKey, formHash)
    The formHash is a hashtable containing the field name on your object form, and the values you wish to populate it with. You could create a textarea box on your object form and populate the userids for who the request is for.
    However, this makes absolutely 0 sense. When you get a request, the list of userids are listed right there on the request.
    -Kevin

  • How to send sms to mobile from tomcatserver using java code?

    Hi,
    Could you please let me know that,
    How to send sms to mobile from tomcatserver using java code? Please provide the code snippet.
    Thanks in advance.

    Yes, but something needs to send that message. You can't just take an arbitrary computer and send an SMS, it does not have the hardware to do that.
    So either you have a mobile through which you do that or more likely - you use some sort of online service to do it. Whatever choice you make will determine what code you will have to write to get it done. Nobody is going to deliver the code to you, that's your job. It is also your job to figure out what service you are going to use.

  • How TO DEPLOY JAR FILES INTO XI Server using SDM

    Hi XI Gurus,
       im working on adapter development. we have created jar file in NWDS.
       now going ahead to deploy into XI server through SDM.
       can we deploy jar files directly into xiserver through SDM. or it needs to convert to any other formate like EAR, SDA. then how would i convert to SDA.
      i any have clear idea on this... pls throw the ways how to convert........
               JAR File to EAR format
               JAR file to SDA format
               EAR file to SDA format         
       can any one explain the procedure step by step how to convert jar file into deployment archive file in order to succesfully into XI server.
              thanks  i advance. points will be rewarded.
      Regards
      Rajesh

    Hi Rajesh,
    JAR file in itself in not deployable.
    So v need to envelop this jar file into an EAR file and then v deploy this EAR file on SDM.
    Creating Jar
    Inside NWDS --> Windows --> Open perspective --> J2EE Development --> right click on ur proj --> Build EJB Archive
    Converting .EAR file to .SDA
    Converting .EAR file to .SDA
    Regards,
    Prateek

  • How to import .jar files in order to use the classes within this file

    hello guys,
    I'm just wondering how can i import .jar files in order to uses the classes within this file.
    let's take an example:
    i have a folder in which I have many .jar files which contain classes to be called. the full path of this folder is set in the Classpath inside the enviroment variables.
    so does anyone have any idea how can i import these .jar files so i can use the classes?
    thank you.

    Hi,
    My problem is that: I created a Serializable class in a project. And I added this project (first project) to another project (second project). First project is appearing in the second project' s Libraries folder. No problem. I want to create a jar file from second project. i.e. I want to Build second project (I use NetBeans IDE). I am using Build Main Project tab under Run. It is falling out. I am finding it second project' s jar file under its folder. I am clicking on it. But it is NOT WORKING. Do you know WHY. Could you help me please?
    Thanks,

  • How to detlete  .jpg file  from perticular folder  in java code

    As part of my programming java & jsp code logic i want to delete some *.jpg photos from perticular path in flder.can any body help how to delte the photo using java code logic.

    File inFile = new File("C:\\folder\\file.tif"); //this should not be hardcoded
    inFile.delete();

  • How to get MAC address using java code

    hi friends
    please write me, How can I get MAC Address of local machine using java code.I don't want to use JNI.
    Please reply me. Its urgent for me
    Thanks in advance
    US

    You have several ways under *nix
    ifconfig -a | grep HWwill output something like
    eth0      Lien encap:Ethernet  HWaddr 00:11:FF:74:FF:B4combined with Runtime.getRuntime().exec("")and Process.getInputStream()you should be able to read it easilly.
    Under Windows (and Linux of course) try jpcap (http://sourceforge.net/projects/jpcap)
    You can also use jnative as a generic tool (http://sourceforge.net/projects/jnative)
    --Marc (http://jnative.sf.net)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to dynamically configure JPA setting at runtime using java code?

    Hi,
    I am new to EJB 3.0 and JPA. I am trying to help my company to deploy the use of JPA in EJB3.0. Currently, i am trying out with OpenJPA in IBM Webshpere Application Server 7.0. We have four different WAS servers running for testing, system integration testing, user testing and production respectively, and in each region, the configurations for data source, JDBC username and password, schema, etc are different. So i think i would need to configure the JPA setting during runtime using Java code that determines which is the environment. And apparently i am stuck with the limited knowledge i have.
    1) I understand that i could override the JDBC in the persistence xml by creating entity manager using entity manager factory. But is it possible that i do similar thing by using inejction of persistence context on entity manager to obtain a container managed entity manager?
    2) Alternatively, it is possible to create multiple persistence unit in the XML and inject different PU to the entity manager, am i right? But how to inject dynamically since @PersistenceContext(unitName="xxx") only accepts constant declaration.
    3) Is it possible that the JDBC username and password are read from properties file?
    Thanks for your help in advance!

    Hi
    Thanks for the reply.
    Are you saying that i have to configure the data source authentication to the backend DB2 using the JAAS-J2C? Correct me if i am mistaken. I guess i am unable to do so as the application server setup only contains one data source, and the server hosted a number of applications. Every applications has their own JDBC username and password supply to the data source (the ID supplied at the DB2 side will decide which resource can access) and thus, i have to supply the username and password at runtime. Talked to the server guy and seems that it is not feasible to have seperate datasource for each applications as considered to the volume of applications hosted inside the server.
    Any suggestion?

  • How can a jar file is download and used on client automatically from server

    i am using JAI.jar(sun jar file),tiffimage.jar(my jar file) and some fonts(Hindi) on the client side in my project.can we download and use the above files from the server on the client side automatically without the client installation.
    please reply me as soon as possible

    you can use Java Web Start to load all the jar files. JDK 1.4.1 is come with Java web Start.

  • JAR file isn't found using java -cp

    Hi all!
    This works:
    META-INF/MANIFEST.MF:
    Manifest-Version: 1.0
    Class-Path: TSA.JAR
    Main-Class: p.Start
    -which makes my jar file executable (as expected)
    I need to be able to make changes in the classpath though, so I can change TSA.JAR to e.g. TSA2.JAR, TSA3.JAR etc. This should be obtainable by using the java -cp option, but this doesn't seem to work:
    First, I delete the Class-Path line in the MANIFEST.MF file. Then I invoke java -cp TSA.JAR -jar MyProg.Startjava sais it cannot find some file contained in the TSA.JAR file.
    What's happening? Why aren't the resources in the TSA.JAR file located? Does java expect to find Class-Path in the MANIFEST.MF file, and since it's not located it expects no classpath is set (even though specified by the -cp option) ??

    Ok, I found this:
    http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4356783
    -which states that when using the -jar option, all other classpaths are ignored. Just as all the authors of the numerous replies, I agree that this behaviour is too restrictive. The thread is worth browsing if you got 5 minutes to spare.
    I solved my problem by not using the -jar option, but just to specify all involving resources by use of -cp option:
    java -cp TSA.JAR;MyJar.JAR MyProg.Start

  • How to read/write text file to db2 by using java code

    Hai
    I created the table to insert a clob data as follows
    db2 => create table ctest(datas clob(65536))
    DB20000I The SQL command completed successfully.
    db2 => describe table ctest
    Column Type Type
    name schema name Length Scale Nulls
    DATAS SYSIBM CLOB 65536 0 Yes
    1 record(s) selected.
    I tried the following java code to insert a clob data.
    public static synchronized Connection getConnection() throws Exception {
    Connection m_connectionDatabase = null;
    try {
    Class.forName("COM.ibm.db2.jdbc.app.DB2Driver");
    // Get the connection to the database.
    m_connectionDatabase = DriverManager.getConnection(
    "jdbc b2 ps","","");
    }catch (Exception e) {
    throw new Exception("Failed to connect to the database. ", e);
    return m_connectionDatabase;
    public static void main(String a[]) {
    File file = new File("d:\\a.txt");
    InputStream fis = new FileInputStream(file);
    Connection con = getConnection();
    PreparedStatement pstmt = con.prepareStatement("insert into ctest values(?)");
    //try 1
    pstmt.setAsciiStream(1,fis,(int)file.length());
    // try 2
    pstmt.setCharacterStream(1,fis,(int)(file.length()));
    // try 3
    pstmt.setBinaryStream(1,fis,(int)(file.length()));
    // try 4
    byte[] b = new byte[fis.available()];
    fis.read(b);
    pstmt.setBytes(1, b);
    // try 5
    byte[] b = new byte[fis.available()];
    fis.read(b);
    pstmt.setString(1, new String(b));
    pstmt.executeUpdate();
    pstmt.close();
    fis.close();
    Result:
    If the file size is less than 32kb, it inserted successfully.
    but if more than 32kb, it throws follwing exception
    COM.ibm.db2.jdbc.DB2Exception: [IBM][CLI Driver][DB2/NT] SQL0352N An unsupported SQLTYPE was encountered in position "1" of the input list (SQLDA). SQLSTATE=56084
    at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(Unknown Source)
    at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.throw_SQLException(Unknown Source)
    at COM.ibm.db2.jdbc.app.SQLExceptionGenerator.check_return_code(Unknown Source)
    at COM.ibm.db2.jdbc.app.DB2PreparedStatement.loadParameters(Unknown Source)
    at COM.ibm.db2.jdbc.app.DB2PreparedStatement.execute2(Unknown Source)
    at COM.ibm.db2.jdbc.app.DB2PreparedStatement.executeUpdate(Unknown Source)
    Can any body please help out to insert clob value.
    Thanks in advance
    V.Shan

    Normally I would be happy to help you, but after several years of trying to help here, I've decided not to contribute anymore because of the piss-poor way in which this site is being administered.
    Others are still helping, but more may leave if things don't improve. May I recommend devshed or javaranch?
    http://www.devshed.com/
    http://www.javaranch.com/
    If you would like to complain to the admins of this forum, either click the "Report Abuse" link or the "Feedback" link.
    -- foofoo (shamelessly stolen the text from jverd).

  • How to add DTD syntax line into XML using java code

    Hi,
    I am building xml file with java, usiing document.createElement()
    and document.appendChild(element),
    like that
    now i need to add dtd file path and synatx in the top of the xml file,
    how can i do it through java code
    any body could help me
    i appreciate your help.
    thanks
    Durga

    Hi Suneetha,
    Thanks for your reply..
    Now i am getting docType in xml file but not in the format of what i want
    please look at my code
    i need
    <!DOCTYPE myRootElement SYSTEM "myXMLDTD.dtd" >
    but i am getting
    <!DOCTYPE myRootElement PUBLIC "" "myXMLDTD.dtd">
    There is change i need to get the SYSTEM in place of PUBLIC and i need to get rid of "" code between dtd and PUBLIC
    for this i am doing in my code as
    DocumentType theDocType = new DocumentImpl().createDocumentType ("SYSTEM","","myXMLDTD.dtd");
    Document theDoc = new DocumentImpl(theDocType);
    i dn't know what is the wrong ? i dn't know what are the parameters at what place to pass if you know any thing just let me know
    thanks in advance
    and i apperciate you help.
    Durga

  • PRINTING  A .tif FILE  TO THE PRINTER USING JAVA CODE

    I WROTE A CODE FOR PRINTING THE FILE .ITS PRINTING ALL FORMAT ,BUT WHEN I GIVE THE EXTENSION AS .tiff ,IT SHOWS IN A POP-UP THAT "PRINNTING FAILED"
    CAN ANYONE SEND ME THE CODE FOR PRINTING .tif FILE?

    AMARSHI wrote:
    I WROTE A CODE FOR PRINTING THE FILE .ITS PRINTING ALL FORMAT ,BUT WHEN I GIVE THE EXTENSION AS .tiff ,IT SHOWS IN A POP-UP THAT "PRINNTING FAILED"
    CAN ANYONE SEND ME THE CODE FOR PRINTING .tif FILE?YOU CANNOT PRINT A TIFF DIRECTLY FROM JAVA SINCE IT WILL NOT LOAD A TIFF!!! YOU HAVE TO USE JAVA ADVANCED IMAGINING TO GET THE FILE TO LOAD AND THERE ARE EXAMPLES ON HOW TO DO THAT IN THE JAI LIBRAIRY. ONCE YOU CAN GET THE TIFF TO LOAD YOU CAN USE WHAT EVER YOU HAVE NOW TO PRINT IT, THERE ISN'T ANY MAGIC, YOU JUST HAVE TO HAVE THE IMAGE LOADED FIRST.

  • How to store the data read from excel using java code in Ms access database

    Hi. I wrote a code to read the data from excel. May i know how can i save it to Ms access database using java. Also i have many excels. So i should not connect the database using DSN. So is there any other way to achieve this?

    kramish wrote:
    Im pretty sure that Access does support JDBCNo it does not. It supports ODBC.
    just doing a quick Google came up with some pages:
    http://blog.taragana.com/index.php/archive/access-microsoft-access-database-from-java-using-jdbc-odbc-bridge-sample-code/
    http://www.javaworld.com/javaworld/javaqa/2000-09/03-qa-0922-access.html
    Both articles explains how to use the jdbc-odbc bridge. I think I've seen a pure jdbc driver for access but it wasn't from Microsoft and it wasn't free.
    Kaj

  • How to read a file in another location using Java ?

    Hi all,
    i suppose the below code reads my file 'ridata.dat' when it is in the same folder as my java class file.
    How can i read it from a different location?
    ---------------------------------------------------------------FileRead.java---------------------------------------------------------------
    import java.io.*;
    class FileRead
    public static void main(String args[])
    try{
    // Open the file that is the first
    // command line parameter
    FileInputStream fstream = new FileInputStream("ridata.dat");
    // Get the object of DataInputStream
    DataInputStream in = new DataInputStream(fstream);
    BufferedReader br = new BufferedReader(new InputStreamReader(in));
    String strLine;
    //Read File Line By Line
    while ((strLine = br.readLine()) != null) {
    // Print the content on the console
    System.out.println (strLine);
    //Close the input stream
    in.close();
    }catch (Exception e){//Catch exception if any
    System.err.println("Error: " + e.getMessage());
    ---------------------------------------------------------------FileRead.java---------------------------------------------------------------
    Thanks in Advance,
    Lakshma

    Try with JFileChooser
                   JFileChooser fileChooser = new JFileChooser();
                   int returnValue = fileChooser.showOpenDialog(null);
                   if (returnValue == JFileChooser.APPROVE_OPTION) {
                        File selectedFile = fileChooser.getSelectedFile();
                        System.out.println(selectedFile.getName());
                   }Thanks,
    Avin

Maybe you are looking for

  • Logic Pro 8 gives me an error every time I shut it down

    Every time I shut down Logic Pro 8 I get an error message that says something like "Logic Pro crashed...". It DIDN'T crash, I shut it down. Is there something I should be doing BEFORE I shut it down? I do the normal stuff, like save things & then jus

  • Font rendering differences between Xfce and KDE

    Hi, I am using both KDE and Xfce (mostly Xfce with KDE apps) and I observed that there is a font rendering difference between Gtk (Xfce) and QT (KDE) apps. In both desktop environments I use dejavu sans font, size 9 and I have set RGB subpixel render

  • HT1600 can you download apps to apple tv

    can you buy apps for apple tv like the channels on a roku?

  • Pricing Structure Question

    This is our customers website (BC hosted): http://www.originaltwisles.com/twis-les-8-ft  On the website we have set up 5 cords for $40.00.  That only works if a person buys 5 of the same color.  If they buy, for example, 2 red and 3 blue then they wo

  • How can sync Contacts on My Mac with my Icloud Contacts?

    Does anyone know how can set up a sync between "Contacts on My Mac" and my "Icloud Contacts"?  I am looking to get a complete copy in both locations.  Is there a way to do it in the OS or any reliable third party software?  Any help is much appreciat