How to call gnuplot command from java

Hi there,
In our course, we are required to develop an GUI for gnuplot. In case you don't know about gnuplot, it's a plotting program and has lots of command. We want to use java and swing, but now we don't know how to call gnuplot command from java, or how to execute a shell command(script) from java.
By the way, since we need read in files with several columns of data and allow user to select a column, we want to use JTable. Is that reasonable?
Thanks a lot for any suggestions!
Jack

Hi, there:
Will using JTable add much overhead? I may have to use several JTables and switch among them. I can add scroll bar to or edit JTables, right?
BTW, do you have experience about gnuplot? Can I find the command tree of gnuplot somewhere? Or do you know a better place to post question about gnuplot? unix/linux group, maybe.
Thanks,
Jack
P.S. Would you guys answer my question after I use up my duke dollars? :- )

Similar Messages

  • How to execute Linux command from Java app.

    Hi all,
    Could anyone show me how to execute Linux command from Java app. For example, I have the need to execute the "ls" command from my Java app (which is running on the Linux machine), how should I write the codes?
    Thanks a lot,

    You can use "built-in" shell commands, you just need to invoke the shell and tell it to run the command. See the -c switch in the man page for your shell. But, "ls" isn't built-in anyays.
    If you use exec, you will want to set the directory with the dir argument to exec, or add it to the command or cmdarray. See the API for the variants of java.lang.Runtime.exec(). (If you're invoking it repeatedly, you can most likely modify a cmdarray more efficiently than having exec() decompose your command).
    You will also definitely want to save the returned Process and read the output from it (possibly stderr too and get an exit status). See API for java.lang.Process. Here's an example
    java.io.BufferedReader br =
    new java.io.BufferedReader(new java.io.InputStreamReader(
    Runtime.getRuntime().exec ("/sbin/ifconfig ppp0").
    getInputStream()));
    while ((s = br.readLine()) != null) {...                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

  • How to Call SQL Loader from Java ( servlet )?

    We need to call SQL Loader command from Java Servlets? Any suggestions how this can be done?
    Thanks
    Rahul

    Probably not the best way, but you could try using JNI to call a C function which then invokes SQL Loader via system() or exec(). I haven't done this myself though...

  • How to call external files from java?

    How to call external files in java. For example how to call a *.pdf file to open in its default editor(say Acrobat), or a *.html file to open in the default browser or a *.txt file in a notepad etc..,
    In my program i have *.chm (Compiled Windows HTML Help) help file. how to open it in its default editor it?

    Jayarathina_Madharasan wrote:
    no one answered my questionHi what wrong did i do...basically insulted all the volunteers here who took the time to consider your question and try to offer you help. Other than that, you did nothing wrong.
    From JavaRanch :
    And even if an answer doesn't solve your problem, even if it should totally miss the point - the best thing to do to motivate others to continue trying to help you is showing respect and gratitude for the investment of time that was put into dealing with your issue.
    Edited by: Encephalopathic on Apr 14, 2008 10:01 AM

  • How to run system commands from JAVA

    Hi Friends,
    How to run windows system commands from JAVA
    Runtime r=Runtime.getRuntime();
    r.exec("dir");
    Throwing following Exception
    CreateProcess :dir error=2
    Thanks in advance
    Hamsa

    Hi ,
    in Windows NT this is not possible, you can use the following :
    Runtime r=Runtime.getRuntime();
    StringBuffer sbuf = new StringBuffer();
    String dir = new String();
    java.lang.Process proc = r.exec("cmd /c dir");
    InputStream is = proc.getInputStream();
    int ch ;
    while((ch=is.read() ) != -1)
    sbuf.append((char)ch);
    is.close();
    dir = sbuf.toString();
    System.out.println(dir );

  • How to Call .XDO file From Java Program

    Hi,
    I have developed a report in using BI Publisher version 10.1.3.
    I created the report and it only created XDO files. If I want to call XDO file from Java program how I can do that.
    What are the APIs available to do that.
    Thanks
    -Ashutosh

    Hi,
    the JavaAPI didn't work with the xdo-Files. But you can create a proxy stub for the Web Service API of BI Publisher which uses the xdo's in the repository.
    regards
    Rainer

  • How to Call C++ Method from Java

    I need to call C++ method from Java.
    I have gone through the JNI tuorial , but was not able to pin point things.
    I read that :
    You have to write JNI c functions which then call your C++ member functions.You need to write a JNI function which will call new on your C++ class.
    Now i have java class :
    Java Code JavaClass.java ---->
    class JavaClass{
    public native void nativeMethod();
        static
            System.loadLibrary("NativeCppCode");
         private void callCppMethod()
              //call C++ method
                    JavaClass jvc = new JavaClass();
                    jvc.nativeMethod()
    }Cpp Code:
    NativeCppCode.h---->
    class NativeCppCode
    public:
        getValue();
        setValue();
    private:
       int a;
    JNIEXPORT void JNICALL Java_JavaClass_nativeMethod(JNIEnv *env
                   ,jobject obj);NativeCppCode.C---->
    NativeCppCode::getValue()
       return a;
    NativeCppCode::setValue()
       a = 1;
    JNIEXPORT void JNICALL Java_JavaClass_nativeMethod(JNIEnv *env
                   ,jobject obj)
    NativeCppCode* nativeInstabce = new NativeCppCode();
    NativeCppCode.setValue();
    }Is this the correct way to do it.
    Any suggestion would be a great help to me

    tryit wrote:
    I need to call C++ method from Java.Not possible.
    JNI uses C methods.
    Is this the correct way to do it.Same way you would do it in any C/C++ method (not java)
           MyClass* p = ....
           p->doit();
    Common idiom for the pointer in the above is to pass it back and forth to your java code as a java long. You cast it it and from your class pointer. Provide an explicit java method to free it when done. Besides providing the explicit method also implement a finalizer to free it as well (however that is a fail safe and should not be relied upon.)

  • How to Call a JSP from Java Script

    Hi,
    I want to call a jsp from Java Script.
    I am having IntelliJ IDEA 4.5 (IDE) and weblogic server.
    should i do anything on web.xml,weblogic.xml
    I have written one jsp, Java script.
    I want to call a jsp from Java script

    function submitf(){
    document.xyz.action ='ReportSave.jsp';
    document.xyz.method='POST';
    document.xyz.submit();
    <form name='xyz'>
    <input type='text' name='text1'>
    <input type='text' name='text2'>
    <input type='button' name='xx' value='submit' onclick= submitf()>
    </form>
    Is this what u want???
    Regards,
    RAHUL

  • How to call BPM process from Java

    Hi All,
    Can anybody help how to call a BPMN process from java.Please give any sample exaple on this.
    Thanks,
    Ganesh

    For 11g BPM please look at this post. Re: Getting while running the BPEL process from java
    It references an ATeam example app that can start processes from a web client. But the Java APIs are described too.

  • How to call c++ code from java

    i have a third party dll written in c++. I want to call its methods in java. I searched web and found that I have to use JNI for this. I have seen examples on web writing c++ code and then using it from java through JNI, but can anybody please point to me the example where i have a predefined library or dll in c++ and i have to call it in java. I think that I may have to declare methods in library as native in java and then write a wrapper implementation (dll) in c++ which actually calls the library or dll functions. But, then how will I call methods of dll from my wrapper code.
    Any examples, please point
    Regards,
    Farooq

    There's a JNI forum here that may be a better place for this question; though given the general nature of the question, I suspect that they'll refer you to a tutorial. good luck.

  • How to execute system command from java program

    Hi all,
    I want to change directory path and then execute bash and other unix commands from a java program. When I execute them separately, it's working. Even in different try-catch block it's working but when I try to incorporate both of them in same try-catch block, I am not able to execute the commands. The change directory command works but it won't show me the effects of the bash and other commands.
    Suggestions??

    The code I am using is....
    try
    String str="cd D:\\Test";
    Process p=Runtime.getRuntime().exec("cmd /c cd
    "+str);your str string is already having cd in it but again you ar giving cd as part of this command also please check this,i will suggest you to remove cd from str
    Process p1=Runtime.getRuntime().exec("cmd /c mkdir
    "+str+"\\test_folder");you should say mkdir once you change your path,but here you are saying mkdir first and then cd D:\Test(this is because of str)..please check this
    Process p2=Runtime.getRuntime().exec("cmd /c bash");
    Process p3=Runtime.getRuntime().exec("cmd /c echo
    himanshu>name.txt");
    catch(IOException e)
    System.err.println("Error on exec() method");
    e.printStackTrace();
    Message was edited by:
    ragas

  • How to execute MySqlDump Command from java..........

    hi friends,Iam used mysqldump command in linux platform to take backup of the database,its work properly....the command am used is
    mysqldump -u root -p threadpool > sampledatabase.sql
    I need to execute the same command in java....?Anyone here to know how to do that....?Thanks in advance........

    Crosspost:
    http://forum.java.sun.com/thread.jspa?threadID=5185230&messageID=9721722#9721722
    http://forum.java.sun.com/thread.jspa?threadID=5185199&messageID=9721587#9721587
    Do not mess the forum.

  • How to zip -r command from java

    Hi
    i was trying to run the zip -r command to zip a directory from java code in unix environmnt.But it was not giving me the zip result. I used runtime.execute method but it was giving me junk files and goes in infinite process.
    please help

    Sukant_at wrote:
    Hi
    i was trying to run the zip -r command to zip a directory from java code in unix environmnt.But it was not giving me the zip result. I used runtime.execute method but it was giving me junk files and goes in infinite process.
    You have one or more bugs.
    >
    please helpMy crystal ball does not work well at weekends so there is little I can do with the information currently available.
    P.S. Have you read the 4 sections of [http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html|http://www.javaworld.com/javaworld/jw-12-2000/jw-1229-traps.html] and implemented the recommendations?

  • How to call stored procedures from java program?

    I have tried to run a program that calls a stored procedure on MySQL
    server version 5.0.17 by using connector/j 5.0, but it always fails on the
    statement: con.preparecall() ,
    have looked on the internet and found out that people can all mysql
    stored procedure all right in their programs, really dont know what's
    wrong with this small peiece of code:
    import java.sql.*;
    public class TestDB {
          // procedure being called is:
         CREATE PROCEDURE `dbsaystorm`.`getsite` ()
         BEGIN
            select  name  from tblsite;
         END
         public static void main(String[] args) {
              try  {
                  //Class.forName("org.gjt.mm.mysql.Driver");
                  Class.forName("com.mysql.jdbc.Driver");
                  Connection con = DriverManager.getConnection("jdbc:mysql://localhost/dbname",
                            "user", "pwd");
           * executing SQL statement here gives perfect correct results:
            // PreparedStatement ps = con.prepareStatement("select name from tblsite");      
            // ResultSet rs =ps.executeQuery();
                  // but in stored procedure way...
                  //it fails here on this prepare call statement:             
                  CallableStatement proc = con.prepareCall("call getsite()");
                  ResultSet rs =proc.executeQuery();                      
                  if (rs == null) return;                                      
                  while (rs.next()){                 
                      System.out.println("site name is: "+ rs.getString(1));                                
                  rs.close();
              } catch (SQLException e) {e.printStackTrace();}
               catch (Exception e) {e.printStackTrace();}         
    }it always gives this exception:
    java.lang.NullPointerException
         at com.mysql.jdbc.StringUtils.indexOfIgnoreCaseRespectQuotes(StringUtils.java:959)
         at com.mysql.jdbc.DatabaseMetaData.getCallStmtParameterTypes(DatabaseMetaData.java:1280)
         at com.mysql.jdbc.DatabaseMetaData.getProcedureColumns(DatabaseMetaData.java:3668)
         at com.mysql.jdbc.CallableStatement.determineParameterTypes(CallableStatement.java:638)
         at com.mysql.jdbc.CallableStatement.<init>(CallableStatement.java:453)
         at com.mysql.jdbc.Connection.parseCallableStatement(Connection.java:4365)
         at com.mysql.jdbc.Connection.prepareCall(Connection.java:4439)
         at com.mysql.jdbc.Connection.prepareCall(Connection.java:4413)
         at saystorm.server.data.database.TestDB.main(TestDB.java:29)
    where have I gone wrong?
    when I commented out the statement that makes the procedure call and call preparedstatement to execute SQL select statement, it gave perfectly correct result.
    it looks like there is no problem with java prog accessing MYSQL server database, but the it seems that it's just java can't call stored procedure stored on the mysql server version 5.
    can it or can't it? if it can, how is that accomplished?

    It is a bug in the driver because it shouldn't be
    returning that exception (null pointer) even if you
    are doing something wrong.
    Are you using the latest version of the driver?
    The stored procedure runs when you run it from the
    gui/command line using a MySQL tool - correct?
    As suggested you should be using the brackets. What
    is the data type of the 'name' field?
    You could try returning another value like one of the
    following
    select 1, name from tblsite;
    select name, 1 from tblsite;
    That might get around the bug
    Additionally try just the following...
    select 'test' from tblsite;yes, the driver used is in connector/j 5.0--the lastest one, and the
    procedure can run correctedly at either command line or GUI mode
    with no problem whatsoever, the returned data type is string type,
    I have not got the chance to test it again with those values you
    suggested, as I have abandoned the laptop I used to write that code
    initately. There have been some other really weird cases happened on
    that computer. I guess that must be something wrong with the JVM
    installed on it, it was upgraded from jre5.0.04 to 06, and to 09.
    something within hte JVM must have been messed up(the only reasonable
    explanation). Because the same code runs correctly on my new laptop,
    using the same environment: jvm 5.0_09, mysql 5.0.18, connector/J 5.0.
    that old laptop really was a nightmare.

  • How to call TimesTen "command" from program

    I m trying to call command "dssize" from my java program.
    I can call any built in procedure with callable statement, but for "dssize" is not working. is that possible?
    Thank you and best regards.

    'dssize' is a ttIsql command and so cannot be called from an application. The information reported by dssize comes from various columns in the SYS.MONITOR table. All you need to do is SELECT those columns and use the values.
    Chris

Maybe you are looking for

  • HT1454 Can I connect my iPad to my tv with HDMI ?

    Can anyone tell me if I can connect my iPad 3 to my home tv using HDMI connection

  • Report Builder printing problem...

    HI all I created a report in Report Builder 6i When I print, it doesn't show printing dialog box for me to select printer or pages for printing And it prints all pages automatically. What may be reason? Thanks ...

  • Inconsistent WRT160N / WMP600N connectivity, drops.

    Hi, I installed a Linksys WRT160N router two days ago and am trying to get a desktop running Windows XP SP2 (+ WPA patch) to maintain a wireless connection to it, using a Linksys WMP600N card. I have NetZero DSL (it looks like they're leasing Verizon

  • Re-Installation and installation of Oracle 10g

    Hello I am a student currently doing a subject on how to use and develop databases, forms and reports in Oracle. My concern is with regard to the installation of Oracle I had previous partially installed Oracle and while using the Windows function to

  • Splitting System Copy on BI Dual stack

    Hi, We are planning to split Our BI Dual stack system. 1) To perform ABAP system copy through Oracle tools. 2) To perform Java system copy through Sapinst and them import in to the system copy performed in step 1. Could some one help me out, can we g