How to process Large Image Files (JP2 220MB+)?

All,
I'm relatively new to Java Advanced Imaging, so I need a little help. I've been working on a thesis that involves converting digital terrain data into X3D scenes for future use in military training and applications. Part of this work involves processing large imagery data to texture the previously mentioned terrain data. I have an image slicer that can handle rather large files (200MB+ jpeg files). But it can't seem to process jpeg 2000 data. Below is an excerpt from my code.
public void testSlicer(){
String fname = "file.jp2";
Iterator readers = ImageIO.getImageReadersByFormatName("jpeg2000");
ImageReader imageReader = (ImageReader) readers.next();
try {
ImageInputStream imageInputStream = ImageIO.createImageInputStream(new File(fname));
imageReader.setInput(imageInputStream, true);
} catch (IOException ex) {
System.out.println("Error: " + ex);
ImageReadParam imageReadParam = imageReader.getDefaultReadParam();
BufferedImage destBImage = new BufferedImage(256, 256, BufferedImage.TYPE_INT_RGB);
Rectangle rect = new Rectangle(0, 0, 1000, 1000);
//Only reading a portion of the file
imageReadParam.setSourceRegion(rect);
//Used to subsampling every 4th pixel
imageReadParam.setSourceSubsampling(4, 4, 0, 0);
try {
destBImage = imageReader.read(0, imageReadParam);
} catch (IOException ex) {
System.out.println("IO Exception: " + ex);
The images I am trying to read are in excess of 30000 pixels by 30000 pixels (15m resolution at 5 degrees latitude and 6 degrees longitude). I continually get an OutOfMemoryError, though I am pumping up the heap size to 16000MB when using the command line.
Any help would be greatly appreciated.

Hi,
In general, an extra sizing for XI memory consumption is not required. The total memory of the SAP Web Application Server should be sufficient except in the case of large messages (>1MB).
To determine the memory consumption for processing large messages, you can use the following rules of thumb:
Allocate 3 MB per process (for example, the number of parallel messages per second may be an indicator)
Allocate 4 kB per 1kB of message size in the asynchronous case or 9 kB per 1kB message size in the synchronous case
Example: asynchronous concurrent processing of 10 messages with a size of 1MB requires 70 MB of memory
(3MB + 4 * 1MB) * 10 = 70 MB With mapping or content-based routing where an internal representation of the message payload may be necessary, the memory requirements can be much higher (possibly exceeding 20 kBytes per 1kByte
message, depending on the type of mapping).
The size of the largest message thus depends mainly on the size of the available main memory. On a normal 32Bit operating system, there is an upper boundary of approximately 1.5 to 2 GByte per process, limiting the respective largest message size.
please check these links..
/community [original link is broken]:///people/michal.krawczyk2/blog/2006/06/08/xi-timeouts-timeouts-timeouts
Input Flat File Size Determination
/people/shabarish.vijayakumar/blog/2006/04/03/xi-in-the-role-of-a-ftp
data packet size  - load from flat file
How to upload a file of very huge size on to server.
Please let me know , your problem is solved or not..
Regards
Chilla..

Similar Messages

  • How to process large data files in XI  ?  100 MB files ?

    Hi All
       At present we have a scenario as follows
      It is File to IDoc ....Problem is the size of the file
      We need to transfer 100mb file to SAP R/3 system ? So this huge data how to
      process ?
    Adv thanx and regards
    Rakesh

    Hi,
    In general, an extra sizing for XI memory consumption is not required. The total memory of the SAP Web Application Server should be sufficient except in the case of large messages (>1MB).
    To determine the memory consumption for processing large messages, you can use the following rules of thumb:
    Allocate 3 MB per process (for example, the number of parallel messages per second may be an indicator)
    Allocate 4 kB per 1kB of message size in the asynchronous case or 9 kB per 1kB message size in the synchronous case
    Example: asynchronous concurrent processing of 10 messages with a size of 1MB requires 70 MB of memory
    (3MB + 4 * 1MB) * 10 = 70 MB With mapping or content-based routing where an internal representation of the message payload may be necessary, the memory requirements can be much higher (possibly exceeding 20 kBytes per 1kByte
    message, depending on the type of mapping).
    The size of the largest message thus depends mainly on the size of the available main memory. On a normal 32Bit operating system, there is an upper boundary of approximately 1.5 to 2 GByte per process, limiting the respective largest message size.
    please check these links..
    /community [original link is broken]:///people/michal.krawczyk2/blog/2006/06/08/xi-timeouts-timeouts-timeouts
    Input Flat File Size Determination
    /people/shabarish.vijayakumar/blog/2006/04/03/xi-in-the-role-of-a-ftp
    data packet size  - load from flat file
    How to upload a file of very huge size on to server.
    Please let me know , your problem is solved or not..
    Regards
    Chilla..

  • How to increase performance speed of Photoshop CS6 v13.0.6 with trasformations in LARGE image files (25,000 X 50,000 pixels) on IMac3.4 GHz Intel Core i7, 16 GB memory, Mac OS 10.7.5?   Should I purchase a MacPro?

    I have hundreds of these large image files to process.  I frequently use SKEW, WARP, IMAGE ROTATION features in Photoshop.  I process the files ONE AT A TIME and have only Photoshop running on my IMac.  Most of the time I am watching SLOW progress bars to complete the transformations.
    I have allocated as much memory as I have (about 14GB) exclusively to Photoshop using the performance preferences panel.  Does anyone have a trick for speeding up the processing of these files--or is my only solution to buy a faster Mac--like the new Mac Pro?

    I have hundreds of these large image files to process.  I frequently use SKEW, WARP, IMAGE ROTATION features in Photoshop.  I process the files ONE AT A TIME and have only Photoshop running on my IMac.  Most of the time I am watching SLOW progress bars to complete the transformations.
    I have allocated as much memory as I have (about 14GB) exclusively to Photoshop using the performance preferences panel.  Does anyone have a trick for speeding up the processing of these files--or is my only solution to buy a faster Mac--like the new Mac Pro?

  • How to add an image file to Oracle db?

    Need help urgently....Anybody knows how to add an image file (example: jpg)into one of the fields in Oracle database??

    This will do the job..
    package forum;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.io.*;
    import java.util.*;
    import java.sql.*;
    import oracle.jdbc.driver.*;
    //import oracle.sql.*;
    Wanneer een request.getInputStream wordt geconferteerd naar een "String" (zie later) dan ziet de output in tekstformaat er als volgt uit:
    -----------------------------7d280152604f4 Content-Disposition: form-data; name="oploadfile"; filename="C:\WINNT\Profiles\mvo\Desktop\boodschap.txt" Content-Type: text/plain Deze boodschap dient te worden ge-insert in de database. -----------------------------7d280152604f4 Content-Disposition: form-data; name="StadID" 1234 -----------------------------7d280152604f4 Content-Disposition: form-data; name="SuccessPage" /forum/error.jsp -----------------------------7d280152604f4--
    of opgesplitst
    contentType........... multipart/form-data; boundary=---------------------------7d235ade00f0
    filename.............. "C:\Documents and Settings\Administrator\Desktop\boodschap.txt"
    MIME type............. text/plain
    Wat in database moet.. Dit is de eigenlijke boodschap die moet worden ge-insert in de database.
    Eind boundary......... -----------------------------7d235ade00f0 Content-Disposition: form-data; name="file1"; filename="" Content-Type: application/octet-stream -----------------------------7d235ade00f0--
    We gaan achtereenvolgens:
    1. Kijken of het van het "multipart/form-data" type is (uploaden) en strippen van eerste boundery.
    1.a Geen "multipart/form-data" ? dan... error message
    1.b Groter dan MAX_SIZE ?..dan .. error message
    2. Filenaam van de te uploaden file uitlezen
    3. Mimetype bepalen en bepalen in welke positie van de string het Mimetype ophoudt, cq waar te uploaden file begint
    4. Bepalen waar eind boundery begint
    5. De eigenlijke file uitlezen
    6. Terug converteren naar bytes
    public class WriteBlob extends HttpServlet {
    public static final int MAX_SIZE = ParameterSettings.imageUpload;
    String successMessage = "";
    public void init(ServletConfig config) throws ServletException {
    super.init(config);
    * Process the HTTP Get request
    public void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
    DataInputStream in = null;
    FileOutputStream fileOut= null;
    PrintWriter out = response.getWriter();
    int kb_size = 0;
    boolean pass2 = true;
    String message = "";
    String responseRedirect = "/forum/uploaden.jsp?message="+" Uploaden geslaagd";
    try
    //get content type of client request
    String contentType = request.getContentType();
    // Start stap 1...content type is multipart/form-data
    if(contentType != null && contentType.indexOf("multipart/form-data") != -1)
    //open input stream
    in = new DataInputStream(request.getInputStream());
    //get length of content data
    int formDataLength = request.getContentLength(); // totale lengte van de inputstream
    //initieer een byte array om content data op te slaan
    byte dataBytes[] = new byte[formDataLength];
    //read file into byte array
    int bytesRead = 0;
    int totalBytesRead = 0;
    int sizeCheck = 0;
    while (totalBytesRead < formDataLength)
    //kijken of de file niet te groot is
    sizeCheck = totalBytesRead + in.available();
    if (sizeCheck > MAX_SIZE)
    pass2 = false;
    message = "Sorry. U kunt slechts bestanden uploaden tot een grootte van 500KB";
    responseRedirect = "/forum/uploaden.jsp?message="+message;
    bytesRead = in.read(dataBytes, totalBytesRead,formDataLength);
    totalBytesRead += bytesRead;
    if (pass2==true)
    kb_size = (int)(formDataLength/1024);
    //create string from byte array for easy manipulation
    String file = new String(dataBytes);
    /*get boundary value (boundary is a unique string that separates content data)
    contentType........... multipart/form-data; boundary=---------------------------7d235ade00f0
    int lastIndex = contentType.lastIndexOf("=");
    String boundary = contentType.substring(lastIndex+1, contentType.length());
    // Stap 2.....bepaal de naam van de upload file
    // filename.............. "C:\Documents and Settings\Administrator\Desktop\boodschap.txt"
    String saveFile = file.substring(file.indexOf("filename=\"")+10);
    saveFile = saveFile.substring(0,saveFile.indexOf("\n"));
    saveFile = saveFile.substring(saveFile.lastIndexOf("\\")+1,saveFile.indexOf("\"")); //naam van de file...boodschap.txt
    String saveFileName = saveFile;
    // Stap 3..Bepaal MIME Type en de positie van eind mime type in string
    voorbeeld: -----------------------------7d23d21220524 Content-Disposition: form-data; name="file0"; filename="C:\WINNT\Profiles\mvo\Desktop\z clob.txt" Content-Type: text/plain
    String restant = "";
    int pos; //position in upload file
    // bijv .. filename="C:\Documents and Settings\Administrator\Desktop\boodschap.txt"
    pos = file.indexOf("filename=\"");
    //find position of content-disposition line
    pos = file.indexOf("\n",pos)+1; // eing file naam + spatie
    // onderstaand geeft bijv Content-Type: text/plain
    restant = file.substring(pos,file.indexOf("\n",pos)-1);
    restant = restant.substring(restant.indexOf(":")+2,restant.length()); // MIME type
    String mimeType = restant;
    //find position of eind content-type line
    pos = file.indexOf("\n",pos)+1;
    //find position of blank line
    pos = file.indexOf("\n",pos)+1;
    int start = pos;
    // Stap 4 eind boundary
    /*find the location of the next boundary marker (marking the end of the upload file data)*/
    int boundaryLocation = file.indexOf(boundary,pos)-4; //waarom -4 ..? ziet er uit als linebreak spatie--boundary=-----------------------------7d21c9ae00f0
    // Stap 5 en 6..de eigelijke te uploaden file in nieuwe byte file inserten
    byte dataBytes2[] = new byte[boundaryLocation-start]; //declareren
    for (int i=0;i<(boundaryLocation-start);i++) // inserten BELANGRIJK !!
    dataBytes2=dataBytes[start+i];
    String next_id = "0";
    Statement statement = null;
    Connection conn = null;
    boolean pass = true;
    ResultSet rs = null;
    Statement stmt_empty = null;
    oracle.sql.BLOB blb = null;
    try
    int vendor = DriverUtilities.ORACLE;
    String username = ConnectionParams.userName;
    String password = ConnectionParams.passWord;
    String connStr = DriverUtilities.makeURL(vendor);
    DriverManager.registerDriver(new oracle.jdbc.driver.OracleDriver());
    conn = DriverManager.getConnection(connStr,username, password);
    if (conn==null){pass=false;}
    } catch (Exception e){out.println("<P>" + "There was an error establishing a connection:");}
    if (pass==true)
    try
    String seq_nextval ="select forum_blob_seq.nextval from dual";
    statement = conn.createStatement();
    ResultSet rset = statement.executeQuery(seq_nextval);
    while (rset.next())
    next_id = rset.getString(1);
    if (next_id.equals("0"))
    message = "Uploaden mislukt !...Er ging wat fout tijdens de interactie met de database";
    responseRedirect = "/forum/uploaden.jsp?message="+message;
    pass = false;
    } catch (Exception e1) { out.println("Error blob1 : "+e1.toString()); };
    } // end pass
    if (pass==true)
    try
    Statement stmt2 = conn.createStatement();
    String insert_empty_blob = "INSERT INTO test_blob(id "+
    ",filename "+
    ",mimetype "+
    ",kb) "+
    "VALUES("+Integer.parseInt(next_id) +
    ",'"+saveFileName+"'"+
    ",'"+mimeType+"'"+
    ","+kb_size+")";
    stmt2.executeQuery(insert_empty_blob);
    conn.commit();
    if (stmt2!= null) {stmt2.close();}else{stmt2.close();pass = false;}
    } catch (Exception e2){
    message = "Uploaden mislukt !...Er ging wat fout tijdens de interactie met de database";
    responseRedirect = "/forum/uploaden.jsp?message="+message;
    out.println("<P>" + "2. There was an error inserting mime type:");}
    } //end pass
    if (pass==true)
    try
    conn.setAutoCommit(false);
    } catch (Exception e3) { pass = false; out.println("Error blob 3: "+e3.toString()); };
    } //end pass
    if (pass==true)
    try
    String Query_blob ="Select test_blob FROM test_blob where id="+next_id+" FOR UPDATE";
    stmt_empty = conn.createStatement();
    rs=stmt_empty.executeQuery(Query_blob);
    } catch (Exception e4) {
    pass = false;
    out.println("Error blob 4: "+e4.toString());
    message = "Uploaden mislukt !...Er ging wat fout tijdens de interactie met de database";
    responseRedirect = "/forum/uploaden.jsp?message="+message;};
    } //end pass
    if (pass==true)
    try
                             if (rs.next())
                             blb = ((OracleResultSet)rs).getBLOB(1);
                        OutputStream stmBlobStream = blb.getBinaryOutputStream();
                             try {
                                  int iSize = blb.getBufferSize();
                             byte[] byBuffer = new byte[iSize];
                             int iLength = -1;
    ByteArrayInputStream stmByteIn = new ByteArrayInputStream(dataBytes2);
                                  try {
    // while ( (iLength = in.read(byBuffer, 0,      iSize)) != -1 )
    while ( (iLength = stmByteIn.read(byBuffer, 0,      iSize)) != -1 )
                                       stmBlobStream.write(byBuffer, 0, iLength);
                                       stmBlobStream.flush();
                                       } // end while
    } catch (Exception e5) {
    pass=false;
    out.println("Error blob 5: "+e5.toString());
    message = "Uploaden mislukt !...Er ging wat fout tijdens de interactie met de database";
    responseRedirect = "/forum/uploaden.jsp?message="+message; }
                                  finally { conn.commit();     }
    } catch (Exception e6) { out.println("Error blob 6: "+e6.toString()); };
                             } //end if rs.next()
                             else {      throw new SQLException("Could not locate message record in database."); }
    } catch (Exception e7) { out.println("Error blob : "+e7.toString()); };
    } // end pass
    } // end pass2
    else //request is not multipart/form-data
    message = "Uploaden mislukt !...Gegevens niet verstuurd via multipart/form-data.";
    responseRedirect = "/forum/error.jsp?message="+message;
    out.println("Request not multipart/form-data.");
    catch(Exception e)
    try
    //print error message to standard out
    out.println("Error in doPost: " + e);
    //send error message to client
    out.println("An unexpected error has occurred.");
    out.println("Error description: " + e);
    }catch (Exception f) {}
    response.sendRedirect(responseRedirect);
    public void doGet(HttpServletRequest request,
    HttpServletResponse response)
    throws ServletException, IOException {
    doPost(request,response);
    Regards
    Martin

  • Flex file upload issue with large image files

         Hello, I have created a sample flex application to upload an image and also created java servlet to upload and save image and deployed in local tomcat server. I am testing the application in LAN. I am able to upload small as well as large image file(1Mb) from some PCs but in some other PCs I am getting IOError while uploading large image files however it is working fine for small images. Image uploading is hanging after 10%-20% and throwing IOError. *Surprizgly it is working Ok with XP systems and causeing issues with Windows7 systems*.
    Plz give me any idea to get a solution.
    In Tomcat server side it is giving following error:
    request: org.apache.catalina.connector.RequestFacade@c19694
    org.apache.commons.fileupload.FileUploadBase$IOFileUploadException: Processing of multipart/form-data request failed. Stream ended unexpectedly
            at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:371)
            at org.apache.commons.fileupload.servlet.ServletFileUpload.parseRequest(ServletFileUpload.ja va:126)
            at flex.servlets.UploadImage.doPost(UploadImage.java:47)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:637)
            at javax.servlet.http.HttpServlet.service(HttpServlet.java:717)
            at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.j ava:290)
            at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
            at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
            at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
            at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:127)
            at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
            at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
            at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:293)
            at org.apache.coyote.http11.Http11AprProcessor.process(Http11AprProcessor.java:877)
            at org.apache.coyote.http11.Http11AprProtocol$Http11ConnectionHandler.process(Http11AprProto col.java:594)
            at org.apache.tomcat.util.net.AprEndpoint$Worker.run(AprEndpoint.java:1675)
            at java.lang.Thread.run(Thread.java:722)
    Caused by: org.apache.commons.fileupload.MultipartStream$MalformedStreamException: Stream ended unexpectedly
            at org.apache.commons.fileupload.MultipartStream$ItemInputStream.makeAvailable(MultipartStre am.java:982)
            at org.apache.commons.fileupload.MultipartStream$ItemInputStream.read(MultipartStream.java:8 86)
            at java.io.InputStream.read(InputStream.java:101)
            at org.apache.commons.fileupload.util.Streams.copy(Streams.java:96)
            at org.apache.commons.fileupload.util.Streams.copy(Streams.java:66)
            at org.apache.commons.fileupload.FileUploadBase.parseRequest(FileUploadBase.java:366)
    UploadImage.java:
    package flex.servlets;
    import java.io.*;
    import java.sql.*;
    import java.util.*;
    import java.text.*;
    import java.util.regex.*;
    import org.apache.commons.fileupload.servlet.ServletFileUpload;
    import org.apache.commons.fileupload.disk.DiskFileItemFactory;
    import org.apache.commons.fileupload.*;
    import sun.reflect.ReflectionFactory.GetReflectionFactoryAction;
    import javax.servlet.*;
    import javax.servlet.http.*;
    public class UploadImage extends HttpServlet{
             * @see HttpServlet#doGet(HttpServletRequest request, HttpServletResponse
             *      response)
            protected void doGet(HttpServletRequest request,
                            HttpServletResponse response) throws ServletException, IOException {
                    // TODO Auto-generated method stub
                    doPost(request, response);
            public void doPost(HttpServletRequest request,
                            HttpServletResponse response)
            throws ServletException, IOException {
                    PrintWriter out = response.getWriter();
                    boolean isMultipart = ServletFileUpload.isMultipartContent(
                                    request);
                    System.out.println("request: "+request);
                    if (!isMultipart) {
                            System.out.println("File Not Uploaded");
                    } else {
                            FileItemFactory factory = new DiskFileItemFactory();
                            ServletFileUpload upload = new ServletFileUpload(factory);
                            List items = null;
                            try {
                                    items = upload.parseRequest(request);
                                    System.out.println("items: "+items);
                            } catch (FileUploadException e) {
                                    e.printStackTrace();
                            Iterator itr = items.iterator();
                            while (itr.hasNext()) {
                                    FileItem item = (FileItem) itr.next();
                                    if (item.isFormField()){
                                            String name = item.getFieldName();
                                            System.out.println("name: "+name);
                                            String value = item.getString();
                                            System.out.println("value: "+value);
                                    } else {
                                            try {
                                                    String itemName = item.getName();
                                                    Random generator = new Random();
                                                    int r = Math.abs(generator.nextInt());
                                                    String reg = "[.*]";
                                                    String replacingtext = "";
                                                    System.out.println("Text before replacing is:-" +
                                                                    itemName);
                                                    Pattern pattern = Pattern.compile(reg);
                                                    Matcher matcher = pattern.matcher(itemName);
                                                    StringBuffer buffer = new StringBuffer();
                                                    while (matcher.find()) {
                                                            matcher.appendReplacement(buffer, replacingtext);
                                                    int IndexOf = itemName.indexOf(".");
                                                    String domainName = itemName.substring(IndexOf);
                                                    System.out.println("domainName: "+domainName);
                                                    String finalimage = buffer.toString()+"_"+r+domainName;
                                                    System.out.println("Final Image==="+finalimage);
                                                    File savedFile = new File(getServletContext().getRealPath("assets/images/")+"/LowesFloorPlan.png");
                                                    //File savedFile = new File("D:/apache-tomcat-6.0.35/webapps/ROOT/example/"+"\\test.jpeg");
                                                    item.write(savedFile);
                                                    out.println("<html>");
                                                    out.println("<body>");
                                                    out.println("<table><tr><td>");
                                                    out.println("");
                                                    out.println("</td></tr></table>");
                                                    try {
                                                            out.println("image inserted successfully");
                                                            out.println("</body>");
                                                            out.println("</html>");  
                                                    } catch (Exception e) {
                                                            System.out.println(e.getMessage());
                                                    } finally {
                                            } catch (Exception e) {
                                                    e.printStackTrace();

    It is only coming in Windows 7 systems and the root of this problem is SSL certificate.
    Workaround for this:
    Open application in IE and click on certificate error link at address bar . Click install certificate and you are done..
    happy programming.
    Thanks
    DevSachin

  • Processing large xml file (500mb)? break into small part? load into jtree

    hi,
    i'm doing an assignment to processing large xml file (500mb) and
    load into jree using JAVA.
    can someone advice me on the algorithm to do this?
    how can i load a 500mb xml in a jtree without system hang?
    how to i break my file and do the loading?

    1 Is the file schema based binary XML.
    2. The limits are dependant on storage model and chacater set.
    3. For all NON-XML content the current limit is 4GBytes (Where that is bytes not characters). So for Character content in an AL32UTF8 database the limit is 2GB
    4. For XML Content stored as CLOB the limit is the same as for character data (2GB/4GB) dependant on database character set.
    5. For SB Based XML content stored in Object Relatioanl storage the limit is determined by the complexity and structures defiend in the XML Schema

  • How can I assign image file name from Main() class

    I am trying to create library class which will be accessed and used by different applications (with different image files to be assigned). So, what image file to call should be determined by and in the Main class.
    Here is the Main class
    import org.me.lib.MyJNIWindowClass;
    public class Main {
    public Main() {
    public static void main(String[] args) {
    MyJNIWindowClass mw = new MyJNIWindowClass();
    mw.s = "clock.gif";
    And here is the library class
    package org.me.lib;
    public class MyJNIWindowClass {
    public String s;
    ImageIcon image = new ImageIcon("C:/Documents and Settings/Administrator/Desktop/" + s);
    public MyJNIWindowClass() {
    JLabel jl = new JLabel(image);
    JFrame jf = new JFrame();
    jf.add(jl);
    jf.setVisible(true);
    jf.pack();
    I do understand that when I am making reference from main() method to MyJNIWindowClass() s first initialized to null and that is why clock could not be seen but how can I assign image file name from Main() class for library class without creating reference to Main() from MyJNIWindowClass()? As I said, I want this library class being accessed from different applications (means different Main() classes).
    Thank you.

    Your problem is one of timing. Consider this simple example.
    public class Example {
        public String s;
        private String message = "Hello, " + s;
        public String toString() {
            return message;
        public static void main(String[] args) {
            Example ex = new Example();
            ex.s = "world";
            System.out.println(ex.toString());
    }When this code is executed, the following happens in order:
    1. new Example() is executed, causing an object to constructed. In particular:
    2. field s is given value null (since no value is explicitly assigned.
    3. field message is given value "Hello, null"
    4. Back in method main, field s is now given value "world", but that
    doesn't change message.
    5. Finally, "Hello, null" is output.
    The following fixes the above example:
    public class Example {
        private String message;
        public Example(String name) {
            message = "Hello, " + name;
        public String toString() {
            return message;
        public static void main(String[] args) {
            Example ex = new Example("world");
            System.out.println(ex.toString());
    }

  • How to insert an image file in Oracle database

    hi
    can you please tell me how to insert an image file into oracle database????
    suppose there is one image file in c:\pictures\rose.jpg. how to insert that file into database? theoretically i know that will be BFILE type but i dont know how to insert that.
    will be waiting for your reply........
    thanks & regards,
    Priyatosh

    Hello,
    The easiest way to load a blob is to use SQL loader.
    This example comes from the utilities guide:
    LOAD DATA
    INFILE 'sample.dat'
    INTO TABLE person_table
    FIELDS TERMINATED BY ','
    (name CHAR(20),
    1 ext_fname FILLER CHAR(40),
    2 "RESUME" LOBFILE(ext_fname) TERMINATED BY EOF)
    Datafile (sample.dat)
    Johny Quest,jqresume.txt,
    Speed Racer,'/private/sracer/srresume.txt',
    Secondary Datafile (jqresume.txt)
    Johny Quest
    500 Oracle Parkway
    Secondary Datafile (srresume.txt)
    Loading LOBs
    10-18 Oracle Database Utilities
    Speed Racer
    400 Oracle Parkway
    regards,
    Ivo

  • How to insert a image file into oracle database

    hi all
    can anyone guide me how to insert a image file into oracle database now
    i have created table using
    create table imagestore(image blob);
    but when inserting i totally lost don't know what to do how to write query to insert image file

    Hi I don't have time to explain really, I did have to do this a while ago though so I will post a code snippet. This is using the commons file upload framework.
    Firstly you need a multi part form data (if you are using a web page). If you are not using a web page ignore this bit.
    out.println("<form name=\"imgFrm\" method=\"post\" enctype=\"multipart/form-data\" action=\"FileUploadServlet?thisPageAction=reloaded\" onSubmit=\"return submitForm();\"><input type=\"FILE\" name=\"imgSource\" size='60' class='smalltext' onKeyPress='return stopUserInput();' onKeyUp='stopUserInput();' onKeyDown='stopUserInput();' onMouseDown='noMouseDown(event);'>");
    out.println("   <input type='submit' name='submit' value='Submit' class='smalltext'>");
    out.println("</form>"); Import this once you have the jar file:
    import org.apache.commons.fileupload.*;Now a method I wrote to upload the file. I am not saying that this is correct, or its the best way to do this. I am just saying it works for me.
    private boolean uploadFile(HttpServletRequest request, HttpSession session) throws Exception {
            boolean result = true;
            String fileName = null;
            byte fileData[] = null;
            String fileUploadError = null;
            String imageType = "";
            String error = "";
            DiskFileUpload fb = new DiskFileUpload();
            List fileItems = fb.parseRequest(request);
            Iterator it = fileItems.iterator();
            while(it.hasNext()){
                FileItem fileItem = (FileItem)it.next();
                if (!fileItem.isFormField()) {
                    fileName = fileItem.getName();
                    fileData = fileItem.get();
                    // Get the imageType from the filename extension
                    if (fileName != null) {
                        int dotPos = fileName.indexOf('.');
                        if (dotPos >= 0 && dotPos != fileName.length()-1) {
                            imageType = fileName.substring(dotPos+1).toLowerCase();
                            if (imageType.equals("jpg")) {
                                imageType = "jpeg";
            String filePath = request.getParameter("FILE_PATH");
            session.setAttribute("filePath", filePath);
            session.setAttribute("fileData", fileData);
            session.setAttribute("fileName", fileName);
            session.setAttribute("imageType", imageType);
            return result;  
         } And now finally the method to actually write the file to the database:
    private int writeImageFile(byte[] fileData, String fileName, String imageType, String mode, Integer signatureIDIn, HttpServletRequest request) throws Exception {
            //If the previous code found a file that can be uploaded then
            //save it into the database via a pstmt
            String sql = "";
            UtilDBquery udbq = getUser(request).connectToDatabase();
            Connection con = null;
            int signatureID = 0;
            PreparedStatement pstmt = null;
            try {
                udbq.setUsePreparedStatements(true);
                con = udbq.getPooledConnection();
                con.setAutoCommit(false);
                if((!mode.equals("U")) || (mode.equals("U") && signatureIDIn == 0)) {
                    sql = "SELECT SEQ_SIGNATURE_ID.nextval FROM DUAL";
                    pstmt = con.prepareStatement(sql);
                    ResultSet rs = pstmt.executeQuery();
                    while(rs.next()) {
                       signatureID = rs.getInt(1);
                    if (fileName != null && imageType != null) {
                        sql = "INSERT INTO T_SIGNATURE (SIGNATURE_ID, SIGNATURE) values (?,?)";
                        InputStream is2 = new ByteArrayInputStream(fileData);
                        pstmt = con.prepareStatement(sql);
                        pstmt.setInt(1, signatureID);
                        pstmt.setBinaryStream(2, is2, (int)(fileData.length));
                        pstmt.executeUpdate();
                        pstmt.close();
                        con.commit();
                        con = null;
                if(mode.equals("U") && signatureIDIn != 0) {
                    signatureID = signatureIDIn.intValue();
                    if (fileName != null && imageType != null) {
                        sql = "UPDATE T_SIGNATURE SET SIGNATURE = ? WHERE SIGNATURE_ID = ?";
                        InputStream is2 = new ByteArrayInputStream(fileData);
                        pstmt = con.prepareStatement(sql);
                        pstmt.setBinaryStream(1, is2, (int)(fileData.length));
                        pstmt.setInt(2, signatureID);
                        pstmt.executeUpdate();
                        pstmt.close();
                        con.commit();
                        con = null;
            } catch (Exception e) {
                con = null;
                throw new Exception(e.toString());
            return signatureID;
       }

  • How to view large images ?

    i just updated my phone c601 from symbian anna to belle..may i know how to view large images in the nokia internet browser..i cant change it

    sorry,since i have just updated my mobile,i can't show you how large is it,
    but i can show you how small is it...
    even though i click 'more>view image',
    the image that shows me is just that small....
    Attachments:
    scr000001.jpg ‏102 KB

  • How to process the PDF files at one time

    Hello,
    I'm using WebDynpro for ABAP and Adobe Interactive Forms as offline forms.
    I collect PDF files from received e-mails.
    I want them to be taken in at one time.
    (for example,
    system job read PDF files and create data in ERP,
    or I upload the files one time.)
    Please let me know
    - How to process the PDF files at one time.
    Best regards,
    Koji

    When you click the edit button in recents, try clicking the clear button in the upper left.

  • How can I add image files to a executable jar file ?

    Could you tell me how can I add image files to executable jar file ?
    package structure:
    ../com/Main.class
    ../images/..

    Please don't cross post, and read this
    http://forum.java.sun.com/thread.jsp?forum=31&thread=271751
    I've answered the question in the New To Java thread.

  • How to link an image file in code view

    I can't seem to figure out how to link the image file in code view. It has to be in code view because the image is hidden in Design View so I can't do it in HTML view. Here's the coded section:
    <!-- TAB #3 CONTENT -->
                    <div id="tab3" class="tabsGeneral">
                      <div class="tabsFeatureImageContainer asyncImgLoad" title="img/index/tabs/tab3/DonateNow-168x112.jpg"></div>
                      <h3 class="tabsHeader">Partner With Us</h3>
                      <p class="tabsDesc">Get involved with all the exciting things God is doing at Provision House. Partner with us to help others find true and lasting freedom from addiction in Christ. <a href="http://provisionhouse.org/giving.html" class="commonLink">Click here</a></p>
    It's' the red jpeg image file I want to link to another page in the site and I don't have enough experience to do this.
    I am thankful for your help.
    Paul

    Thanks, Gramps. Here's the page I want to like to from the image:
    http://provisionhouse.org/giving.html
    Paul
    Here's the whole section where the problem exists:
    <!-- TABS -->
                <div id="tabsContainer">
                    <div id="tabsWrapper">
                        <!-- TAB #1 CONTENT begin -->                
                        <div id="tab1" class="tabsGeneral">
                         <div class="tabsFeatureImageContainer asyncImgLoad" title="img/index/tabs/tab3/WalkingByTheSpirit-168x112.jpg"></div>
                        <h3 class="tabsHeader">Session 5 of the Breaking the Chains Seminar Completed</h3>
                            <p class="tabsDesc">Visit the <a href="videos.html" class="commonLink">Videos page</a> to watch clips of Session 5, <span class="Italic">Walking by the Spirit</span></a></p>   
                        </div> <!-- tab1 -->
                        <!-- TAB #2 CONTENT begin -->                       
                      <div id="tab2" class="tabsGeneral">
                            <div class="tabsFeatureImageContainer asyncImgLoad" title="img/index/tabs/tab2/FreedomFromAddiction168x112.jpg"></div>
                            <h3 class="tabsHeader">Session 2, Freedom from Addiction</h3>
                            <p class="tabsDesc">Is it possible for the Christian to find true and lasting freedom from addiction? This session explains how all addictions are also sin, and it is sin that Jesus has set us free from. Anticipated release: November, 2011. <span class="commonLink"><a href="curriculum.html">Read about Session 2</a></span>
    <!--HIDDEN SECTION<<div class="tabsThumbsContainer">
                                <a class="tabsThumb imgTipLeftTop" rel="img/index/tabs/tab2/1.jpg">
                                    <img src="img/index/tabs/tab2/thumb1.jpg" alt="" />
                                    <span class="desc displayNone">Dubai</span>
                                </a> 
                                <a class="tabsThumb imgTipLeftTop" rel="img/index/tabs/tab2/2.jpg">
                                    <img src="img/index/tabs/tab2/thumb2.jpg" alt="" />
                                    <span class="desc displayNone">Dubai</span>                           
                                </a>
                                <a class="tabsThumb imgTipLeftTop" rel="img/index/tabs/tab2/3.jpg">
                                    <img src="img/index/tabs/tab2/thumb3.jpg" alt="" />
                                    <span class="desc displayNone">Dubai</span>                               
                                </a> 
                                <a class="tabsThumb imgTipLeftTop" rel="img/index/tabs/tab2/4.jpg">
                                    <img src="img/index/tabs/tab2/thumb4.jpg" alt="" />
                                    <span class="desc displayNone">Dubai</span>
                                </a>
                                <a class="tabsThumb imgTipLeftTop" rel="img/index/tabs/tab2/5.jpg">
                                    <img src="img/index/tabs/tab2/thumb5.jpg" alt="" />
                                    <span class="desc displayNone">Dubai</span>                           
                                </a> 
                                <a class="tabsThumb imgTipLeftTop" rel="img/index/tabs/tab2/6.jpg">
                                    <img src="img/index/tabs/tab2/thumb6.jpg" alt="" />
                                    <span class="desc displayNone">Dubai</span>                           
                                </a>                   
                                <a class="tabsThumb imgTipLeftTop" rel="img/index/tabs/tab2/7.jpg">
                                    <img src="img/index/tabs/tab2/thumb7.jpg" alt="" />
                                    <span class="desc isplayNone">Dubai</span>                           
                                </a> 
                                <a class="tabsThumb imgTipLeftTop" rel="img/index/tabs/tab2/8.jpg">
                                    <img src="img/index/tabs/tab2/thumb8.jpg" alt="" />
                                    <span class="desc displayNone">Dubai</span>                           
                                </a>
                            </div> --> <!-- tabsThumbsContainer -->          
                      </div> <!-- tab2 -->
                        <!-- TAB #3 CONTENT -->                        
                        <div id="tab3" class="tabsGeneral">
                        <div class="tabsFeatureImageContainer asyncImgLoad" title="img/index/tabs/tab3/DonateNow-168x112.jpg"></div>
                            <h3 class="tabsHeader">Partner With Us</h3>
                            <p class="tabsDesc">Get involved with all the exciting things God is doing at Provision House. Partner with us to help others find true and lasting freedom from addiction in Christ. <a href="http://provisionhouse.org/giving.html" class="commonLink">Click here</a></span>
                            <div class="tabsThumbsContainer">
                                <a class="tabsThumb imgTipLeftTop" rel="img/index/tabs/tab3/WalkingByTheSpirit-350x250-no text.jpg">
                                    <img src="img/index/tabs/tab3/WalkingByTheSpirit-26x26-no text2.jpg" alt="" />
                                <a class="tabsThumb imgTipLeftTop" rel="img/index/tabs/tab3/WalkingByTheSpirit-350x250-no text.jpg">
                                    <img src="img/index/tabs/tab3/WalkingByTheSpirit-26x26-no text2.jpg" alt="" />
                                <a class="tabsThumb imgTipLeftTop" rel="img/index/tabs/tab3/WalkingByTheSpirit-350x250-no text.jpg">
                                    <img src="img/index/tabs/tab3/WalkingByTheSpirit-26x26-no text2.jpg" alt="" />
                                <a class="tabsThumb imgTipLeftTop" rel="img/index/tabs/tab3/WalkingByTheSpirit-350x250-no text.jpg">
                                    <img src="img/index/tabs/tab3/WalkingByTheSpirit-26x26-no text2.jpg" alt="" />
                                <a class="tabsThumb imgTipLeftTop" rel="img/index/tabs/tab3/WalkingByTheSpirit-350x250-no text.jpg"><img src="img/index/tabs/tab3/WalkingByTheSpirit-26x26-no text2.jpg" alt="" />
                                <a class="tabsThumb imgTipLeftTop" rel="img/index/tabs/tab3/WalkingByTheSpirit-350x250-no text.jpg">
                                    <img src="img/index/tabs/tab3/WalkingByTheSpirit-26x26-no text2.jpg" alt="" />
                                    </span>                           
                                </a>                   
                            </div>
    <!-- tabsThumbsContainer -->         
                        </div> <!-- tab3 -->
                    </div> <!-- tabsWrapper -->
                    <!-- TABS BUTTONS -->
                    <div id="tabsBtnBar">               
                        <div class="tabsBtn">latest news<span class="tabsSource">#tab1</span><span class="tabsSource">#tab1</span>                
                    </div>
                        <div class="tabsBtn">Current Project
                            <span class="tabsSource">#tab2</span>
                        </div>
                        <div class="tabsBtn">how to help
                            <span class="tabsDefaultTab"></span>
                            <span class="tabsSource">#tab3</span>
                        </div>                   
                    </div> <!-- tabsBtnBar -->
                </div> <!-- tabsContainer -->

  • How I can store Image file in a database

    Can any one how i can stored image file in a database and then by using same database how i can show in HTML page...(in a browser)

    This is not something that can be answered easily. There is quite alot of code involved....
    To get started I suggest you read up on the built-in package 'DBMS_LOB' from Oracle . Most of what you need you should find there.
    regards Dave.

  • Labview crashes when creating large image files

    I have a problem with Labview 6.0.2( I've tested evaluation version 7.0 too).
    I'm constructing a very large image, for example: 4500x4500 pixels. Labview crashes when converting the pixture to a pixmap. The image is fully constructed on my screen (in a picture control), but when converting it to a pixmap (for saving the image in a known format (bmp, jpg, tiff)), Labview crashes.
    I did some testing and when the number of pixels exceeded the limit of 2^24(16777216), the file 'image.cpp' crashes on line 1570. The vi to convert it to a pixmap is: P'icture to pixmap.vi'
    Does someone know a workaround for this problem? Or is there a fix for it?
    Thank you!

    I've tested the 6i version of my VI in Labview 7.0 evalutation version. It raised an error but not the same error:
    d:\lvworm\src\lvsource\compatexport.cpp(37) : DAbort: Called a routine not in the compatibility LVRT table
    $Id: //labview/branches/Wormhole/dev/lvsource/compatexport.cpp#11 $
    0x004BD4CB - LabVIEW_Eval + 0
    0x0EB710D9 - lvs248 + 0
    0x094C87A0 - + 0
    So i replaced the picture VI's with the 7.0 evalutation version VI's, and it worked. It is now possible for me to construct very large image files!
    I see no attached VI to test. But i guess it is also solved in Labview 7.0
    I used this file to convert the picture to image data:
    C:\Program Files\National Instruments\LabVIEW 7.0 Evaluation\vi.lib
    \picture\pictutil.llb\Picture to Pixmap.vi
    And this file to convert image data to bmp:
    C:\Program Files\National Instruments\LabVIEW 7.0 Evaluation\vi.lib\picture\bmp.llb\Write BMP File.vi
    I guess i have to write a workaround for this problem:
    divide the picture in blocks of 4096 x 4096 and then merge the image data arrays of the bloks together.

Maybe you are looking for

  • Using an existing PDF as a background

    I've got an existing PDF file I'd like to use as the background for my form. I've trying importing it into designer, but I'm missing some of the fonts and there are a lot of mistakes. I tried saving the PDF as graphics, then creating an image PDF fro

  • Hierarchy in obiee 11g

    Hi All, we have a to create a hierarchy for the below type. H1-->H2-->H3-->H5 -->H4 H1 | H2 | | H3 H4 | H5 How to create this type of hierarchy..? When we click on H1, H2 will display, when we click on H2, H3 and H4 should display, then clicking on H

  • I can't update ipod touch to new 4.2

    I can'tupdate my ipod touch to new 4,2

  • How do you insert special characters with imovie 08?

    How do you insert special characters into a project with imovie 08?

  • IE8 Crash which was caused by ntdll.dll

    Hi all I want to create a IE8 (Chinese language),so I do not use ZAV template. When I generate the ZAV AP, I try to launch it on Clear XP Sp3 workstation.the AP automatic close about 5 secs. I check the event viewer, an error show "Failed Application