Problem with  JFrame (I'm thinking) from enother java program

Hi,
I'm using jasperReport and running viewReport from my java application.
JasperPrint jasperPrint = JasperFillManager.fillReport(
                         jasperReport, parameters, conn);
               JasperViewer.viewReport(jasperPrint, true);
My problem is when I'm closing the view report, my java aplication closing twe!
I think it's because the view frame sel exit(0)?
and one more question, if I run this viewReport from JButton in a JDIalog, the view location is under my dialog, how can I set this view to be allways on top??
Thanks alot :)

The following code is running without problems (SQLSERVER),and you can compared with yours.
public static Connection con;
     public  Statement sta;
     public ResultSet rst;
     public CallableStatement  cas = null;
     public int OutPut;
public void doProcedures(String str,Vector vec){
               try {
     String s=null;
                    con=null;
                    rst=null;
                    Class.forName("com.microsoft.jdbc.sqlserver.SQLServerDriver");
                                        con = DriverManager.getConnection(getConnectionString(), "sa","");               
                                     s=str;
                    s="{call"+" "+s+"(?,?,?)}";
                cas=con.prepareCall(s);
                   cas.registerOutParameter(1, java.sql.Types.INTEGER ); 
                   for(int i =0;i<vec.size();i++){                   
                  cas.setInt(i+2,Integer.parseInt ((String)vec.elementAt(i)));  
                   cas.execute() ;
                   OutPut =cas.getInt(1);
                   rst = cas.executeQuery();
                  // while(rst.next()){
                       // String output=rst.getString(1);
                   //rst.close() ;
               } catch (Exception e) {
                    e.printStackTrace();
Good Luck,baby!!!

Similar Messages

  • Problem with JFrame's dispose();

    Hello everyone,
    I'm having a problem with JFrame's dispose() method. In my program I have 2 classes which go into full screen. On each screen there is a button to switch to the other screen. The first time I push the button on both of them the other screen closes, which is what I want. However, if I push the same button more than twice - like by going from Screen1 to Screen2 and Screen2 to Screen1 and then Screen1 to Screen2 - I get 2 screens. If I keep doing that I eventually get 10+ screens up, which is bad. How do I prevent that?

    There's a lot of code, so I'll just post up the part that does it.
    backButton.addActionListener(new ActionListener()
                  public void actionPerformed(ActionEvent e)
                      soundManagerM.close();
                        new MenuScreen().setVisible(true);
                        dispose();
             });I don't think it opens up 2 at once, because it would play multiple music right?

  • Running curl command from a java program using Runtime.getRuntime.exec

    for some reason my curl command does not run when I run it from within my java program and errors out with "https protocol not supported". This same curl command however runs fine from any directory on my red hat linux system.
    To debug the problem, I printed my curl command from the java program before calling Runtime.getRuntime.exec command and then used this o/p to run from the command line and it runs fine.
    I am not using libcurl or anything else, I am running a simple curl command as a command line utility from inside a Java program.
    Any ideas on why this might be happening?

    thanks a lot for your response. The reason why I am using curl is because I need to use certificates and keys to gain access to the internal server. So I use curl "<url> --cert <path to the certificate>" --key "<path to the key>". If you don't mid could you please tell me which version of curl you are using.
    I am using 7.15 in my system.
    Below is the code which errors out.
    public int execCurlCmd(String command)
              String s = null;
              try {
                  // run the Unix "ps -ef" command
                     Process p = Runtime.getRuntime().exec(command);
                     BufferedReader stdInput = new BufferedReader(new
                          InputStreamReader(p.getInputStream()));
                     BufferedReader stdError = new BufferedReader(new
                          InputStreamReader(p.getErrorStream()));
                     // read the output from the command
                     System.out.println("Here is the standard output of the command:\n");
                     while ((s = stdInput.readLine()) != null) {
                         System.out.println(s);
                     // read any errors from the attempted command
                     System.out.println("Here is the standard error of the command (if any):\n");
                     while ((s = stdError.readLine()) != null) {
                         System.out.println(s);
                     return(0);
                 catch (IOException e) {
                     System.out.println("exception happened - here's what I know: ");
                     e.printStackTrace();
                     return(-1);
         }

  • Problem with:  select 'c' as X from dual

    Problem with 'select 'c' as X from dual'
    I get 2 different results when I execute the above with SQLPlus (or java) depending on the instance I am connected to. For one instance the result is a single character and for the other the character is padded with blanks to 32 chars in the SQLPlus window (and java). Does anyone know what database setting causes this to happen? Is it a version issue ?
    Test #1: Oracle 9.2.0.6 - SQLPlus result is padded with blanks
    SQL*Plus: Release 9.2.0.1.0 - Production on Mon Dec 10 09:27:58 2007
    Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
    Connected to:
    Oracle9i Enterprise Edition Release 9.2.0.6.0 - 64bit Production
    With the Partitioning option
    JServer Release 9.2.0.6.0 - Production
    SQL> select 'c' as X from dual;
    X
    c
    SQL>
    Test #2 Oracle 9.2.0.1 SQLPlus result is a single character.
    SQL*Plus: Release 9.2.0.1.0 - Production on Mon Dec 10 09:29:27 2007
    Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
    Connected to:
    Oracle9i Enterprise Edition Release 9.2.0.1.0 - Production
    With the Partitioning, OLAP and Oracle Data Mining options
    JServer Release 9.2.0.1.0 - Production
    SQL> select 'c' as X from dual;
    X
    c
    SQL>

    Using 9.2.0.6 On AIX 5.2 I get the single byte result:
    UT1 > select 'c' as X from dual;
    X
    c
    If the databases are on different Oracle Homes you may want to check the sqlplus global logon files for any set commands.
    If you executed the two sql statements from different OS directories you may also want to check your sqlpath for sqlplus .logon files.
    Try issueing clear columns and repeating the statement. Are the results the same?
    HTH -- Mark D Powell --

  • OneKey Recovery 6.0. Problem with back up operating system from recovery cd'ies

    Hello, i have problem with back up operating system from recovery cdies.
    When i acceped start button to backup partition system i get an alert "space not enough"
    I had linux before and i whant change it to windows back. i deleted all ext partitions. I have all unlocated space.I shouldnt have problems.
    Please help me

    I would use something like Partition Magic or Acronis Disk Director to first create a FAT32 partion for your C: Drive where your OS will go and be sure to leave 10GB or so unallocated for the secondary FAT32 Partition where your "factory image" will go. 
    You then create a Logical Drive with the unallocated space and make it hidden (PM or ADD will do this).   Install your OS (preferably Windows XP if you want less problems) and then after you have setup everything the way you want (drivers, applications, etc), then use Acronis True Image to create your "factory restore" image on the hidden partition and activate the Startup Recovery Manager.
    This is the way I do it and it works like a charm!

  • Trying to upgrade to 10.6 so my iPhone could synch...I'm getting this error message "Problem with this Windows (XP) Installer package.  A program required for this install to complete could not be run."  Any ideas?

    I had iTunes 10.2.1.1 but needed to upgrade to 10.6 so my iPhone could synch...I'm getting this error message "Problem with this Windows (XP) Installer package.  A program required for this install to complete could not be run."  Any ideas?

    This has been fixed.  Answer is that I needed to go to "Apple Software Update" and repair it.  (From my Control Panel).

  • I have tried to install iTunes 5 but when Windows it starts to install it  says there`s a problem with my Windows installer Paket and cancel the Program

    i have tried to install iTunes 5 but when Windows it starts to install it  says there`s a problem with my Windows installer Paket and cancel the Program. I`ve searched for answears in the web and they said ischould waste my old Itunes version and try it again. But it happend the same again! Now i havent any iTunes version and iAlso can`t Load a new one!!!! Pllease help me !!!

    I solved it myself, after the "note" which came back from FF/Mozilla just as I finished my message, commenting on what it was that my system had , I wnnt back to check my plug-ins etc. I downloaded the latest Java, BOTH 32bit AND 64 bit versions and latest Firefox.
    Now all is working.
    Thanks,
    B.

  • Help Me! How to send sms from a java program with a pda connected to system

    help me ,
    I am new in JavaME. I have to send sms from a java program, A PDA is connect to the system. Can some one help me to make that program which interact with PDA connected to system and send sms to any mobile or pda phones.

    user12873853 wrote:
    I believe JavaMail API will help in sending the mails and SMS through SMTP server. Sounds more like false hope than belief to me. The only way that would work is if you have an SMS gateway that allows communication through SMTP. Doubtlessly some exist (searching for 'JavaMail sms' through google certainly seems to indicate this), but if you have to ask you don't have one.
    And that exactly where you are stuck: to send SMS messages you need an SMS gateway. That will be the first thing you have to shop for, until then there is no reason to think about code, protocols or implementations. It can be as simple as hooking up a mobile phone, but then you cannot send bulk messages of course. Most likely you'll need to shop around for a partner that has an SMS blasting service you can use.

  • HT2534 Hello! I have a problem with a credit card. I bought one program, after that i wanted buy one more, but it wrote that with my card something wrong. After that i wanted change my card (VISA) on "NONE". But there no NONE! I can't download FREE apps!

    Hello! I have a problem with a credit card. I bought one program, after that i wanted buy one more, but it wrote that with my card something wrong. After that i wanted change my card (VISA) on "NONE". But there no NONE! I can't download FREE apps! Than I wanted make new account and select NONE, but there no NONE, there only cards. Help, please!

    Hey Shamannnig!
    Here is an article that can explain a little more about this situation:
    Why can’t I select None when I edit my payment information?
    http://support.apple.com/kb/ts5366
    Thanks for using the Apple Support Communities!
    Cheers,
    Braden

  • How can I execute a batch file from my java program

    Hi,
    Can someone help me or direct me to a link,
    How can I execute a DOS batch file from my java program?
    Thanks

    You will need to grab a handle to the process's
    outputstream so u can see its output.The OP didn't mention any output from any batch file;
    nor any input for that
    matter,so lets not complicate matters here for now
    ok?Actually I think this is essential to see whether it works or not. It's either that or do some manual check to see whether it ran, which is not exactly elegant, and in some cases this may not be easier than simply writing the output stream code, or in fact it may be impossible to check manually.
    I'm sure it wasn't intentional that your post appeared to be bristling with attitude.

  • Cannot call ANY stored functions from my Java program

    My problem is that I cannot call ANY stored procedure from my Java
    program. Here is the code for one of my stored procedures which runs
    very well in PL/SQL:
    PL/SQL code:
    CREATE OR REPLACE PACKAGE types AS
    TYPE cursorType IS REF CURSOR;
    END;
    CREATE OR REPLACE FUNCTION list_recs (id IN NUMBER)
    RETURN types.cursorType IS tracks_cursor types.cursorType;
    BEGIN
    OPEN tracks_cursor FOR
    SELECT * FROM accounts1
    WHERE id = row_number;
    RETURN tracks_cursor;
    END;
    variable c refcursor
    exec :c := list_recs(11)
    SQL> print c
    COLUMN1 A1 ROW_NUMBER
    rec_11 jacob 11
    rec_12 jacob 11
    rec_13 jacob 11
    rec_14 jacob 11
    rec_15 jacob 11
    Here is my Java code:
    import java.sql.*;
    import java.io.*;
    import oracle.jdbc.driver.*;
    class list_recs
    public static void main(String args[]) throws SQLException,
    IOException
    String query;
    CallableStatement cstmt = null;
    ResultSet cursor;
    // input parameters for the stored function
    String user_name = "jacob";
    // user name and password
    String user = "jnikom";
    String pass = "jnikom";
    DriverManager.registerDriver(new oracle.jdbc.OracleDriver());
    try { Class.forName ("oracle.jdbc.driver.OracleDriver"); }
    catch (ClassNotFoundException e)
    { System.out.println("Could not load driver"); }
    Connection conn =
    DriverManager.getConnection (
    "jdbc:oracle:thin:@10.52.0.25:1521:bosdev",user,pass);
    try
    String sql = "{ ? = call list_recs(?) }";
    cstmt = conn.prepareCall(sql);
    // Use OracleTypes.CURSOR as the OUT parameter type
    cstmt.registerOutParameter(1, OracleTypes.CURSOR);
    String id = "11";
    cstmt.setInt(2, Integer.parseInt(id));
    // Execute the function and get the return object from the call
    cstmt.executeQuery();
    ResultSet rset = (ResultSet) cstmt.getObject(1);
    while (rset.next())
    System.out.print(rset.getString(1) + " ");
    System.out.print(rset.getString(2) + " ");
    System.out.println(rset.getString(3) + " ");
    catch (SQLException e)
    System.out.println("Could not call stored function");
    e.printStackTrace();
    return;
    finally
    cstmt.close();
    conn.close();
    System.out.println("Stored function was called");
    Here is how I run it, using Win2K and Oracle9 on Solaris:
    C:\Jacob\Work\Java\Test\Vaultus\Oracle9i\FunctionReturnsResultset>java
    list_recs
    Could not call stored function
    java.sql.SQLException: ORA-00600: internal error code, arguments:
    [ttcgcshnd-1], [0], [], [], [], [], [], []
    at
    oracle.jdbc.dbaccess.DBError.throwSqlException(DBError.java:168)
    at oracle.jdbc.ttc7.TTIoer.processError(TTIoer.java:208)
    at oracle.jdbc.ttc7.Oall7.receive(Oall7.java:543)
    at oracle.jdbc.ttc7.TTC7Protocol.doOall7(TTC7Protocol.java:1405)
    at oracle.jdbc.ttc7.TTC7Protocol.fetch(TTC7Protocol.java:889)
    at
    oracle.jdbc.driver.OracleStatement.<init>(OracleStatement.java:490)
    at
    oracle.jdbc.driver.OracleStatement.getCursorValue(OracleStatement.java:2661)
    at
    oracle.jdbc.driver.OracleStatement.getObjectValue(OracleStatement.java:4189)
    at
    oracle.jdbc.driver.OracleStatement.getObjectValue(OracleStatement.java:4123)
    at
    oracle.jdbc.driver.OracleCallableStatement.getObject(OracleCallableStatement.java:541)
    at list_recs.main(list_recs.java:42)
    C:\Jacob\Work\Java\Test\Vaultus\Oracle9i\FunctionReturnsResultset>
    Any help is greatly appreciated,
    Jacob Nikom

    Thank you for your suggestion.
    I tried it, but got the same result. I think the difference in the syntax is due to the Oracle versus SQL92 standard
    conformance. Your statament is the Oracle version and mine is the SQL92. I think both statements are acceptable
    by the Oracle.
    Regards,
    Jacob Nikom

  • How to display a oracle table from a java program?

    How to display a oracle table from a java program.
    Hello friends, I have written a Java program, using oracle 10g as backend.
    I want to display a oracle table as output. Im not getting how to display oracle table as a output table.. Pls help me
    Thank you

    jayanthds, you're not going to get a satisfactory
    answer to this here. it's too big a task to justbe
    quickly outlined in a forum - the reply "all youneed
    to do is to query you table and return it asJTable"
    is worthless, for example, since the solution to
    any problem can be distilled to such a
    soundbite, if need be. doesn't make the solutionany
    simpler
    essentially you're asking "how do I write adatabase
    application?". all you'll get is snippets of code
    that, when fitted together, will eventually helpyou
    do this, but you'll spend days and days comingback
    saying "right, I've done that, now what?" until
    either you or the forum gets frustrated with the
    whole affair and the process stops
    there are entire books written about this subject,
    and countless tutorials and guides on theinternet.
    you're better off going down that routehehehe.well, it's true! I used to have a manager that would outline the solution to a problem in a few lines of pseudocode, and then firmly believe that the actual solution would be just as brief and simple. shame his pseudocode included such lofty abstractions as "reformat all data"

  • How to run a openssl command from a java program

    Hi All
    Please suggest on how to run a openssl command from a java program.
    I am using this
    Runtime runtime = Runtime.getRuntime();
    runtime.exec("openssl pkcs8 -inform der -nocrypt test.der result.pem");
    This is suppose to take test.der as input and create result.pem.
    There are no errors but the file result.pem isnt created.
    Thanks in Advance

    First off is that openssl command correct? Should it be this instead:
    openssl pkcs8 -inform der -nocrypt -in test.der -out result.pem
    Try out your openssl command within a command prompt so that you know that it works ok. I think the command line you specified waits on stdin (well it does for me).
    After that.....
    runtime.exec creates a Process object. If you do this:
    Process openssl = runtime.exec("....")
    then you can examine the return code from openssl to see the exit code - for instance if the input file does not exist then exit = 1. You can test for this with Java
    Alternatively you could get the stderr from the process and look inside it - if it is 0 length then all is good, if it has some text in there then it has likely failed. You could then throw an exception and include the stderr output in the exception messgae. You may need to experiment with this, runnig it first when openssl is happy then running it again when openssl is upset.
    M

  • Sending POSIX signal to an external subprocess from a java program

    I'm programing in forte for java under linux-mandrake, I've execute an external subprocess with the runtime and Process clases, I need to send the 2� POSIX signal to this external subprocess, I mean de SIGINT signal, I know that you can send a signal from a shell just doing:
    Kill -2 pid // the SIGINT signal is the 2 POSIX signal
    I know that there is another system-call like : kill(int signal, int pid) that any one can send from a c program.
    Althought I don't know how can I get the pid of a suprocess, because I Know that there is the systemcall in c like:
    int getpid() wich gives the pid of the current process, but I need to have the pid of a subprocess not the current one.
    The thing is that I do not know how can I do it from a java program, I mean that to send a signal to a subprocess it will work using system-calls, but I do not know if I can insert system call in a java program, I've been thinking about doing it using a linux script like:
    #!bin/bash
    $a = pidof /home/maude-linux/bin/maude.linux
    # this is the path of the process wich is running
    kill -2 a$
    and the run this script from a java program doing an exec(sh script.bin)
    but by the moment I must be doing something wrong in the script because I find mistake in it, it gives me mistake in the assign sentence , I mean:
    $a = pidof /home/maude-linux/bin/maude.linux
    # this is the path of the process wich is running
    I'm not used to program shell scripts, perhaps I'm doing something wrong, is there something wrong in this sentence?.
    I would aprecciate some help about this, or if somebody have some idea how to do it in java, I repeat I need to send a signal to a external subprocess wich is launched from a java program by the process and runtime clases, and I need to send a SIGINT signal to the subprocess, I hope that some body can give some suggestion or some code explaining the situation

    Are the portions of bash-code verbatim in your post?
    When yes, they look suspicious!
    Instead of
    #!bin/bash
    #!/bin/bash
    would be better.
    $a = pidof /home/maude-linux/bin/maude.linux
    does not look good either.
    If you have command "pidof" telling the pid based on the path name of the executable passed to it as its argument, you can have the output of this program in a shell script like this:
    a=$( pidof /home/maude-linux/bin/maude.linux )
    Then through $a you will refer to the value of the variable "a":
    kill -SIGINT $a
    A pidof script could look like this (apart from error handling):
    ps -ef|awk '{if (NF>=8 && $8=="'"$1"'") print $2;}'
    This works for me; your mileage may vary.

  • How to execute unix command from the Java program running on Windows

    Hello,
    I need to
    1. Execute a unix shell script from a Java program running on the Windows.
    2. I also need to capture the output of this shell script in my program.
    Please suggest me how to achieve this.
    Thanks in Advance.

    Hi...
    Something is missing here
    If you want to execute a shell script in windows that not posible unless you find or develop a unix shell script parser for windows.
    But if you are trying the execute a unix shell script on a remote unix computer from your java program running on a windows platform you can do that by logging on to the UNIX terminal which is running on port 23 I think.
    You can test this using telnet tool on windows
    just type on command prompt
    telnet <ip of the unix pc> <port number this case 23>
    you should get the unix terminal. If that works you can do the same through java or you can directly conect to port 23 of that pc using sockets that way your program will be platform independant

Maybe you are looking for

  • Report to check the quantity after we input in transaction CJR2

    Hi All, Is there any report standard to check the detail quantity after we input in tcode CJR2 (cost element and activity input). Thank you. Nies

  • Abstract method and class

    I'm a beginner in Java and just learn about abstract method and class. However, i am wondering what is the point of using abstract method/class? Because when I delete the abstract method and change the class name to public class XXXX( changed from "a

  • Setting variable "Frame Delay" for animation.

    I am trying to set frame delay in an animation I am working on. There are a lot of frames and they all have different delays. I am not sure if scripting is the best way but here is what I have so far (using VBA because that is what I am familiar with

  • Problems with getting WDS network to work - TimeCapsule + AirportExtreme

    Hi There, Apologies if this has been answered somewhere else but I have searched and still havent managed to solve my problem. I have a TC plugged into our cable modem which is broadcasting wirelessly fine. What I am trying to do is extend the networ

  • Can't restore my phone without password?

    My 13 year old daughter thought it would be ok to reset her password so we (her) parents wouldn't be able to check her phone. The problem is I found out because she couldn't access her mail and she forgot her new password and has no clue what it is a