IOExceptions from java.io.File.getCanonicalFile()

The javadoc for the java.io.File.getCanonicalFile() method says that it can fail with an IOException, saying:
@ throws IOException If an I/O error occurs, which is possible because the construction of the canonical pathname may require filesystem queries
My question is: Does anyone know any details about the precise circumstances under which I might expect to see IOExceptions from this method? Or can anyone point me towards any more detailed documentation about it.
The problem really is a lack of documentation. The getCanonicalFile method calls into the:
public native String canonicalize(String path) throws IOException;
in java.io.Win32FileSystem class. This is where the IOExceptions come from but this method is native has no javadoc info at all

Download the SCSL J2SDK Source code. It is the source code of all JDK (including native code)
The source code of the java.io.Win32FileSystem class is in j2se\src\windows\classes\java\io\Win32FileSystem.java. It refers to the C source file
j2se\src\windows\native\java\io\Win32FileSystem_md.c, where a function JNIEXPORT jstring JNICALL
Java_java_io_Win32FileSystem_canonicalize0(JNIEnv *env, jobject this, jstring pathname) is defined and basically calls "canonicalize", a function in j2se\src\windows\native\java\io\canonicalize_md.c. If it encounters an error, throws an IOException with the message "Bad pathname".
Please read the entire source of the file canonicalize_md.c. I can't post it here due to license problems. It is the ultimate reference for your questions.

