How Can I execute a java program using java code?

{color:#000000}Hello,
i am in great trouble someone please help me. i want to execute java program through java code i have compiled the java class using Compiler API now i want to execute this Class file through java code please help me, thanks in advance
{color}

Thanks Manko.
i think my question was not clear enough.. actually i want to run this class using some java code . like any IDE would do i am making a text editor for java, as my term project i have been able to complie the code usign compiler api and it genertaes the class file but now i want to run this class file "THROUGH JAVA CODE" instead of using Java command. I want to achive it programatically. do you have any idea about it.. thanks in advance

Similar Messages

  • How can i execute codedui scripts by using dll

    how Can I Execute Coded UI scripts by using the DLL from anywhere after creating the build 

    Hi yellesh,
    If you mean that you want to run your test with bat file, as far as I know, we could call the MSTEST command line.
    set mstestPath="C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE"
    %mstestpath%\mstest /testcontainer:AutomatedUITest.dll  /resultsfile:TestOutput.trx
    Reference:
    https://social.msdn.microsoft.com/Forums/en-US/29af65b3-598b-4205-80e6-35b942113f3b/how-to-run-coded-ui-scripts-trhu-bat-file?forum=vsautotest
    https://social.msdn.microsoft.com/Forums/en-US/42a5d8f2-fe58-4133-b09d-28fa0553ab1a/run-coded-ui-test-in-certain-moment-in-future?forum=vsautotest
    Best Regards,
    Jack
    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click
    HERE to participate the survey.

  • How Can I Submit A Concurrent Program Using Form Personalizaton?

    How can I submit a concurrent program? Please help!
    Thanks in advance
    PhuTri

    I think the problem in your case coould be that the Concurrent Program you are trying to run has not been registered in the responsibility from which you are runnig it.
    For eg. You are trying to run a program from Inventory Super User responsibility and the request group attached to the responsibility is say 'RG Inventory', but the concurrent program which you are trying to run from your inventory super user responsibility is registered under some other request group say 'RG Order Mangement' which is not attached to the nventory responsibility.
    So register the program under correct request group and see if this helps you.
    Other possibility is that check if you have permission to submit request from that responsibility. You can check this by going to the Menu ->View If the Request menu is disabled then you cannot submit the request.

  • How can I execute an external program from within a button's event handler?

    I am using Tomcat ApacheTomcat 6.0.16 with Netbeans 6.1 (with the latest JDK/J2EE)
    I need to execute external programs from an event handler for a button on a JSF page (the program is compiled, and extremely fast compared both to plain java and especially stored procedures written in SQL).
    I tried what I'd do in a standalone program (as shown in the appended code), but it didn't work. Instead I received text saying the program couldn't be found. This error message comes even if I try the Windows command "dir". I thought with 'dir' I'd at least get the contents of the current working directory. :-(
    I can probably get by with cgi on Apache's httpd server (or, I understand tomcat supports cgi, but I have yet to get that to work either), but whatever I do I need to be able to do it from within the button's event handler. And if I resort to cgi, I must be able to maintain session jumping from one server to the other and back.
    So, then, how can I do this?
    Thanks
    Ted
    NB: The programs that I need to run do NOT take input from the user. Rather, my code in the web application processes user selections from selection controls, and a couple field controls, sanitizes the inoputs and places clean, safe data in a MySQL database, and then the external program I need to run gets safe data from the database, does some heavy duty number crunching, and puts the output data into the database. They are well insulated from mischeif.
    NB: In the following array_function_test.pl was placed in the same folder as the web application's jsp pages, (and I'd tried WEB-INF - with the same result), and I DID see the file in the application's war file.
            try {
                java.lang.ProcessBuilder pn = new java.lang.ProcessBuilder("array_function_test.pl");
                //pn.directory(new java.io.File("K:\\work"));
                java.lang.Process pr = pn.start();
                java.io.BufferedInputStream bis = (java.io.BufferedInputStream)pr.getInputStream();
                String tmp = new String("");
                byte b[] = new byte[1000];
                int i = 0;
                while (i != -1) {
                    bis.read(b);
                    tmp += new String(b);
                getSelectionsDisplayTextArea().setText(getSelectionsDisplayTextArea().getText() + "\n\n" + tmp);
            } catch (java.io.IOException ex) {
                getSelectionsDisplayTextArea().setText(getSelectionsDisplayTextArea().getText() + "\n\n" + ex.getMessage());
            }

    Hi Fonsi!
    One way to execute an external program is to use the System Exec.vi. You find it in the functions pallet under Communication.
    /Thomas

  • How can i login to a website using java

    hi,
    i tried to write a java program to which will take username and password and login to a given site. but some how its not working. i am actually trying to login to the follwoing website:
    https://roundup.ffmpeg.org/roundup/ffmpeg/
    can anyone provide some example program to login to this website.
    br
    mahbubul-syeed

    Hi,
    i am really sorry... but i am new in this forum and i did not know this. here is my code that i have written. it did not show any error and displays the content of the page but did not logged in. please give your comment.. i badly need a solution.
    package myUtility_files;
    import java.net.*;
    import java.io.*;
    public class LogInByHttpPost {
         //private static final String POST_CONTENT_TYPE = "application/x-www-form-urlencoded";
    private static final String LOGIN_ACTION_NAME = "submit";
    private static final String LOGIN_USER_NAME_PARAMETER_NAME = "__login_name";
    private static final String LOGIN_PASSWORD_PARAMETER_NAME = "__login_password";
    private static final String LOGIN_USER_NAME = "mahbubul";
    private static final String LOGIN_PASSWORD = "mahbubul007";
    private static final String TARGET_URL = "http://roundup.ffmpeg.org/roundup/ffmpeg/";
    public static void main (String args[])
    LogInByHttpPost httpUrlBasicAuthentication = new LogInByHttpPost();
    httpUrlBasicAuthentication.httpPostLogin();
    public void httpPostLogin ()
    try
    // Prepare the content to be written
    // throws UnsupportedEncodingException
    String urlEncodedContent = preparePostContent(LOGIN_USER_NAME, LOGIN_PASSWORD);
    HttpURLConnection urlConnection = doHttpPost(TARGET_URL, urlEncodedContent);
    //String response = readResponse(urlConnection);
    System.out.println("Successfully made the HTPP POST.");
    //System.out.println("Recevied response is: '/n" + response + "'");
    BufferedReader in = new BufferedReader(new InputStreamReader(urlConnection.getInputStream()));
                   String inputLine;
                   while ((inputLine = in.readLine()) != null)
                        System.out.println(inputLine);
    catch(IOException ioException)
         ioException.printStackTrace();
    System.out.println("Problems encounterd.");
    private String preparePostContent(String loginUserName, String loginPassword) throws UnsupportedEncodingException
    // Encode the user name and password to UTF-8 encoding standard
    // throws UnsupportedEncodingException
    String encodedLoginUserName = URLEncoder.encode(loginUserName, "UTF-8");
    String encodedLoginPassword = URLEncoder.encode(loginPassword, "UTF-8");
    String content = "login=" + LOGIN_ACTION_NAME +" &" + LOGIN_USER_NAME_PARAMETER_NAME +"="
    + encodedLoginUserName + "&" + LOGIN_PASSWORD_PARAMETER_NAME + "=" + encodedLoginPassword;
    return content;
    public HttpURLConnection doHttpPost(String targetUrl, String content) throws IOException
    HttpURLConnection urlConnection = null;
    DataOutputStream dataOutputStream = null;
    try
    // Open a connection to the target URL
    // throws IOException
    urlConnection = (HttpURLConnection)(new URL(targetUrl).openConnection());
    // Specifying that we intend to use this connection for input
    urlConnection.setDoInput(true);
    // Specifying that we intend to use this connection for output
    urlConnection.setDoOutput(true);
    // Specifying the content type of our post
    //urlConnection.setRequestProperty("Content-Type", POST_CONTENT_TYPE);
    // Specifying the method of HTTP request which is POST
    // throws ProtocolException
    urlConnection.setRequestMethod("POST");
    // Prepare an output stream for writing data to the HTTP connection
    // throws IOException
    dataOutputStream = new DataOutputStream(urlConnection.getOutputStream());
    // throws IOException
    dataOutputStream.writeBytes(content);
    dataOutputStream.flush();
    dataOutputStream.close();
    return urlConnection;
    catch(IOException ioException)
    System.out.println("I/O problems while trying to do a HTTP post.");
    ioException.printStackTrace();
    // Good practice: clean up the connections and streams
    // to free up any resources if possible
    if (dataOutputStream != null)
    try
    dataOutputStream.close();
    catch(Throwable ignore)
    // Cannot do anything about problems while
    // trying to clean up. Just ignore
    if (urlConnection != null)
    urlConnection.disconnect();
    // throw the exception so that the caller is aware that
    // there was some problems
    throw ioException;
    br
    mahbubul-syeed
    Edited by: mahbubul-syeed on Jun 11, 2009 5:07 AM

  • How can i execute multiple database operations using multiple objects

    i have data in files which i need to read/parse and insert/update the database. can someone tell me how can i read multiple statements at a time and process using multiple objects.

    This doesn't seem like too much of a JDBC question or at least the answer as I see it isn't unique or specific to JDBC.
    If you want to run multiple processes within your single program then you need to use Java threads. I would recommend you read up on how to properly code Java threads and if you have questions unique to your multi-threaded JDBC implementation come back and ask those questions.
    You may also want tot take advantage of a transaction manager that includes a database connection pool that will handle most of the complexity for you. Depending on the flexibility of your architecture you may not have to do any thread coding at all when using a transaction manager.

  • How can i digital sign a file using JAVA?

    and how can i verify the digitially signed file was not altered by anyone using JAVA?
    please provide me with the simpliest way to do this.
    thanks a lot.

    I have no idea but you might want to take a look at :
    http://java.sun.com/j2se/1.5.0/docs/guide/security/index.html
    hth

  • How can an email account be created using Java mail on the FLY.

    Scenario is such that i am using mail server from MDaemon.com and JavaMail api,and making Email website like yahoo...some what ! but how can a user create his account by just filling the form and when he enters his account be created in Mail server..

    Last time I checked MDaemon has its own API for account management. I have never tried to do anything with it but their sales literature says it exists.
    Account management will be specific to the platform and mail server software. This is beyond the scope of JavaMail which is for message transport (and management to an extent on IMAP servers), not account management on the server.
    The other alternative is to write your own application that modifies the structures used by mdaemon but since it already has an API why bother.

  • How Can I execute an external program from my vi?

    Hi guys,
    I want to execute a external program to use it when i called with a bottom. I want push a bottom and execute the program, like acess direct icon or so.
    Any help?.

    Hi Fonsi!
    One way to execute an external program is to use the System Exec.vi. You find it in the functions pallet under Communication.
    /Thomas

  • How can I open/save .xlsx file using java

    Hi
    I have a jsp whose contenttype of response is application/vnd.ms-excel.
    When I am saving the file as .xlsx and opening from disk it displays error message.
    How can I save and/or open the file as .xlsx?
    Any advice will be appreciated.
    Thanks
    Rohini Kumar J

    sunshine_vennela wrote:
    I have a jsp whose contenttype of response is application/vnd.ms-excel.That's not the way to create excel files. You're just creating a plain vanilla HTML file and fooling the browser with a wrong content type.
    Checkout the Apache POI XSSF API or the OpenXML4J API's to create xlsx files and use a servlet to write it to the outputstream.

  • How can I get selected EXCEL area using java script office API (v 1.0)

    Hello everyone,
    I need to get values of specified area in an excel sheet using java Script Office API. For an example,
    A1:A7 row load into array using JS. 

    And you posted to a C++ forum, not a JavaScript or Excel forum.... why? 
    Visual C++ MVP

  • How can I connect to a database using Java Web Start?

    When I run the application without Java Web Start, the program can get the driver and connect to the database. However, when I try to use this same application with Java Web Start, the program can not load the driver. Why is this happening? I am using a mySql database driver.

    I assume you are trying to connect using JDBC, are did you include the jdbc jar in your resources ?

  • How can i send the chinese sms using java J2EE(web application)

    hi,
    i have the difficulty on sending chinese sms using J2EE application.i try to input the chinese word to jsp and send the plain text sms. i received the sms with plenty of question mark "?????". i think it is regarding to the conversion of String to some kind of format that supported by mobile phone. below are some code the send the sms to recipient. i need someone help in order to have the solution.
    thanks a lot
    <%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8"%>
    <%@ page import="se.sapio.rta.service.MPMService"%>
    <%@ page import="java.util.Locale"%>
    <%
         Locale.setDefault(Locale.UK);
         Context ctx;
         MPMService mpmservice;
         ctx = new InitialContext();
         mpmservice = (MPMService) ctx.lookup("BC/Service/RTAMPM");
         LSUser user = null;
         boolean ok = true;
         try {
         if (ok) {
              String sender = request.getParameter("sender");
              String phonenr = request.getParameter("phonenr");
              String sendmsg = request.getParameter("sendmsg");
              if(bError) {
                   byte[] bytes = message.getBytes("UTF-8");
                   message = mobileclientservice.ByteEncode(bytes);          
                   response.sendRedirect("send_sms.jsp?s="+request.getParameter("s")+"&msg="+message+"&phonenr="+request.getParameter("phonenr").replaceAll("\\+","%2B")+"&sender="+request.getParameter("sender")+"&sendmsg="+request.getParameter("sendmsg").replaceAll("\\+","%2B"));
              String resp = "";
              if(mpmservice.sendPlainTextSMS(sender, phonenr, sendmsg)) {
                   resp=mpmservice.getLang(user.getLang(), "sms_sent");
              } else {
                   resp=mpmservice.getLang(user.getLang(), "sms_not_sent");
              } %>
              <jsp:include page="/top.jsp" />
              <p class="headline"><%=mpmservice.getLang(user.getLang(), "send_sms_title")%></p>
              <form name="operatordetails" id="operatordetails" method="post" action="send_sms.jsp">
              <INPUT TYPE=hidden NAME=s VALUE="<%=request.getParameter("s")%>">
              <INPUT TYPE=hidden NAME=phonenr VALUE="<%=request.getParameter("phonenr")%>">
              <table class="infotable" id="report">
                   <tr>
                        <td class="left" colspan="2"><%=resp%></td>
                        <td class="right"></td>
                   </tr>
                   <tr>
                        <td class="left" colspan="2">
                             <input class="halfmiddle" name="Back" type="submit" id="Back" value="<%=mpmservice.getLang(user.getLang(), "back")%>" />
                        </td>     
                        <td class="right"> </td>
                   </tr>
              </table>
              </form>
              <jsp:include page="/bottom.jsp" />
         <% } %>
       public boolean sendPlainTextSMS(String sender, String recipient, String sendmsg){
             if(recipient.charAt(0) == '+')
                   recipient = recipient.substring(1);
             String senderIdType = "Alpha";
              if( (sender.charAt(0) >= '0' && sender.charAt(0) <= '9') || sender.charAt(0) == '+')
                   senderIdType = "Numeric";
                   if(sender.charAt(0) == '+')
                        sender = sender.substring(1);
                   for(int i=0; i < sender.length(); i++)
                        if(!(sender.charAt(i) >= '0' && sender.charAt(i) <= '9'))
                             senderIdType = "Alpha";
             log.warn("sending sms to: "+recipient + " sendtype: " + senderIdType + " msg: "+ sendmsg);
             log.warn("Encoded sms:"+Encode(sendmsg));
             try{
             String postData = "XMLDATA=" + URLEncoder.encode("<?xml version=\"1.0\" encoding=\"ISO-8859-1\" ?>\r\n" +
                        "<NotificationRequest Version=\"3.4\">\r\n" +
                        "     <NotificationHeader>\r\n" +
                        "          <PartnerName>" + SMS_PARTNER_NAME + "</PartnerName>\r\n" +
                        "          <PartnerPassword>" + SMS_PARTNER_PASSWORD + "</PartnerPassword>\r\n" +
                        "          <SubscriptionName>XML</SubscriptionName>\r\n" +
                        "     </NotificationHeader>\r\n" +
                        "     <NotificationList BatchID=\"1\">\r\n" +
                        "          <Notification SequenceNumber=\"0\" MessageType=\"SMS\">\r\n" +
                        "          <Message>" + Encode(sendmsg) + "</Message>\r\n" +
                        "          <Profile>" + SMS_PARTNER_PROFILE + "</Profile>\r\n" +
                        "          <SenderID Type=\"" + senderIdType + "\">" + sender + "</SenderID>\r\n" +
                        "          <Subscriber>\r\n" +
                        "               <SubscriberNumber>" + recipient + "</SubscriberNumber>\r\n" +
                        "          </Subscriber>\r\n" +
                        "      </Notification>\r\n" +
                        " </NotificationList>\r\n" +
                        "</NotificationRequest>","ISO-8859-1");
      appreciate for anyone provide the solution.
    thanks a lot

    Hi,
    I want to send sms from web application to mobile phones at the time of registration. Its verymuch greatful to me, if you let me know, how to send from jsp to mobile. because from your post, i got, you already know about sending sms from jsp to mobile.
    please let me know, how to send sms
    [email protected]
    Thanks in advance for your kind help

  • How can i purchase apple developer program using my Payoneer Debit Card

    I want to purchase Apple Developer Program by using my Payoneer Debit card. Is it possible. I cant find any option to add Payoneer Card.

    In countries where the iTunes Store only sells apps, the accepted payment methods are Visa, MasterCard, and American Express. Other payment types such as gift cards, store credit, monthly allowances, ClickandBuy, and PayPal are not accepted. Depending on your App Store country, prices may be listed in your local currency, US Dollars, or Euros.    http://support.apple.com/kb/HT5552

  • How can i rename a jar file using only java code

    i have tried everything i can think of to accomplish this but nothing works.

    ghostbust555 wrote:
    In case you geniuses haven't realized I said I tried everything I can think of not that I tried everything. So help or shut up I realize that I didn't try everything but if you can't figure it out either DO NOT POST.
    And the question is how can i rename a jar file using java code? As it says in the title. Read.I would tell you to use the File.renameTo method, but surely that would have been obvious, and you would have tried it already? But maybe you didn't. You were kind of lacking in details in what you tried.
    And yes, I am a genius. Just don't confuse "genius" with "mind-reader".

Maybe you are looking for

  • How to allow multiple domains under Access-Control-Allow-Origin

    Hi, We have a domain where will get CORS request from another domain hosted on seperate DC. We can't set Access-Control-Allow-Origin as * due to security concerns & IIS can't take more than 1 value at a time. Kindly suggest how to pass multiple httph

  • Date Parameters in Stock Aging Report

    Dear Experts, Can anybody help me how to include the date paramaeters like FromDate and ToDate in the below query. I need the Stock againg in b/w two dates. SELECT distinct T0.ITEMCODE , T1.[ItemName], T0.WhsCode , T0.ONHAND as 'Total Qty',  CASE WHE

  • AS3: Customising the Flash List/Datagrid Components to add check

    Hi all I'm creating a large app in Flash AS3. I want to display a list of names in a List component. When the user clicks on the name, I would like the list to split and reveal the phone numbers associated with this person (work, mobile etc), with a

  • Blob to base64 encoded XML

    Hi, We have a table with two columns (Name varchar2, Picture Blob). How do we get XML output containing rows from table, with Picture (blob column) being base64 encoded. Note: I have tried using utl_encode.base64_encode, but getting error due to larg

  • Probelm with crop tool

    Suddenly when I try to crop, the crop area is properly defined but when I click "crop" the image is grayed out and in the lower right hand corner it tells me that the image size is 3/0 bytes. this happens to nay image since the first time it happened