Unable to print in linux using java 1.5

Hi i could't able to print in linux system using java 1.5. Printer name is detecting.
when i execute printDataTransferCompleted then printJobNoMoreEvents happening But print is not happening.
here i attached the source.
import javax.print.Doc;
import javax.print.DocFlavor;
import javax.print.DocPrintJob;
import javax.print.PrintService;
import javax.print.PrintServiceLookup;
import javax.print.SimpleDoc;
import javax.print.event.PrintJobEvent;
import javax.print.event.PrintJobListener;
public class HellowLinux {
     public static void main(String args[]){
          String printText = "The Java Tutorials are practical guides for programmers" ;
          DocFlavor byteFlavour = DocFlavor.BYTE_ARRAY.TEXT_PLAIN_UTF_8;
          Doc myDoc = new SimpleDoc(printText.getBytes(), byteFlavour, null);
          PrintService[] services = PrintServiceLookup.lookupPrintServices(byteFlavour, null);
          System.out.println("No of printer detected : "+services.length );
          for(int i = 0; i<services.length; i++){
               System.out.println("Printer Name : "+services.getName());
          if(services.length > 0){
               DocPrintJob myJob = services[0].createPrintJob();
               myJob.addPrintJobListener(new PrintJobMonitor());
               try{
                    myJob.print(myDoc, null);
                    System.out.println("Printed Successfully ... ");
               }catch(Exception e){
                    System.out.println("Error : "+e.getMessage());
     private static class PrintJobMonitor implements PrintJobListener {
          public void printDataTransferCompleted(PrintJobEvent pje) {
               // Called to notify the client that data has been successfully
          // transferred to the print service, and the client may free
          // local resources allocated for that data.
               System.out.println("Data transfer Completed : "+pje.hashCode()
                         +"\n"+pje.getPrintEventType());
          public void printJobCanceled(PrintJobEvent pje) {
               // Called to notify the client that the job was canceled
          // by a user or a program.
               System.out.println("Cancelled : "+pje.hashCode()
                    +"\n Event Type "+pje.getPrintEventType());
          public void printJobCompleted(PrintJobEvent pje) {
               // Called to notify the client that the job completed successfully.
               System.out.println("Completed : "+pje.hashCode()
                         +"\n Event Type "+pje.getPrintEventType());
          public void printJobFailed(PrintJobEvent pje) {
               // Called to notify the client that the job failed to complete
          // successfully and will have to be resubmitted.
               System.out.println("Failed : "+pje.hashCode()
                         +"\n Event Type "+pje.getPrintEventType());
          public void printJobNoMoreEvents(PrintJobEvent pje) {
               // Called to notify the client that no more events will be delivered.
               System.out.println("No More Events : "+pje.hashCode()
                         +"\n Event Type "+pje.getPrintEventType());
          public void printJobRequiresAttention(PrintJobEvent pje) {
               // Called to notify the client that an error has occurred that the
          // user might be able to fix.\
               System.out.println("Requires Attention : "+pje.hashCode()
                         +"\n Event Type "+pje.getPrintEventType());
Edited by: 936393 on May 24, 2012 12:08 AM

Hi ,
Go to Help menu >> update
it will update your application to 13.1
then go to  Editor 's Edit menu >> Preferences and click on Reset Preference on next launch .
after that relaunch your application..
Refer article for the same:
https://helpx.adobe.com/photoshop-elements/kb/elements-printer-issue-incompatible-error.ht ml

Similar Messages

  • Open a PDF file in linux using java

    Hi..
    How can I open a PDF file in linux using java.
    I am able to open PDF in windows and mac using this code
    in Windows
    Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + path_of_PDF);
    in mac
    Runtime.getRuntime().exec("open " + path_of_PDF);
    But nothing is working with linux.
    Please help
    Thanks

    One thread is enough:
    http://forum.java.sun.com/thread.jspa?threadID=5267458

  • Open PDF file in linux using java

    Hi..
    How can I open a PDF file in linux using java.
    I am able to open PDF in windows and mac using this code
    in Windows
    Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler " + path_of_PDF);
    in mac
    Runtime.getRuntime().exec("open " + path_of_PDF);
    But nothing is working with linux.
    Please help
    Thanks

    appi wrote:
    Hi.. I found the JDIC binary files. There are different binaries for all the plateform. Is there any solution which is independent of plateform.Yes, and we already told you: Use JDK6, which has those libraries built into the standard class library.
    How can I use these binaries in my existing project. does it work, If I place them at same place where other .class files are kept.Read the documentation of the JDIC project. I'm sure they answer this question in their FAQ.

  • Unable to load performance pack, using Java I/O.

    Hi there,
    I am trying to start weblogic 6.0 from jBuilder. It does start, and
    working. But, I got the one problem about loading performance pack. The
    message is the following. Any comment?
    Thank you
    ----------------------------------------->Starting WebLogic Server ....
    <Jun 27, 2001 1:35:13 PM EDT> <Notice> <Management> <Loading configuration
    file C:\bea\wlserver6.0sp1\config\mydomain\config.xml ...>
    log file:
    C:\bea\wlserver6.0sp1\config\mydomain\config\config\mydomain\logs\weblogic.l
    og
    <Jun 27, 2001 1:35:14 PM EDT> <Info> <Logging> <Only log messages of
    severity "Error" or worse will be displayed in this window. This can be
    changed at Admin Console> mydomain> Servers> myserver> Logging> General>
    Stdout severity threshold>
    <Jun 27, 2001 1:35:46 PM EDT> <Notice> <WebLogicServer> <ListenThread
    listening on port 7001>
    <Jun 27, 2001 1:35:46 PM EDT> <Notice> <WebLogicServer> <WebLogic Server
    started>
    <Jun 27, 2001 1:35:46 PM EDT> <Error> <Performance Pack> <Unable to load
    performance pack, using Java I/O.
    java.lang.UnsatisfiedLinkError: no wlntio in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1312)
    at java.lang.Runtime.loadLibrary0(Runtime.java:749)
    at java.lang.System.loadLibrary(System.java:820)
    at weblogic.socket.NTSocketMuxer.<init>(NTSocketMuxer.java:173)
    at java.lang.Class.newInstance0(Native Method)
    at java.lang.Class.newInstance(Class.java:237)
    at weblogic.socket.SocketMuxer.makeTheMuxer(SocketMuxer.java:126)
    at weblogic.socket.SocketMuxer.getMuxer(SocketMuxer.java:83)
    at weblogic.t3.srvr.ListenThread.run(ListenThread.java:224)
    >

    Thank you
    But, it does not work. It does the same. Here is the message.
    ------------------------------------------------------------>C:\bea\jdk130\bin\javaw -classpath
    "S:\Java\classes;C:\jdk1.3\jre\lib\rt.jar;S:\Java\lib\activation.jar;S:\Java
    \lib\classes12.zip;S:\Java\lib\cos.jar;S:\Java\lib\dx3.0.jar;S:\Java\lib\dx3
    .0-res.jar;S:\Java\lib\fscontext.jar;S:\Java\lib\j2ee.jar;S:\Java\lib\java40
    .jar;S:\Java\lib\jgl3.1.0.jar;S:\Java\lib\jsdk21.jar;S:\Java\lib\junit.jar;S
    :\Java\lib\mail.jar;S:\Java\lib\msclasses.zip;S:\Java\lib\rootriver.report.j
    ar;S:\Java\lib\servlet.jar;S:\Java\lib\ServletExecDebugger.jar;S:\Java\lib\s
    truts.jar;C:\bea\wlserver6.0sp1\lib\weblogic.jar;C:\bea\wlserver6.0sp1\lib\x
    mlx.jar;C:\bea\wlserver6.0sp1\bin;C:\junit3.5\junit.jar;C:\jakarta-struts-1.
    0-b1\lib\struts.jar;C:\JBuilder4\jdk1.3\demo\jfc\Java2D\Java2Demo.jar;C:\JBu
    ilder4\jdk1.3\jre\lib\i18n.jar;C:\JBuilder4\jdk1.3\jre\lib\jaws.jar;C:\JBuil
    der4\jdk1.3\jre\lib\rt.jar;C:\JBuilder4\jdk1.3\jre\lib\sunrsasign.jar;C:\JBu
    ilder4\jdk1.3\lib\dt.jar;C:\JBuilder4\jdk1.3\lib\tools.jar" -ms64m -mx64m -
    classpath
    "C:\bea\wlserver6.0sp1;C:\bea\wlserver6.0sp1\bin;C:\bea\wlserver6.0sp1\lib\w
    eblogic_sp.jar;C:\bea\wlserver6.0sp1\lib\weblogic.jar;S:\Java\classes;S:\Jav
    a\lib\classes12.zip;C:\jakarta-struts-1.0-b1\lib\struts.jar;S:\Java\lib\dx3.
    0.jar;S:\Java\lib\rootriver.report.jar;S:\Java\lib;S:\Java\lib\struts.jar;"
    "-Dweblogic.RootDirectory=C:\bea\wlserver6.0sp1"
    "-Dweblogic.Domain=mydomain" "-Dweblogic.Name=myserver" "-Dbea.home=c:\bea"
    "-Djava.security.policy==c:\bea\wlserver6.0sp1\lib\weblogic.policy"
    "-Dweblogic.management.password=password" weblogic.Server -hotspot
    Starting WebLogic Server ....
    <Jun 27, 2001 4:00:39 PM EDT> <Notice> <Management> <Loading configuration
    file C:\bea\wlserver6.0sp1\config\mydomain\config.xml ...>
    log file:
    C:\bea\wlserver6.0sp1\config\mydomain\config\config\mydomain\logs\weblogic.l
    og
    <Jun 27, 2001 4:00:50 PM EDT> <Info> <Logging> <Only log messages of
    severity "Error" or worse will be displayed in this window. This can be
    changed at Admin Console> mydomain> Servers> myserver> Logging> General>
    Stdout severity threshold>
    <Jun 27, 2001 4:02:32 PM EDT> <Notice> <WebLogicServer> <WebLogic Server
    started>
    <Jun 27, 2001 4:02:32 PM EDT> <Notice> <WebLogicServer> <ListenThread
    listening on port 7001>
    <Jun 27, 2001 4:02:32 PM EDT> <Error> <Performance Pack> <Unable to load
    performance pack, using Java I/O.
    java.lang.UnsatisfiedLinkError: no wlntio in java.library.path
    at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1312)
    at java.lang.Runtime.loadLibrary0(Runtime.java:749)
    at java.lang.System.loadLibrary(System.java:820)
    at weblogic.socket.NTSocketMuxer.<init>(NTSocketMuxer.java:173)
    at java.lang.Class.newInstance0(Native Method)
    at java.lang.Class.newInstance(Class.java:237)
    at weblogic.socket.SocketMuxer.makeTheMuxer(SocketMuxer.java:126)
    at weblogic.socket.SocketMuxer.getMuxer(SocketMuxer.java:83)
    at weblogic.t3.srvr.ListenThread.run(ListenThread.java:224)
    >

  • Unable to load performance pack, using Java I/O instead

    I'm writing because we're having some troubles with the performance pack load.
    We're getting this error message when the server starts:
    <Feb 1, 2005 11:30:26 AM CST> <Error> <Performance Pack> <Unable to load performance pack, using Java I/O instead.
    Please ensure that libmuxer library is in /bea/jdk131/jre/bin/../lib/PA_RISC2.0/native_threads:/bea/jdk131/jre/bin/../lib/PA_RISC2.0/server:/bea/jdk131/jre/bin/../lib/PA_RISC2.0:/siven/shlib:/bea/wlserver/lib/hpux11:/bea/wlserver/lib/hpux11/oci816_8:/usr/lib
    java.lang.UnsatisfiedLinkError: getBuildTime
    We have checked the following things:
    1.- The library libmuxer.sl exists in the path: /bea/wlserver/lib/hpux11
    2.- The file has the correct privileges so it can be read by the server
    3.- We've run an 'nm -o libmuxter.sl |grep getBuildTime' to ensure that the method exists in the library
    We have four managed servers running in the same machine and the error message apears only in one of them.
    Any idea of what might be happening?
    Does any one know on what OS librarys depends libmuxer.sl?
    We're running WebLogic Server 6.1 SP6 on HP-UX 11.0

    That's very odd that the same machine has 4 servers and only 1 sees this
    error.
    I'm assuming they all have the same environment/user etc. If not,
    that's the first thing you should check.
    I wonder if this is a resource issue in the OS. If you start a 5th
    server, does it also see this error? Is it the 4th server you start
    that hits this error, or just one of the 4 you run?
    -- Rob
    Miguel Chavez wrote:
    I'm writing because we're having some troubles with the performance pack load.
    We're getting this error message when the server starts:
    <Feb 1, 2005 11:30:26 AM CST> <Error> <Performance Pack> <Unable to load performance pack, using Java I/O instead.
    Please ensure that libmuxer library is in /bea/jdk131/jre/bin/../lib/PA_RISC2.0/native_threads:/bea/jdk131/jre/bin/../lib/PA_RISC2.0/server:/bea/jdk131/jre/bin/../lib/PA_RISC2.0:/siven/shlib:/bea/wlserver/lib/hpux11:/bea/wlserver/lib/hpux11/oci816_8:/usr/lib
    java.lang.UnsatisfiedLinkError: getBuildTime
    We have checked the following things:
    1.- The library libmuxer.sl exists in the path: /bea/wlserver/lib/hpux11
    2.- The file has the correct privileges so it can be read by the server
    3.- We've run an 'nm -o libmuxter.sl |grep getBuildTime' to ensure that the method exists in the library
    We have four managed servers running in the same machine and the error message apears only in one of them.
    Any idea of what might be happening?
    Does any one know on what OS librarys depends libmuxer.sl?
    We're running WebLogic Server 6.1 SP6 on HP-UX 11.0

  • Unable to load performance pack, using Java I/O on WL60, sp2

    Dear friends,
    I am seeking help from you. When we start WL60 SP2 on Sun Soloris 5.6, we got
    the following exception:
    <Jul 31, 2001 5:39:53 PM EDT> <Error> <Performance Pack> <Unable to load performance
    pack, using Java I/O.
    java.lang.UnsatisfiedLinkError: getFdLimit
    at weblogic.socket.PosixSocketMuxer.getFdLimit(Native Method)
    at weblogic.socket.PosixSocketMuxer.<init>(PosixSocketMuxer.java:104)
    at java.lang.Class.newInstance0(Native Method)
    at java.lang.Class.newInstance(Class.java:237)
    at weblogic.socket.SocketMuxer.makeTheMuxer(SocketMuxer.java:128)
    at weblogic.socket.SocketMuxer.getMuxer(SocketMuxer.java:83)
    at weblogic.t3.srvr.ListenThread.run(ListenThread.java:224)
    >
    Hoever, the server itself started, and our applications runs ok
    (at least so far). But this exception appears every time on some user accounts.
    I was wondering what causes this exception. Some user accounts in the same machine
    don't have this problem.
    I also wondering if it will cause performance problem when the traffic is high.
    We already applied the patches.
    Any hits and suggestions are welcome.
    Thanks in advance.
    -Ju

    Dear Deyan,
    Thanks for your help. We do have $WEBLOGIC_HOME/lib/solaris in LD_LIBRARY_PATH,
    which is set when running ". setEnv.sh" before startWebLogic.sh.
    We failed on one patch: 105210-27, for some reason.
    The strange thing is: in the same machine, all WL60 instances running under user
    accounts (under /users/developers/) have no such error. But it happens under some
    account, like accounts under /export/home/, etc. /user/developers is mounted on
    another physical machine.
    -Ju
    "Deyan D. Bektchiev" <[email protected]> wrote:
    >
    You should have the $WEBLOGIC_HOME/lib/solaris directory in your LD_LIBRARY_PATH
    so that
    the server can load the performance pack (which is a shared library called
    libmuxer.so).
    If it is present then do a ldd libmuzer.so and you will see if any libraries
    that it
    depends on are missing.
    Also make sure you have all of the requered patches for 2.6 installed.
    --dejan
    Ju Rao wrote:
    Dear friends,
    I am seeking help from you. When we start WL60 SP2 on Sun Soloris 5.6,we got
    the following exception:
    <Jul 31, 2001 5:39:53 PM EDT> <Error> <Performance Pack> <Unable toload performance
    pack, using Java I/O.
    java.lang.UnsatisfiedLinkError: getFdLimit
    at weblogic.socket.PosixSocketMuxer.getFdLimit(Native Method)
    at weblogic.socket.PosixSocketMuxer.<init>(PosixSocketMuxer.java:104)
    at java.lang.Class.newInstance0(Native Method)
    at java.lang.Class.newInstance(Class.java:237)
    at weblogic.socket.SocketMuxer.makeTheMuxer(SocketMuxer.java:128)
    at weblogic.socket.SocketMuxer.getMuxer(SocketMuxer.java:83)
    at weblogic.t3.srvr.ListenThread.run(ListenThread.java:224)
    >
    Hoever, the server itself started, and our applications runs ok
    (at least so far). But this exception appears every time on some useraccounts.
    I was wondering what causes this exception. Some user accounts in thesame machine
    don't have this problem.
    I also wondering if it will cause performance problem when the trafficis high.
    We already applied the patches.
    Any hits and suggestions are welcome.
    Thanks in advance.
    -JuContent-Description: Card for Deyan D. Bektchiev
    begin:vcard
    n:Bektchiev;Deyan
    tel;home:1-650-363-6055
    tel;work:1-650-289-1046
    x-mozilla-html:TRUE
    url:http://www.appl.net/
    org:Application Networks
    adr:;;444 Ramona St;Palo Alto;CA;94301;USA
    version:2.1
    email;internet:[email protected]
    fn:Deyan D. Bektchiev
    end:vcard

  • Unable to print PDF files using Acrobat 8.

    I had to uninstall and then reinstall Office for Mac 2011.  I don't know if it's related or not,  but since doing so I have been unable to print PDF files using Adobe Acrobat 8. After opening a PDF file and hitting print, Adobe Acrobat 8 crashes. Any suggestions?  I already uninstalled and reinstalled Adobe Acrobat 8, but it still won't print PDF files. O

    While you are having difficulty in printing a PDF file, you may try the  subsequent steps. If you are in a rush and would like to print a simple  document such as a letter, a form, or a calendar, you may print it as an  image. Next option is that you may need to update your printer driver   if the PDF does not print, the PDF prints as a blank page or with  unreadable text or if you get an error message when you print.  Sometimes, when you print a file that is on a thumb drive or a network,  the file gets damaged. Then you have to open the copy on your hard drive  and print again. At last, you can try printing the PDF using another  printer and check your printer connection too if the PDF does not get  printed. get more help to fix unable to printer PDF file hope this helps you.
    Good Luck!

  • How to print PDF files using java print API

    Hi,
    I was goign throw lot of discusion and reading lot of forums related to print pdf files using java api. but nothing seems to be working for me. Can any one tell me how to print pdf files using java api.
    Thanks in advance

    Mike,
    Can't seem to get hold of the example described in your reply below. If you could let us have the URL to get then it would be great.
    My GUI application creates a pdf document which I need to print. I want to achieve this using the standard Java class PrinterJob (no 3rd party APIs I'm afraid, commercial restraints etc ..). I had a stab at it using the following code. When executed I get the pretty printer dialog then when I click ok to print, nothing happens!
    boolean showPrintDialog=true;
    PrinterJob printJob = PrinterJob.getPrinterJob ();
    printJob.setJobName ("Contract.pdf");
    try {
    if (showPrintDialog) {
    if (printJob.printDialog()) {
    printJob.print();
    else
    printJob.print ();
    } catch (Exception PrintException) {
                   PrintException.printStackTrace();
    Thank you and a happy new year.
    Cheers,
    Chris

  • I am unable to print "ALL Pages" using the Adobe Print plugin in Firefox, only the first page gets printes. however IE works perfectly fine.Please advise. Is it some way that firefox identifies the complete web page..? PLease help

    I am unable to print "ALL Pages" using the Adobe Print plugin in Firefox, only the first page gets printes. however IE works perfectly fine.Please advise. Is it some way that firefox identifies the complete web page..? PLease help

    Does the entire webpage appear in Print Preview? <br />
    File > Print Preview

  • Printing Web contents using Java Fx.

    Hi,
    How to Print Web contents using Java Fx application? ie, displaying a web page as it is on the application..........
    Thanks......

    You might want to try to SwingComponentize third-party Java web browser (JDic, NativeSwing).
    Another recommended alternative is to wait for the JWebPane because it is designed to work with JavaFX (http://weblogs.java.net/blog/alex2d/archive/2008/12/jwebpane_projec_1.html). No date is given to JWebPane's release though. JWebPane will be my Christmas's wish.

  • I am unable to print anything while using firefox as my browser !

    i am unable to print anything while using firefox as my browser !

    Hi Philip,
    This could be an issue with some corrupt print preferences. In your toolbar go to about:config and reset all of your print.preferences. This could hopefully help!
    - Sarah

  • Directly Printing RTF document using java

    Hi,
    can we directly print RTF document using java, without giving any preview or any other screen in between.
    Actually we created inventory system, in which when user create any sale information, it should print the bill for the same with single button click.
    Any sample code or help will be highly appreciated
    Thanks in advance

    Hi,
    can we directly print RTF document using java, without giving any preview or any other screen in between.
    Actually we created inventory system, in which when user create any sale information, it should print the bill for the same with single button click.
    Any sample code or help will be highly appreciated
    Thanks in advance

  • Problem of accesing MS Acess database on Linux using Java

    Below is my java code and errors found. Can anyone guide me tell me what is the problem and how to success access the .mdb file using Java on Linux?
    import java.sql.*;
    class readmdb
    {      public static void main(String[] args)
    {    String url;
    Connection con;
    Statement stmt;
    try
    {     Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
    catch(java.lang.ClassNotFoundException e)
    {    System.out.print("ClassNotFoundException: ");
    System.out.println(e.getMessage());
    try
    {     con = DriverManager.getConnection("jdbc:odbc:DRIVER={/usr/local/lib/libmdbodbc.o.O}};DBQ=/home/powerstation/db/Database.mdb");
    stmt = con.createStatement();
    stmt.close();
    con.close();
    catch(SQLException ex)
    { System.err.println("SQLException: " + ex.getMessage());
    Errors messages found after i executed the java code
    shown above on linux platform.
    Exception in thread "main"
    java.lang.NullPointerException
    at sun.jdbc.odbc.JdbcOdbcDriver.initialize(JdbcOdbcDriver.java:436)
    at sun.jdbc.odbc.JdbcOdbcDriver.connect(JdbcOdbcDriver.java:153)
    at java.sql.DriverManager.getConnection(DriverManager.java:512)
    atjava.sql.DriverManager.getConnection(DriverManager.java:193)
    at readmdb.main(readmdb.java:27)

    jschell,
    ODBC shell is the odbc.ini or odbcinst.ini? No.
    The shell is something that you explicitly installed. Just like you installed Apache, or perl, or a C++ compiler, or even a CD driver.
    If yes,
    What is the difference between odbc.in and
    odbcinst.ini? No idea. But on a windows box those are ini files that specify odbc info. I don't think ini files are going to help on linux.
    Which of them will be execute when i
    want to establish a connection using "jdbc:odbc:...."
    in DriverManager.getConnection?I am rather sure that neither of them would 'execute'
    >
    Is it MS Access ODBC linux driver is the file like
    libodbc.so, libmdbodbc.so, libmdbsql.so and so on?No idea, but I doubt it.
    What makes you think that you even have a MS Access ODBC linux driver on your box?
    Then, can u tell me which is MS Access ODBC linux
    driver or what is the driver file name for MS Access
    ODBC linux driver?Nope.
    If you installed a MS Access ODBC linux driver, then the ODBC shell will know where it is.
    And if you did install such a driver you should post the link where you got it here, because as far as I know, there is no such driver (nor is there one for MS SQL Server.)

  • I am unable to print a copy using my 3510e printer

    I am unable to print a copy of a document using my 3510e printer

    Hi @birdhouse632 , do you run into an error when copying from your printer? Please check your printer firmware and install the latest firmware using the printer front panel as shown here. 
    Although I am an HP employee, I am speaking for myself and not for HP. *Say thanks by clicking the "Kudos! Star" which is on the left* Make it easier for other people to find solutions, by marking my answer with "Accept as Solution" if it solves
    I work for HP but my posts and replies are my own.
    I work for HP but my posts and replies are my own.
    Click the Kudos star as a way to say "thank you" for helpful posts.
    Be sure to come back and click the 'Accept as Solution' button on the post that solved your issue - it may help someone else .....

  • How to run SQL script file on Linux using Java ?

    Hi,
    I need to execute .sql file using java. I used following approach for this.
    private void runScriptEvent(java.awt.event.ActionEvent evt) {                               
            String sqlOutput = "";
            String sqlPromptLines="";
            String currentFunctionName = "";
            if(con!=null){
                String userName = jTextField4.getText();
                String password = jPasswordField1.getText();
                String databaseName = jTextField3.getText();
                try {
                    String script_location = "";
                    ProcessBuilder processBuilder =null;
                    Process process = null;
                    //File file = new File("C:/ScriptFile");
                    File file = new File("./SQL_Script");
                    //File file = new File("E:\\install\\SQL_Script");
                    if(file.exists()){
                        File [] list_files= file.listFiles(new FileFilter() {
                                        public boolean accept(File f) {
                                        if (f.getName().toLowerCase().endsWith(".sql"))
                                        return true;
                                        return false;
                    int count = 0;
                        for (int i = 0; i<list_files.length;i++){
                            script_location = "@" + list_files.getAbsolutePath();//ORACLE
    //currentFunctionName = list_files[i].getName();
    StringTokenizer st = new StringTokenizer(list_files[i].getName(), ".");
    while(st.hasMoreTokens()) {
    currentFunctionName = st.nextToken();
    String extention= st.nextToken();
    System.out.println("Function Name = "+currentFunctionName + "\t Extention = " + extention);
    processBuilder = new ProcessBuilder("sqlplus",userName+"/"+password+"@"+databaseName, script_location); //ORACLE
    processBuilder.redirectErrorStream(true);
    process = processBuilder.start();
    BufferedReader in = new BufferedReader(new InputStreamReader(process.getInputStream()));
    String currentLine = null;
    while ((currentLine = in.readLine()) != null) {
    sqlPromptLines = " "+sqlPromptLines + currentLine +"\n";
    count ++;
    System.out.println(count+" " + currentLine);
    if(currentLine.equalsIgnoreCase("Function created.")){
    sqlOutput = "\n" sqlOutput currentFunctionName + " " currentLine"\n" ;
    break;
    }// end while
    in.close();
    process.destroy();
    }//end for
    }//end if file exists
    } catch (IOException e1) {
    jTextArea1.setText(e1.getMessage());
    System.out.println("Script Done");
    jTextArea1.append(sqlOutput);
    }// end id Connection is not null
    Above code working appropriate on Windows but not on Linux.
    is there any changes needed ?
    Regards,
    Ajay
    Edited by: Ajay Sharma on Nov 21, 2012 6:43 PM                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                               

    Hi gimbal2,
    about code
    jTextArea1.setText(e1.getMessage());I am using this code so that the user will be prompted with a message rather than stack trace.
    About the issue I am getting on linux i believe its because of following statement.
    processBuilder = new ProcessBuilder("sqlplus",userName+"/"+password+"@"+databaseName, script_location); //ORACLERegards,
    Ajay
    Edited by: Ajay Sharma on Nov 23, 2012 12:05 PM
    Edited by: Ajay Sharma on Nov 23, 2012 12:06 PM

Maybe you are looking for