Similar Messages

  • Java.io.File.getCanonicalFile() IOExceptions

    The javadoc for the java.io.File.getCanonicalFile() method says that it can fail with an IOException, saying:
    @ throws IOException If an I/O error occurs, which is possible because the construction of the canonical pathname may require filesystem queries
    My question is: Does anyone know any details about the precise circumstances under which I might expect to see IOExceptions from this method? Or can anyone point me towards any more detailed documentation about it.

    it calls the java.io.Win32FileSystem.canonicalize(String) method which is native and has no javadoc info at all

  • Error running batch files from java source file???

    Dear Friends,
    hi,
    this is with response to a doubt i had earlier ,
    i want to run batch files from the java source file ,i tried using this code (here batrun is the batch file name that contains commands to run other java files)
    try
    String [] command = {"c:\\vishal\\finalmain\\batrun"};
    Runtime.getRuntime().exec(command);
    catch(Exception e)
    but i got the following error.
    java.io.IOException: CreateProcess: gnagarrun error= 2
    plz. help me, i tried all combination w/o success,
    in anticipation(if possible give the code after testing)
    Vishal.

    hello there,
    i solved the prob. by using
    cmd /c start filename ,but i need to pass parameters ie
    cmd /c start java "c:/vishal/runfile a b" where a and b are the parameters. but it is not accepting this in Runtime.getRuntime.exec(),
    any solutions ?????????
    regards,
    Vishal

  • Creating win 32 exe files from java class files

    Hi I am using windows 2000.
    I have developed a java swing gui application that has about 10 class files. I downloaded the microsoft sdk for java 4.0 for converting all my class files into a single .exe file. I used jexegen in this SDK to do this process. But when I double click the exe file, it just pops up and closes instantenously without showing my startup frame.
    Can anyone help ?

    There is no Microsoft solution for this until you get J#, change your program
    (J# is a little bit different that java but not much, it's closer to Java than C#)
    and then compile to Win32 .exe.
    For the refrence list of all Java to Native code compilers, check this page:
    http://www.geocities.com/marcoschmidt.geo/jcomp.html#native :
    Different from "normal" compilers (like javac or jikes), native compilers do not create bytecode files
    (.class) that are interpreted by a Java Virtual Machine but native executables (like .exe files on
    Windows). "How do I create an EXE from Java?" is a very frequently asked question in newsgroups
    like comp.lang.java.programmer, native compilers are the answer. Some native compilers are listed
    below, check them out.

  • How to create .exe files from Java class files?

    I'm new to Java and I just wonder if it is possible to make executable files out of Java class files. I've checked the Java online help and several search engines, but I still couldn't find anything about that. Is it possible to do so? If not, why not?
    Thanx a lot for any help.

    I don't remember if there is a program that converts the class file,
    but I do know that there are a few that either convert the class file,
    or the .java file. You might try searching for ".java to .exe" in the
    search engine and seeing what that pulls up.

  • Going from .java source files to a .jar

    If my source files are .java, how can I make a .jar out of them from the command line? I have 4 main files, each a class with plenty of inner classes...how do I turn those files into something jar.exe wants? And if/when I get the .jar archive created, how do I set the class with the main class? Thanks for any help guys and gals!
    Fair

    This is not new info, just restating previous replies 1 and 2. (In case there's a misunderstanding...)
    You must create class files by compiling xxx.java with the java compiler, this creates xxx.class, which contains an intermediate 'bytecode' version of the source - it's not readable by humans. The xxx.class file can be interpreted (run) by the java interpreter, thus: java xxx **OR** it can be placed in a jar file, and if done properly the jar file is executable.The 2nd reply by kelle3 gives the way that the jar file is created. If the xxx.class file(s) can be interpreted, they are valid. I'm not sure what you're looking at when you say you 'opened mine', as that requires that you disassemble a class file, which I don't think you're doing.
    If you're still having problems either 1) search the forums for '.jar', there are many threads like this, or 2) go here http://java.sun.com/docs/books/tutorial/jar/basics/index.html
    Hope this assists.

  • Java.io.File give incorrect chinese filenam when using javaw.exe

    I am running Chinese Win2000 Pro (SP2) with jre1.3.1 installed. If I use javaw.exe to run my application, java.io.File does not give the correct filename for chinese filename when I use it to run through a directory, though all English filenames show correctly.
    When the same program is run by java.exe instead of javaw.exe, the program runs with no problem and all chinese name are obtained successfully from java.io.File. Does anyone know the reason behind this ?
    I need to use javaw.exe since I am invoking Java from VC++. I don't want a black command prompt window to pop up behind my java application. Please help.

    Hi,
    I am sorry for not replying to ur query. Infact I am facing my own problem and after reading your problem I thought you could help me out in it because you are already successful in invoking java from VC++.
    My problem is that I want to invoke java class from VC++ in such a way that I want to capture the stdout of java class that I invoke from VC++ and use it in VC++. Let me explain first thing first. I am not able to invoke java class from withing vc++. I have looked at JNI help on SUN site but it is giving me lots of compilation error when I include JNI.h in my VC++ program. If you could help me out in this problem, it would be great.
    Thanks in advance.
    Regards
    Rakesh

  • How to get application module instance from java bundle?

    Hi!
    I would like to build an application that would get all translations from a database table.
    So I created application module for translations that contains a view object which is selecting translations for specific language from a database table. I exposed a method in application module as client interface which returns HashMap<String, String> for all translations for specific language. When I test my view and client interface method call they work fine.
    Then I created java bundle classes to get translations for specific language. Then I tried to override public Object[][] getContents() method.
    I tried to get my translations application module like this:
    SharedTranslationsAppModuleImpl am = new SharedTranslationsAppModuleImpl();
    Map<String, String> translationsMap = am.getTranslations(this.getLocaleCode); // Client interface method call
    In getTranslations(String LocaleCode) I try to get that view (which would select translations from database) but it returns NULL and I get NPE error message.
    So what is the right way to get application module from java bundle file? Now everytime application wants to get translations, application stops and displays NPE message.
    Regards, Marko
    I use JDeveloper 11.1.2.1.0

    Marko,
    you can't just instantiate an application module. An application module has to be set up, db connections and memory pools have to be initialized and ....
    Can you describe why and when you try to read the resource bundle from the db and where the resource bundle is used?
    This blog may be what you are looking for http://technology.amis.nl/2012/08/10/implement-resource-bundles-for-adf-applications-in-a-database-table/
    Timo

  • Calling html from java with some values

    Hello friends,
    I can call a HTML file from java.I want to pass some values from java class file to that html file.Anybody help me how to pass parameters?
    Runtime.getRuntime().exec("rundll32 url.dll,FileProtocolHandler http://localhost:8080/jcoDemo/dp.html");
    is one i am using for calling html file
    thanks

    Just add GET query parameters to the URL.
    Besides, if you were using Java 1.6 or newer, then rather use [Desktop#browse()|http://java.sun.com/javase/6/docs/api/java/awt/Desktop.html#browse(java.net.URI)] instead of Runtime#exec(). It is crossplatform while your runtime approach works in Mircosoft Windows systems only.

  • How to read some records from a text file into java(not all records)

    hello,
    how to read text files into java. i need only few records from the text file not all records at a time.
    If any one knows plz reply me
    my id is [email protected]

    this snipet reads a text file line by line from line 1 to 3
    try {
                  FileReader fr = new FileReader(directory);
                  BufferedReader br = new BufferedReader(fr);
                  int counter = 0;
                  while ((dbconn = br.readLine()) != null) {
                      switch(counter){
                          case 0:
                            status = dbconn;
                          break;
                          case 1:
                            userName = dbconn;
                          break;
                          case 2:
                            apword = dbconn;
                          break;
                      counter++;
                  br.close();
        }catch(IOException e){
        }

  • How can we change the time of the media file from java code ?

    Hi,
    particularly, how can we start the media file from the second 55 and not from the second 0 (beginning) ?
    Thanks.

    I tryed to use such method but an exception was raised:
    javax.media.NotRealizedError: Cannot set media time on a unrealized controller
         at com.sun.media.BasicPlayer.setMediaTime(BasicPlayer.java:427)
         at com.sabily.mualim.main.MediaFileDemo.loadMediaFile(MediaFileDemo.java:72)
         at com.sabily.mualim.main.MediaFileDemo.<init>(MediaFileDemo.java:77)
         at com.sabily.mualim.main.MualimStandalone.main(MualimStandalone.java:12)
    Exception in thread "main" javax.media.NotRealizedError: Cannot set media time on a unrealized controller
         at com.sun.media.BasicPlayer.setMediaTime(BasicPlayer.java:427)
         at com.sabily.mualim.main.MediaFileDemo.loadMediaFile(MediaFileDemo.java:72)
         at com.sabily.mualim.main.MediaFileDemo.<init>(MediaFileDemo.java:77)
         at com.sabily.mualim.main.MualimStandalone.main(MualimStandalone.java:12)
    below is the code related to playing media file:
    package com.sabily.mualim.main;
    import java.awt.BorderLayout;
    import java.awt.Component;
    import java.awt.Container;
    import java.awt.Panel;
    import java.io.IOException;
    import java.net.MalformedURLException;
    import java.net.URL;
    import javax.media.ControllerAdapter;
    import javax.media.ControllerListener;
    import javax.media.Manager;
    import javax.media.NoPlayerException;
    import javax.media.Player;
    import javax.media.RealizeCompleteEvent;
    import javax.media.Time;
    import javax.media.TimeBase;
    import javax.swing.JFrame;
    import javax.swing.JPanel;
    public class MediaFileDemo extends JFrame{
         private Player player;
         Component center;
         Component south;
         private void loadMediaFile() {
              final Container contentPane = getContentPane();
              if (player != null) {
                   player.stop();
              try {
    //               player = Manager.createPlayer(new URL("file:C:/Nouveau dossier/e1_intro.wav"));
                   player = Manager.createPlayer(new URL("file:C:/mp3/001.wav"));
                   //player = Manager.createPlayer(new URL("file:D:/Film/Earth_Planet/Planet.Earth.EP08.Jungles/Planet.Earth.EP08.Jungles.avi"));
              } catch (NoPlayerException e) {
                   e.printStackTrace();
              } catch (MalformedURLException e) {
                   e.printStackTrace();
              } catch (IOException e) {
                   e.printStackTrace();
              ControllerListener listener = new ControllerAdapter() {
                   public void realizeComplete(RealizeCompleteEvent event) {
                        Component vc = player.getVisualComponent();
                        if (vc != null) {
                             contentPane.add(vc, BorderLayout.CENTER);
                             center = vc;
                        } else {
                             if (center != null) {
                                  contentPane.remove(center);
                                  contentPane.validate();
                        Component cpc = player.getControlPanelComponent();
                        if (cpc != null) {
                             contentPane.add(cpc, BorderLayout.SOUTH);
                             south = cpc;
                        } else {
                             if (south != null) {
                                  contentPane.remove(south);
                                  contentPane.validate();
                        pack();
                        //setTitle("Lesson 1");
              player.addControllerListener(listener);
              player.setMediaTime(new Time(15));
              player.start();
         public MediaFileDemo() {
              loadMediaFile();
         public Player getPlayer() {
              return player;
         public void setPlayer(Player player) {
              this.player = player;
    Best Regards

  • Running a jar file from java code

    Hi!
    Im trying to run a jar file from my code.
    I've tried Classloader, but that doesnt work because it doesnt find the images (also embedded in the 2nd jar file).
    WHat I would like to do is actually RUN the 2nd jar file from the first jar file. There must be a way to do this right?
    any ideas?

    ok, I found some wonderful code (see below) that will try to start the jar. But it doesn't. What it does is produce the following error when my application runs...
    So it's not finding the images in the jar file that I am trying to run? Strange. I checked the URL that sending, but it seems ok....
    I think I will check the url again to make sure......
    any ideas?
    Uncaught error fetching image:
    java.lang.NullPointerException
         at sun.awt.image.URLImageSource.getConnection(Unknown Source)
         at sun.awt.image.URLImageSource.getDecoder(Unknown Source)
         at sun.awt.image.InputStreamImageSource.doFetch(Unknown Source)
         at sun.awt.image.ImageFetcher.fetchloop(Unknown Source)
         at sun.awt.image.ImageFetcher.run(Unknown Source)
    the code....
    /* From http://java.sun.com/docs/books/tutorial/index.html */
    import java.io.IOException;
    import java.lang.reflect.InvocationTargetException;
    import java.lang.reflect.Method;
    import java.lang.reflect.Modifier;
    import java.net.JarURLConnection;
    import java.net.MalformedURLException;
    import java.net.URL;
    import java.net.URLClassLoader;
    import java.util.jar.Attributes;
    * Runs a jar application from any url. Usage is 'java JarRunner url [args..]'
    * where url is the url of the jar file and args is optional arguments to be
    * passed to the application's main method.
    public class JarRunner {
      public static void main(String[] args) {
        URL url = null;
        try {
          url = new URL(args[0]);//"VideoTagger.jar");
        } catch (MalformedURLException e) {
          System.out.println("Invalid URL: ");
        // Create the class loader for the application jar file
        JarClassLoader cl = new JarClassLoader(url);
        // Get the application's main class name
        String name = null;
        try {
          name = cl.getMainClassName();
        } catch (IOException e) {
          System.err.println("I/O error while loading JAR file:");
          e.printStackTrace();
          System.exit(1);
        if (name == null) {
          fatal("Specified jar file does not contain a 'Main-Class'"
              + " manifest attribute");
        // Get arguments for the application
        String[] newArgs = new String[args.length - 1];
        System.arraycopy(args, 1, newArgs, 0, newArgs.length);
        // Invoke application's main class
        try {
          cl.invokeClass(name, newArgs);
        } catch (ClassNotFoundException e) {
          fatal("Class not found: " + name);
        } catch (NoSuchMethodException e) {
          fatal("Class does not define a 'main' method: " + name);
        } catch (InvocationTargetException e) {
          e.getTargetException().printStackTrace();
          System.exit(1);
      private static void fatal(String s) {
        System.err.println(s);
        System.exit(1);
    * A class loader for loading jar files, both local and remote.
    class JarClassLoader extends URLClassLoader {
      private URL url;
       * Creates a new JarClassLoader for the specified url.
       * @param url
       *            the url of the jar file
      public JarClassLoader(URL url) {
        super(new URL[] { url });
        this.url = url;
       * Returns the name of the jar file main class, or null if no "Main-Class"
       * manifest attributes was defined.
      public String getMainClassName() throws IOException {
        URL u = new URL("jar", "", url + "!/");
        JarURLConnection uc = (JarURLConnection) u.openConnection();
        Attributes attr = uc.getMainAttributes();
        return attr != null ? attr.getValue(Attributes.Name.MAIN_CLASS) : null;
       * Invokes the application in this jar file given the name of the main class
       * and an array of arguments. The class must define a static method "main"
       * which takes an array of String arguemtns and is of return type "void".
       * @param name
       *            the name of the main class
       * @param args
       *            the arguments for the application
       * @exception ClassNotFoundException
       *                if the specified class could not be found
       * @exception NoSuchMethodException
       *                if the specified class does not contain a "main" method
       * @exception InvocationTargetException
       *                if the application raised an exception
      public void invokeClass(String name, String[] args)
          throws ClassNotFoundException, NoSuchMethodException,
          InvocationTargetException {
        Class c = loadClass(name);
        Method m = c.getMethod("main", new Class[] { args.getClass() });
        m.setAccessible(true);
        int mods = m.getModifiers();
        if (m.getReturnType() != void.class || !Modifier.isStatic(mods)
            || !Modifier.isPublic(mods)) {
          throw new NoSuchMethodException("main");
        try {
          m.invoke(null, new Object[] { args });
        } catch (IllegalAccessException e) {
          // This should not happen, as we have disabled access checks
    }

  • Unable to connect the server, while open the rpt file in server from java.

    Hi,
    I have written one java class, that class deployed in solaris server. The BO server is avilable in another solaris server. i want to convert the rpt file to pdf format. for that i try to give the file path to the server for opening the rpt file, that time i got the follwoing error:
    com.crystaldecisions.sdk.occa.report.lib.ReportSDKServerException:
    Unable to connect to the server: uinbrdcsap02. --- Connection refused
    (errno:239)---- Error code:-2147217387 Error code name:connectServer
            at
    com.crystaldecisions.sdk.occa.report.lib.ReportSDKServerException.throwR
    eportSDKServerException(Unknown Source)
            at
    com.crystaldecisions.proxy.remoteagent.TCPIPCommunicationAdapter.connect
    (Unknown Source)
            at com.crystaldecisions.proxy.remoteagent.z.a(Unknown Source)
            at
    com.crystaldecisions.sdk.occa.report.application.ReportAppSession.int(Un
    known Source)
            at
    com.crystaldecisions.sdk.occa.report.application.ReportAppSession.initia
    lize(Unknown Source)
    *My java code is the following ..*
    package com.ramco.report;
    //Crystal Java Reporting Component (JRC) imports.     
    import java.io.File;
    import java.io.FileInputStream;
    import java.io.ByteArrayInputStream;
    import java.io.FileOutputStream;
    import java.io.IOException;
    import java.io.ByteArrayOutputStream;
    import java.sql.Connection;
    import java.sql.CallableStatement;
    import java.sql.Statement;
    import java.sql.ResultSet;
    import java.sql.SQLException;
    import java.text.SimpleDateFormat;
    import com.crystaldecisions.sdk.occa.report.exportoptions.ReportExportFormat;
    import com.crystaldecisions.sdk.occa.report.exportoptions.ExportOptions;
    import java.util.Calendar;
    import java.util.Properties;
    import org.apache.log4j.Logger;
    import org.apache.log4j.SimpleLayout;
    import org.apache.log4j.FileAppender;
    import java.net.InetAddress;
    import java.net.UnknownHostException;
    // Class file starting.
    public class StandardReconReport
         private Connection objConnection = null;
         private DBConnection dbconnection = null;
         private ByteArrayInputStream byteArrayInputStream =null;
         private FileOutputStream fileOutputStream = null;     
         private ByteArrayOutputStream byteArrayOutputStream = null;
         private CallableStatement callablestatement = null;
         private CallableStatement callablestatement1 = null;     
         private ResultSet resultset1 = null;
         private ResultSet resultset = null;
         private String Deal_No = null;
         private String Job_Date = null;     
         private String Reportservername = null;
         private SimpleLayout layout   = null;
         private FileAppender appender = null;
         private Logger logger            = null;
         private String     DateTimeFormat = null;
         private String Report_File_path =null;
         private String Pdf_File_Name = null;     
         private Properties properties = null;
         private String LogFilePath = null;
         private String FileName = null;
         private String FullLogFilePath = null;
         private Statement statement = null;
         private String Report_upload_path = null;
         private String StanReconDir = null;
         private String winandsol = null;
         private com.crystaldecisions.sdk.occa.report.application.ReportClientDocument  reportClientDoc = null;
         private int count_tmp=0;
         private String DATE_FORMAT = null;
         private String dateformat = null;
         private Calendar cal = null;
        private SimpleDateFormat sdf = null;
        private String reconfilename = null;    
         // Method for Generating Report.....
         private void stanReportGeneration()
              try
                   properties = new Properties();
                   properties.clear();
                 properties.load(new FileInputStream("GeneralInfo.properties"));
                 Reportservername = properties.getProperty("reportservername");
                 reconfilename = properties.getProperty("reconfilename");
                 layout = new SimpleLayout();
                   LogFilePath = properties.getProperty("logfilepath");               
                   dateformat = dateTime1(properties.getProperty("dateformat1"));
                   StanReconDir = properties.getProperty("stanrecondir");
                  winandsol = properties.getProperty("windowsandsolaris");        
                  if (new File(LogFilePath).exists())
                       LogFilePath = LogFilePathdateformatwinandsol;
                       if (new File(LogFilePath).exists())
                       else
                            new File(LogFilePath).mkdirs();
                  FileName = "STANRECONLOGFILE-";             
                  FileName = FileNamedateformat".txt";             
                  FullLogFilePath = LogFilePath+FileName;
                  appender = new FileAppender(layout,FullLogFilePath,false);
                 logger = Logger.getLogger("MyLogger");
                 logger.addAppender(appender);
                 DateTimeFormat = properties.getProperty("datetimeformat");       
                 logger.info("The Start Recon Report Start Time: " +dateTime(DateTimeFormat));             
                 logger.info("");            
                 try
                      InetAddress address[] = InetAddress.getAllByName(Reportservername);                 
                     for (int i=0; i<address.length;i++)
                          logger.info("Report Server Name: " + address<i>.getHostName());
                          logger.info("Report Server Address: " + address<i>.getHostAddress());
                          logger.info("Report Server Canonical: " + address<i>.getCanonicalHostName());
                 catch (UnknownHostException e)
                      logger.error("The host "Reportservername"is not avilable");
                 Report_File_path = properties.getProperty("StandardReconReportpath");          
                  logger.info("The Report File Name is : "+Report_File_path " - "dateTime(DateTimeFormat));
                  //Report_File_path="rassdk://"+Report_File_path;
                  try
                       //Getting the Database connection....
                       dbconnection = new DBConnection();
                      objConnection = dbconnection.getConnections();
                      statement = objConnection.createStatement();
                      String sqlQuery = "SELECT TRIM(PARAM_VALUE) FROM SYS_USER_PARAM WHERE COMPONENT = 'REPORT' AND LINE_NO = 1 AND PARAM_NAME = 'REPORT_DOWNLOADPATH' AND STATUS = 'A'";
                      resultset = statement.executeQuery(sqlQuery);
                      while(resultset.next())
                           Report_upload_path = resultset.getString(1);
                           logger.info("Report_upload_path from the DB: "+Report_upload_path);
                  catch (SQLException ex)
                       ex.printStackTrace();
                       System.out.println(ex);
                       logger.error(ex);
                  catch(Exception ex)
                       ex.printStackTrace();
                       System.out.println(ex);
                       logger.error(ex);
                  finally
                       if(statement!=null)
                            statement.close();
                       if(resultset!=null)
                            resultset.close();
                  if (new File(Report_upload_path).exists())
                       Report_upload_path = Report_upload_path+StanReconDir;
                       if (new File(Report_upload_path).exists())
                            System.out.println("Directory is avilable"+Report_upload_path);
                       else
                            new File(Report_upload_path).mkdirs();
                  Report_upload_path = Report_upload_pathwinandsoldateformat+winandsol;              
                  if (new File(Report_upload_path).exists())
                  else
                       new File(Report_upload_path).mkdirs();
                  logger.info("Report_upload_path : "Report_upload_path" : "+dateTime(DateTimeFormat));
                  try
                       logger.info("Calling the REPORT_STAN_RECON_CON SP : "+dateTime(DateTimeFormat));
                      callablestatement = objConnection.prepareCall("{call REPORT_STAN_RECON_CON(?)}");
                      callablestatement.registerOutParameter(1, oracle.jdbc.driver.OracleTypes.CURSOR);
                        callablestatement.execute();
                        resultset=(ResultSet)callablestatement.getObject(1);
                        if(resultset!=null)
                             while(resultset.next())
                                  count_tmp = count_tmp+1;
                                  logger.info("");                              
                                 Deal_No   = resultset.getString(1);
                                  Job_Date = resultset.getString(2);
                                  DATE_FORMAT = resultset.getString(3);
                                  Job_Date = Job_Date.substring(0,10);
                                  logger.info("*********** PDF Convertion Starting for a Deal No: " +Deal_No " :: "dateTime(DateTimeFormat));
                                  Pdf_File_Name = Report_upload_pathreconfilenameDeal_No"-"DATE_FORMAT+".pdf";                              
                                  Job_Date = Job_Date.replace('-', '/');
                                  logger.info("The Deal_No is : "+Deal_No " - "dateTime(DateTimeFormat));
                                  logger.info("The Job_Date is : "+Job_Date " - "dateTime(DateTimeFormat));
                                  try
                                     reportClientDoc = new com.crystaldecisions.sdk.occa.report.application.ReportClientDocument();
                                       reportClientDoc.setReportAppServer(Reportservername);                                   
                                       logger.info("Report App server Name := "+ reportClientDoc.getReportAppServer());
                                       logger.info("Report_File_path  := "+ Report_File_path);                             
                                       reportClientDoc.preCreateServerAgent(true);                            
                                       reportClientDoc.open(Report_File_path,0);                         
                                       logger.info("After opening the RTF file for : "+Deal_No " Deal_No - "dateTime(DateTimeFormat));
                                                 callablestatement1 = objConnection.prepareCall("{call REPORT_STANDARD_RECON(?,?,?,?)}");
                                       callablestatement1.setString(1, Job_Date);
                                       callablestatement1.setString(2, Deal_No);
                                       callablestatement1.setString(3,"");
                                       callablestatement1.registerOutParameter(4, oracle.jdbc.driver.OracleTypes.CURSOR);
                                       callablestatement1.execute();
                                       resultset1=(ResultSet)callablestatement1.getObject(4);
                                       String tableAlias = reportClientDoc.getDatabaseController().getDatabase().getTables().getTable(0).getAlias();
                                       reportClientDoc.refreshReportDocument();
                                       reportClientDoc.getDatabaseController().setDataSource(resultset1, tableAlias , "Result Set");
                                       reportClientDoc.refreshReportDocument();                         
                                       ExportOptions oExportOptions = new ExportOptions();
                                       oExportOptions.setExportFormatType(ReportExportFormat.RTF);
                                       byteArrayInputStream = (ByteArrayInputStream)reportClientDoc.getPrintOutputController().export(ReportExportFormat.PDF);
                                       logger.info("After exporting the report file to PDF file for the : "+Deal_No " Deal_No - "dateTime(DateTimeFormat));
                                       //Use the Java I/O libraries to write the exported content to the file system.
                                       byte byteArray[] = new byte[byteArrayInputStream.available()];     
                                       //Create a new file that will contain the exported result.
                                       logger.info("Successfully exported report to " + Report_File_path" - "dateTime(DateTimeFormat));
                                       logger.info("*********** PDF Convertion Ending for a Deal : "Deal_No" "+dateTime(DateTimeFormat));
                                       logger.info("");
                                       Deal_No   = null;
                                       Job_Date  = null;
                                  catch (SQLException ex)
                                      ex.printStackTrace();
                                      System.out.println(ex);
                                      logger.error(ex);
                                  catch (IOException ex)
                                      ex.printStackTrace();
                                      System.out.println(ex);
                                      logger.error(ex);
                                  catch (Exception ex)
                                       ex.printStackTrace();
                                      System.out.println(ex);
                                      logger.error(ex);
                                  finally
                                       if(byteArrayInputStream!=null)
                                            byteArrayInputStream.close();
                                       if(byteArrayOutputStream!=null)
                                            byteArrayOutputStream.close();
                                       if(fileOutputStream!=null)
                                            fileOutputStream.close();
                                       if(callablestatement1!=null)
                                            callablestatement1.close();
                                       if(resultset1!=null)
                                            resultset1.close();
                                       if(reportClientDoc!=null)
                                            reportClientDoc.close();
                        if(count_tmp==0)
                             logger.info("");
                             logger.info(" $$$$$$$$ There is NO DATA for generating the Report $$$$$$$: " +dateTime(DateTimeFormat));
                  catch (SQLException ex)
                       ex.printStackTrace();
                       System.out.println(ex);
                       logger.error(ex);
                  catch (Exception ex)
                        ex.printStackTrace();
                       System.out.println(ex);
                       logger.error(ex);
                  finally
                       if(callablestatement!=null)
                            callablestatement.close();
                       if(resultset!=null)
                            resultset.close();
                       if(objConnection!=null)
                            objConnection.close();
                       if(callablestatement1!=null)
                            callablestatement1.close();
                       if(resultset1!=null)
                            resultset1.close();
              catch (IOException ex)
                  ex.printStackTrace();
                  System.out.println(ex);
                  logger.error(ex);
              catch (Exception ex)
                   ex.printStackTrace();
                  System.out.println(ex);
                  logger.error(ex);
              finally
                  properties.clear();              
              logger.info("");
              logger.info("*******Standard Recon Report End Time*******: "+dateTime(DateTimeFormat));
         // Getting the current date and time..
         public String dateTime(String dateFormat)
              cal = Calendar.getInstance();
             sdf = new SimpleDateFormat(dateFormat);
             return sdf.format(cal.getTime());
         //Getting the Yesterday Date and time...
         public String dateTime1(String dateFormat)
              cal = Calendar.getInstance();
              cal.add(Calendar.DATE, -1);            
             sdf = new SimpleDateFormat(dateFormat);
             return sdf.format(cal.getTime());
         public static void main(String[] args) {
              StandardReconReport  SR = new StandardReconReport();
              SR.stanReportGeneration();
    For the above code  i given the report parameter from  the property file.
    reportservername=servername
    datagenreportpath=rassdk\://C\:
    MyEclipseWorkPlace
    IDSREPORTGENERATION
    REPORTFILES
    STANDARD_RECON_REPORT.rpt
    The code is working fin, while i try to connect the BO which is avilble in Windows server, but this is not working if the BO is avilble in solaris server.
    Any bodies please help
    Edited by: velmurugan.spn on Sep 12, 2009 6:38 AM

    Hi,
    Not able to find Report - Standard templates or Report - Custom templates view in Administration - BIP reports in Siebel 8.1.1.3?
    We have applied 8.1.1.3 patch on 8.1.1.0
    below are the steps followed
    Reports are not generated after 8.1.1.3 patch installtion.
    we have also followed to below steps mentioned for this issue in oracle support.
    "In order to resolve this behavior it is necessary to ensure that the 8.1.1.3 FixPack has been applied to the Siebel Tools installation. This will provide an additional .zip file in the REPPATCH folder of the Siebel Tools installation. Once this has been done please then follow the configuration steps as documented :
    change sysprefix to X_ before sif import and chage back to SBL_ after sif import.
    1) Import the sif files from Siebel\8.1\Tools_1\REPPATCH\12-1VMBCSV.zip
    2) Import the 4 SIF files in the following order:
    S_XMLP_REP_TMPL_02112010.sif
    SBL_XMLP_REPORT_SELECTION_FLG.sif
    Report Template BC.sif
    Report Template Registration Applet.sif
    3)Apply the DDL for table S_XMLP_REP_TMPL and compile repository
    Once the above steps have been completed the Selected Record flag will appear in the Report Template Registration views."
    we still not able to generated able to generate reports even after following above steps.
    Thanks
    Sean

  • Run a sql file from java

    I have a SQL file named myfile.sql which contains something as follows:-Declare
    Begin
    insert into alphaweb values (1);
    end;
    .What I am looking for is a way to execute this through a java code. e.g. something like reading the String from the the file and executing it.
    public static boolean executeScript(File script, Connection conn) {
              boolean success = true;
              success = script.exists();
              if (success) {
                   System.out.println("ES::READING SCRIPT:" + script.getAbsolutePath());
                   StringBuffer buffer = null;
                   try {
                        buffer = readFileAsString("myfile.sql");
                   } catch (IOException e1) {
                        // TODO Auto-generated catch block
                        e1.printStackTrace();
                   }//new StringBuffer();
                   //success = readScript(script, buffer);
                   if (null!=buffer) {
                        try {
                             String creationScript = buffer.toString();
                             Statement st = conn.createStatement();
                             int start = 0;
                             int end = 0;
                             while (end != -1 && start < creationScript.length()) {
                                  end = creationScript.lastIndexOf ('/');
                                  if (end != -1) {
                                       System.out.println(creationScript.substring(start, end));
                                       st.executeUpdate(creationScript.substring(start, end));
                                       start = end + 2; // 2 is the length of "GO"
                             st.close();
                        } catch (Exception e) {
                             success = false;
                             System.out.println(e);
              } else {
                   System.out.println("ES::SCRIPT FILE DOES NOT EXISTS");
                   success = false;
              return success;
         }But it is failing any ideas if it is possible and what am I doing wrong?

    I believe the sample that you provided only has a single statement in it.
    Do the files only contain one block like that?
    If yes then you should be able to process them as a single statement. Just drop the terminator at the end (maybe wrap it in another block statement...)
    If not then your solutions are.
    1. Parse the file yourself.
    2. Use the oracle command line tool and feed it to that.

  • Problem accessing variables from java file to JSP page

    Hello Everyone,
    I have small problem accessing my method variables from my java bean file to a JSP page. can some please take a look and tell me why I can't populate my JSP page, I've been trying all day to get this done!!!
    This is my Java file
    package dev;
    import java.io.*;
    import java.util.*;
    public class RoundDetail2
    public String string_gameID;
    public int string_card1;
    public String readDetail_topLayer;
    public static final String SUITS[] = {" ", "Clubs", "Hearts", "Spades", "Diamonds", "Joker", "FaceDown"};
    public static final String VALUES[] = {"Joker ","Ace", "Two", "Three", "Four", "Five", "Six", "Seven", "Eight", "Nine", "Ten", "Jack", "Queen", "King"};
    public static final String SuitVALUES[] = {" ","1","2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14"};
    public RoundDetail2() throws FileNotFoundException
    DataInputStream inFile=
                 new DataInputStream(
                    new BufferedInputStream(
                   new FileInputStream("C:/apps/jakarta-tomcat-4.0.6/webapps/ROOT/WEB-INF/classes/dev/Data_452SY2.txt")));
    try { 
                 while((readDetail_topLayer = inFile.readLine()) != null)
              StringTokenizer tokenizer_topLayer = new StringTokenizer(readDetail_topLayer,"\t", true);
                   while  (tokenizer_topLayer.hasMoreTokens())
                        string_gameID = tokenizer_topLayer.nextToken();
         catch(IOException e)
                    System.out.println(e.getMessage());
         Thanks KT

    ......How are you declaring the class in your JSP? ... are you instantiating it as a bean using the useBean tag, or just instantiating it in your code like normal.
    Maybe you could post the relevant JSP code too?
    Hello again,
    Only the last string is populating after the file has be tokenized. What I'll like to accomplish is passing the very first string in the file. I did not get too far in the JSP file setup because the code is still in it's testing stage, but any help will be highly appreciated.
    Here is the JSP code
    <%@page import="dev.*" %>
    <%@page session="true" language="java" import="java.io.*" %>
    <jsp:useBean id="wagerhist" scope="request" class="dev.RoundDetail2" />
    <html>
    <head>
    <title>Round Detail</title>
    <body>
      <table width="530" bordercolor="#000000" valign="top">
        <tr>
              <td align="left"  width="19%">Game ID<%=wagerhist.string_gameID%></td>
              <td align="left"  width="30%">  </td>
              <td align="left"  width="20%">card1</td>
              <td align="left"  width="31%">  </td>
            </tr>
      </table>
    </body>
    </html>

Maybe you are looking for

  • Cannot create new events in iCal - they dissappeaar after quitting

    Hello there, I've used iCal for many years with no problem. Recently I noticed that events were dissappearing. I can add events and use iCal as normal as long as I don't quit the program or restart my computer. I can put the computer to sleep and all

  • How to do GI and GR in PI sheet

    Dear all, Please explain me clearly how to do Goods Issue and Goods Recipt in Using PI Sheet. If i use call function using process instruction TA_CALL t code migo that particular process orde no  will not come automatically how to do pls explain me s

  • Small UI for 1920x1080 resolution?

    Hi, I have this new high DPI display, and I want to make itunes look good. First I had this blurry UI: [url=http://postimg.org/image/5pg634vbf/][img]http://s17.postimg.org/5pg634vbf/Untitl ed.jpg[/img][/url] then, I used the "diasable display scaling

  • Is it possible to add a crystal report to BP maintenance screen

    In SAP 8.8 we would like to use a Crystal Report statement of account and be able to click on the screen and run the report. is there a way in 8.8 to attach a Crystal report to a screen? Thanks

  • Tiered DMZ Design Question

    I am working on taking our ASA5510 into the 21st century and putting a two tiered DMZ into place.  I just wanted some advice on how a tiered DMZ is typically configured and used. To start off we 100% virtualized so this will all be done with sub-inte