How do i wrap a dll inside an executable jar

hi,
i have an executable jar that uses jni to reference native code in a dll.
i can launch the executable jar only if the dll is in the same directory as the jar (or in system32).
so, i figured if i added the dll to the jar it would work. no!
what do i do to deploy only 1 executable jar?
thanks

Hi anonimuds,
I see useless “expert” activities here instead of giving a real response!
You can pack a native library with bytecode if you use WebStart technology. Let look at the example tested by me. It shows Windows MessageBox from the native method.
Here is Java class HellowWorld:
package test;
public class HellowWorld {
static {
System.loadLibrary("HellowWorld");
public static void main(String[] args) {
DoHellow();
public static native void DoHellow();
}With javah I generated C++ header:
/* DO NOT EDIT THIS FILE - it is machine generated */*
*#include <jni.h>*
*/* Header for class test_HellowWorld */*
*#ifndef _Included_test_HellowWorld*
*#define _Included_test_HellowWorld*
*#ifdef __cplusplus*
*extern "C" {*
*#endif*
* Class: test_HellowWorld
* Method: DoHellow
* Signature: ()V
JNIEXPORT void JNICALL Java_test_HellowWorld_DoHellow
(JNIEnv *, jclass);
#ifdef __cplusplus
#endif
#endifWith MS Visual Studio I made a simple library with the native method implementation:
#include "stdafx.h"
#include "test_HellowWorld.h"
BOOL APIENTRY DllMain( HANDLE hModule,
DWORD ul_reason_for_call,
LPVOID lpReserved
return TRUE;
JNIEXPORT void JNICALL Java_test_HellowWorld_DoHellow(JNIEnv *, jclass)
MessageBox(0, "Hellow World!", "Message", MB_OK);
}I compiled Java code above to test.HellowWorld.class and JNI code to HellowWorld.dll.
Then I packed bytecode and DLL to HellowWorld.jar with batch file:
%java_home%\bin\jar cvmf MANIFEST.MF HellowWorld.jar test/HellowWorld.class ./HellowWorld.dll
%java_home%\bin\keytool -genkey -v -alias vitaly -keystore OlejaKeystore -storepass MyStore -keypass Caretta
%java_home%\bin\jarsigner -keystore OlejaKeystore -storepass MyStore -keypass Caretta HellowWorld.jar vitallyWhere content of MANIFEST.MF is
Manifest-Version: 1.0
Created-By: 1.4.2_12 (Sun Microsystems Inc.)
Main-Class: test.HelloWorldBefore deploying the project to Intranet Site I prepared JNLP and HTML files.
The content of HellowWorld.jnlp file is
<?xml version="1.0" encoding="utf-8"?>
<jnlp spec="1.0+" codebase="http://vitallis/HellowWorld">
<information>
<title>HellowWorld Example</title>
<vendor>ABC Ltd</vendor>
<homepage href="HellowWorld.html"/>
<description>JNI Test</description>
<description kind="short">JNI Test</description>
</information>
<security>
<all-permissions/>
</security>
<resources>
<j2se version="1.3+" href="http://java.sun.com/products/autodl/j2se"/>
<j2se version="1.3+"/>
<jar href="HellowWorld.jar" main="true" download="eager"/>
</resources>
<resources os="Windows">
<nativelib href="HellowWorld.jar" download="eager"/>
</resources>
<application-desc main-class="test.HellowWorld"/>
</jnlp>The codebase value you will change to URL of your Site. And at the last, here is HellowWorld.html text
<html>
<head>
<title>Java Web Start Example</title>
</head>
<body>
<P>Java Web Start Example:</P>
<P>
<a href="HellowWorld.jnlp">JNI Example</a>
</body>
</html>I have tested this project on my computer and it runs fine.

Similar Messages

  • Including a jar file inside an executable jar file

    Is it possible to include a jar file inside another (executable) jar file such that the included file is part of the class path for the outer file? If so, how do you specify this in the classpath in the manifest?

    Russ_Bjork wrote:
    Is it possible to include a jar file inside another (executable) jar file such that the included file is part of the class path for the outer file?No. Actually, I suppose it would be possible if you do all the 'heavy lifting', but Java is not designed to handle Jars within Jars.
    What do you see as the advantage of doing that?
    Is your app. a rich client (e.g. Swing, AWT, SWT..)?
    Can you distribute the app. from a server or the internet?

  • 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.

  • Updating an XML file inside the executable JAR.

    Hello all!
    I would like to askk how can i update an XML file that is packaged inside my jar file?
    For intstance:
    I have a Java Application in NetBeans
    Inside a package i have constructed a custom .xml file.
    I can read from this file using
    .....getClass().getResourceAsStream("/.../file.xml")and after that using XPath for querying and works fine.
    I want to update an entry in my xml file so the jar contains now the newly updated file.
    Thanks everyone who spends hit time to read this. Hope someone can help me.

    Please don't cross-post:
    http://forums.sun.com/thread.jspa?threadID=5342194

  • How can i include .so files in an executable .jar?

    Hi,
    I need to some native libraries to run my app. I want to put this .so files into a jar file.
    With a shellscript i can set the java classpath, but i need to have only the jar file. If anybody know what do i do to java search the files into a directory specified by me (a directory compressed into the jar file) please help me!
    Any help is wellcome.
    Thanks. Bruno.

    http://java.sun.com/j2se/1.5.0/docs/guide/javaws/developersguide/faq.html#210
    http://java.sun.com/products/javawebstart/download-spec.html
    You create a jar file containing JUST the native resources (i.e. the .so file).
    You add a <nativelib > element to the JWS file wrapped in a "<resource os="linux" arch="x86">" tag (I think, not done in some time, check the links above).

  • How would I call a method inside a dll?

    How would I call a method inside a dll? Is it even possible in Java? Like in VB you would do something like this: XXX.dll --> XXX.Activate()... I have already loaded the dll like this:
    String xxx = "C:/WINDOWS/system32/xxx.dll";
    System.load(xxx);
    Please help?
    THX

    I've got another question.
    I've gone through the link you posted and a couple others that I found.
    I am able to create an interface using the windows kernel32.dll and go through an example I found.
    But when I try to use a dll that I have from another application, I have problems.
    Here is what I have for the interface.
    public interface IAiCamDeviceControl extends StdCallLibrary {
         public IAiCamDeviceControl INSTANCE=(IAiCamDeviceControl)Native.loadLibrary("D:\\IAiCamDeviceControl.dll",IAiCamDeviceControl.class);   
    //        public long GetVersion( String s );
    //        public long Close();
    }The interface that works looks like this:
    public interface Kernel32 extends StdCallLibrary {
         public Kernel32 INSTANCE=(Kernel32)Native.loadLibrary("Kernel32",Kernel32.class);I thought that the problem might be using the path name for the library, so I copied it into the system32 directory.
    Still get the same error:
    Exception in thread "main" java.lang.UnsatisfiedLinkError: Unable to load library 'D:\IAiCamDeviceControl.dll': The specified module could not be found.
    My main looks like
    public class Main {
        public static void main(String[] args) {
    //          Kernel32 lib=Kernel32.INSTANCE;
    //          Kernel32.SYSTEM_POWER_STATUS batteryStatus=new Kernel32.SYSTEM_POWER_STATUS();
    //          lib.GetSystemPowerStatus(batteryStatus);
    //          System.out.println(batteryStatus);
                IAiCamDeviceControl camDev = IAiCamDeviceControl.INSTANCE;
    }The commented part is from the version that worked.
    All I attempted to do here was just create an instance of the interface.
    Any idea why I can't access the dll?
    The dll is the same one that is used successfully in VB, C#, and C++ demo programs, so I suspect it is a good dll.

  • Reporting Services - How to open a second table inside report, for each number of client (each apears in first table)

    Reporting Services - How to open a second table inside report, for each number of client (each apears in first table)?
    Exemple:
    Table1
    Cliente name:
    John
    Client number:
    12345
    Survay number of negative answers:
    3
    Table2
    Questions and answers that were negative:
    Question: How much time where you waiting
    Avaluation: 3 (from 1 to 10)
    Answer: They only called me 1 mouth later
    Can you please help me?

    Hi,
    Based on the description, I understand that you want to add subreport in the main report. When previewing the main report, the subreport can be shown in detail. Please see the screenshots on my test:
    In Reporting Services, we can create parameters and pass them from main report to subreport in order to control the data dynamically.
    References:
    Subreports (Report Builder and SSRS)
    Add a Subreport and Parameters (Report Builder and SSRS)
    If I have any misunderstanding, please feel free to contact me.
    Regards,
    Heidi Duan
    Heidi Duan
    TechNet Community Support

  • How Do I Wrap Text Like the iOS Camera App?

    Hello. I am in yearbook, and I have been challenged with designing the cover of the yearbook, and I have been having a few problems along the way. One of these problems is to wrap text. Specifically, I'm stuck on how I would wrap text like the iOS camera app on the bottom of the screen. The words seem like they are wrap around a 3D object to give it that effect, but I can't really tell. If anyone can help me, it would be greatly appreciated.

    JJMack wrote:
    There is a big difference between being a casual user than real work or development. I own a iPod its a great MP3 player and a device I can display my pictures on out of my pocket. I'll even Facetime my kids at time to see my grand kids or help fix something.  My wife has a mini iPad for quick internet access and quire music and uses her iPod to entertain our two year old grandson with games.   She uses a Canon 1D mark 4 and I a Cannon 1D mark II.  The only use the iPad and iPod cameras get is Facetime. No iOS apps are use to work on images  they have no value when you have Photoshop. The iPod is better for displaying image then the iPad mini it has a 3:2 aspect ratio display and travels better the the mini iPad which has a 4:3 aspect ratio display.  I also crop image for display on wall mounted HDTV. The iPad is better for casual internet access then the iPod. All our kids have iPhones and they all use computers either Mac or PC for work and internet access.  When you have a Unix or Windows why would you want to touch an iOS device for work or serious internet access.  Apple mobile devices are convenient for casual use and grand kids don't get that dirty finger painting on them as they do using real paint. Nothing of real value is maintained on an iOS device.
    Well...there's Photoshop Touch and Photoshop Mix as well as Lightroom Mobile. It could be argued that they're don't exactly mirror their desktop cousins, yes, but they weren't meant to be. They were meant as extensions to the desktop experience.  (e.g., Lightroom Mobile lets one work with the RAW images they have in their Lightroom desktop collections.)
    The more powerful Windows tablets can run Photoshop desktop (like Photoshop CC) too.
    @bluebocat: Are you looking for text with a perspective? Like it has a vanishing point? As if it was turned in a certain direction in 3D space?

  • How can I wrap text in a pie in pages?

    How can I wrap text in a pie in pages?

    If you need to insert text into a shape like a pie wedge, the easiest way might be to simply use the shape - freeform tool (at the bottom of the shape menu) and create a shape and type your text in it then place the shape over your pie wedge. The text within the shape should wrap - additional controls for text can be used with the Text Inspector.
    You can edit the actual shape with Format Object > Make Shape Editable option but unfortunately, you have an option to make straight or smooth curves, but not both, so you'll need to shape the object using smooth curves and use the the bezier controls that appear as you select a control point.

  • Can any one suggest me how can I use relative path inside SSIS pacakge to access config file ?

    Can any one suggest me how can I use relative path inside SSIS pacakge to access config file ? Please help me as its urgent.THanks for your help in advance.

    Hi Jay,
    SSIS can only recognize the absolute path of a XML Configuration file, the relative path is not supported. Furthermore, if the XML Configuration file is already generated, we can use the Environment variable package configuration type instead so that
    SSIS runtime automatically looks for the configuration file from the path defined in the environment variable. This is convenient when we need to deploy a package to different environment. We only need to define the environment variable for package configurations
    once on each server, and then the variable can be used by all the packages on this server.
    Regards,
    Mike Yin
    TechNet Community Support

  • How to use one hash table inside another hash table

    Hi everyone,
    Any example of hash table inside another hash table.
    Can one here help me how to write one hash table inside another with repeating keys for the first hash table.
    Thanks,
    kanty.

    Do you mean you want the 'value' entries in a hash table to themselves be hash tables? Easy but this often indicates a design flaw.
    Hashtable<String,<Hashtable<String,Value>> fred = new Hashtable<String,<Hashtable<String,Value>> ();But what do you mean by "with repeating keys for the first hash table"?
    Edited by: sabre150 on Jul 2, 2010 10:11 PM
    Looks like you have already handled the declaration side in your other thread. I suspect you should be writing your own beans that hold the information and these beans would then be stored in a Map. The problem I have is that your description is too vague so I can't be certain.

  • How to count number of lines inside methods() using the Doclet API

    Wrote a custom doclet using the [Doclet API|http://java.sun.com/j2se/1.3/docs/tooldocs/javadoc/doclet/index.html ] .
    The purpose for the doclet is to load Java source files and create stubs (which are identical Java source files but do not contain any method implementation details).
    Instead, the method implementation details need to be replaced with blank lines...
    public class MyDoclet {
         private static String TAB = "\t";
         public static boolean start(RootDoc root) {
              ClassDoc[] classes = root.classes();
              // Parse through class or interface
              for (ClassDoc clazz : classes) {
                   Type superClass = clazz.superclassType();     
                   // Print Methods
                   MethodDoc[] methods = clazz.methods();
                   for (MethodDoc method : methods) {
                        Parameter[] parameters = method.parameters();
                        println();
                        if (!method.isPrivate()) {
                             print(TAB + method.modifiers() + " "
                                                    + method.returnType().simpleTypeName() + " " + method.name());
                             print("(");
                             for (int i=0; i < parameters.length; i++) {
                                  Parameter parameter = (Parameter) parameters;
                                  print(parameter.type().simpleTypeName() + " " + parameter.name());
                                  if (i != parameters.length - 1) {
                                       print(", ");
                             print(")");
                             println(" {");
                             println("\n");
                             println(TAB + "}");
              return true;
    As one can see, I am just creating the method and placing the opening and closing curly braces (along with a new \n line escape sequence, in between).
    Am not really that familiar with the Doclet API...
    Question(s):
    (1) What is the best way to figure out how many lines of code are inside each method and then use a for loop to insert the exact same number of blank lines inside the methods?
    (2) Is there a way to do it using the com.sun.javadoc.SourcePosition.line() method?
    Would really appreciate it if someone could help me because this is an important requirement (hence the 10 Duke Stars).
    Happy coding to all,
    Mike                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

    This is not possible using the Doclet API, because JavaDoc does not store any information regarding implementation detail. Although MethodDoc#position will give you the line where the method is declared, there is no way to determine where the method body starts and ends.
    If you need that much information, maybe you would be better of using a tool such as Eclipse's Abstract Syntax Tree parser. AST will provide you with line numbers for each code expression, hence it is relatively easy to compute the first and last line in a method body.

  • How to handle line break embeded inside CSV column

    Hi there,
    I am under the pressure to make it work. I already put this question on APEX forum, but on second thought, I think it relates more to PL/SQL rather than APEX since APEX 4.1 already have utility to handle CSV Upload.
    If you read it already in APEX forum, please ignore.
    I am sorry for that. Thanks for reading.
    I need to develop an app that allows user to upload CSV file to a interface table.
    The APEX version at my workplace is 4.0.2.
    I used the code from
    http://dbswh.webhop.net/htmldb/f?p=BLOG:READ:0::::ARTICLE:11000346061523
    It all works well till recently I find out
    If a column in a CSV file cotain a line break (or new line) e.g. (The tester copy and paste this text which has line break into a column in a spreadsheet)
    This is the first sentence.
    This is the second sentence.
    It will break the “This is the second sentence”. To a new column.
    The contents of the CSV viewed in Notepad look as below
    Assessment Date,Scheduled Date,Assessment Provider,Assessor Name,Court,First Name,Middle Name,Last Name,PRN Person Record Number,NHI Number,Defendant Attended Y/N,Is Dependent Y/N,Notes,Primary Ethnicity,"Ethnicity Other, please specify",Gender,Currently in Treatment Y/N,Substance of Concern 5,Other Substance Specified
    22/09/2012,,Provider Co Name,Warren Edgley,Wellington,,,Salty,2545554,dgsdf,ergerg,,"This is the first sentence.
    This is the second sentence.",Japanese,,Female,b,,
    Here is the code from the CSV UTIL, please help me to find out how can I replace the line break to a space so that the uploading process is correct.
      CREATE OR REPLACE PACKAGE BODY "CSV_UTIL"
    AS
         --strip the beginning and the end quotes, then replace double quotation with single
       FUNCTION de_quote (p_str IN VARCHAR2, p_enc_by IN VARCHAR2)
          RETURN VARCHAR2
       IS
       v_str VARCHAR2(32767) := p_str;
       BEGIN
          IF (p_enc_by IS NULL)
          THEN
             RETURN p_str;
          ELSE
            IF SUBSTR(p_str,-1) = p_enc_by THEN
               v_str := SUBSTR(p_str,1,LENGTH(p_str)-1);
            END IF;
            IF SUBSTR(p_str,1,1) = p_enc_by THEN
               v_str := SUBSTR(v_str,2);
            END IF; 
            RETURN REPLACE (v_str,
                             p_enc_by || p_enc_by,
                             p_enc_by
          END IF;
       END de_quote;
       PROCEDURE parse (p_str IN VARCHAR2, p_enc_by IN VARCHAR2, p_sep IN VARCHAR2)
       IS
          l_n          NUMBER   DEFAULT 1;
          l_in_quote   BOOLEAN  DEFAULT FALSE;
          l_ch         NCHAR (1);
          l_len        NUMBER   DEFAULT NVL (LENGTH (p_str), 0);
       BEGIN
          IF (l_len = 0)
          THEN
             RETURN;
          END IF;
          g_words := g_empty;
          g_words (1) := NULL;
          FOR i IN 1 .. l_len
          LOOP
             l_ch := SUBSTR (p_str, i, 1);
             IF (l_ch = p_enc_by)
             THEN
                l_in_quote := NOT l_in_quote;
             END IF;
             IF (l_ch = p_sep AND NOT l_in_quote)
             THEN
                l_n := l_n + 1;
                g_words (l_n) := NULL;
             ELSE
                g_words (l_n) := g_words (l_n) || l_ch;
             END IF;
          END LOOP;
          g_words (l_n) := de_quote (g_words (l_n), CHR(10));
          g_words (l_n) := de_quote (g_words (l_n), CHR(13));
          FOR i IN 1 .. l_n
          LOOP
             g_words (i) := de_quote (g_words (i), p_enc_by);
          END LOOP;
       END parse;
    Author: Oleg Lihvoinen
    Company: DbSWH
    Changes:
    10.02.2011, There was a miscalculation of the file line last position in case it is the end of file
       PROCEDURE upload (p_file_name VARCHAR2, p_collection_name VARCHAR2, p_enc_by IN VARCHAR2, p_sep_by IN VARCHAR2, p_rows NUMBER)
       IS
          v_blob_data    BLOB;
          v_clob_data    CLOB;
          v_clob_len     NUMBER;
          v_position     NUMBER;
          v_char         NCHAR (1);
          c_chunk_len    NUMBER           := 1;
          v_line         VARCHAR2 (32767) := NULL;
          v_data_array   vcarray;
          v_rows         NUMBER           := 0;
          n_seq          NUMBER           := 1;
          dest_offset    NUMBER           := 1;
          src_offset     NUMBER           := 1;
          amount         INTEGER          := DBMS_LOB.lobmaxsize;
          blob_csid      NUMBER           := DBMS_LOB.default_csid;
          lang_ctx       INTEGER          := DBMS_LOB.default_lang_ctx;
          warning        INTEGER;
          l_sep          VARCHAR2(100)    := CASE WHEN p_sep_by = '\t' THEN chr(9) ELSE p_sep_by END;
       BEGIN
          htmldb_collection.create_or_truncate_collection
                                          (p_collection_name      => p_collection_name);
          -- Read blob from wwv_flow_files
          SELECT blob_content
            INTO v_blob_data
            FROM wwv_flow_files
           WHERE NAME = p_file_name;
          v_position := 1;
          DBMS_LOB.createtemporary (lob_loc      => v_clob_data,
                                    CACHE        => TRUE,
                                    dur          => DBMS_LOB.SESSION
          DBMS_LOB.converttoclob (v_clob_data,
                                  v_blob_data,
                                  amount,
                                  dest_offset,
                                  src_offset,
                                  blob_csid,
                                  lang_ctx,
                                  warning
          v_clob_len := DBMS_LOB.getlength (v_clob_data);
          IF v_clob_len = 0 THEN
             RETURN;
          END IF;
          WHILE (v_position <= v_clob_len + 1)
          LOOP
             v_char := DBMS_LOB.SUBSTR (v_clob_data, c_chunk_len, v_position);
             v_line := v_line || v_char;
             v_position := v_position + c_chunk_len;
             -- When the whole line is retrieved and not end of file or end of file
             IF v_char = CHR (10) AND v_position < v_clob_len OR v_position = v_clob_len + 1
             THEN
                parse (p_str => v_line, p_enc_by => p_enc_by, p_sep => l_sep);
                v_data_array := g_words;
                FOR i IN 1..g_words.count LOOP
                   IF i <= 50 THEN
                      v_data_array(i) := g_words(i);
                   ELSE
                      exit;
                   END IF;
                END LOOP;
                FOR i IN g_words.count + 1..50 LOOP
                   v_data_array(i) := null;
                END LOOP;           
                v_rows := v_rows + 1;
                -- exit if uploaded specified number of rows
                IF p_rows IS NOT NULL AND v_rows > p_rows THEN
                   EXIT;
                END IF;
                -- Store data to collection
                n_seq :=
                   htmldb_collection.add_member
                                         (p_collection_name      => p_collection_name,
                                          p_c001                 => v_data_array
                                                                               (1),
                                          p_c002                 => v_data_array
                                                                               (2),
                                          p_c003                 => v_data_array
                                                                               (3),
                                          p_c004                 => v_data_array
                                                                               (4),
                                          p_c005                 => v_data_array
                                                                               (5),
                                          p_c006                 => v_data_array
                                                                               (6),
                                          p_c007                 => v_data_array
                                                                               (7),
                                          p_c008                 => v_data_array
                                                                               (8),
                                          p_c009                 => v_data_array
                                                                               (9),
                                          p_c010                 => v_data_array
                                                                               (10),
                                          p_c011                 => v_data_array
                                                                               (11),
                                          p_c012                 => v_data_array
                                                                               (12),
                                          p_c013                 => v_data_array
                                                                               (13),
                                          p_c014                 => v_data_array
                                                                               (14),
                                          p_c015                 => v_data_array
                                                                               (15),
                                          p_c016                 => v_data_array
                                                                               (16),
                                          p_c017                 => v_data_array
                                                                               (17),
                                          p_c018                 => v_data_array
                                                                               (18),
                                          p_c019                 => v_data_array
                                                                               (19),
                                          p_c020                 => v_data_array
                                                                               (20),
                                          p_c021                 => v_data_array
                                                                               (21),
                                          p_c022                 => v_data_array
                                                                               (22),
                                          p_c023                 => v_data_array
                                                                               (23),
                                          p_c024                 => v_data_array
                                                                               (24),
                                          p_c025                 => v_data_array
                                                                               (25),
                                          p_c026                 => v_data_array
                                                                               (26),
                                          p_c027                 => v_data_array
                                                                               (27),
                                          p_c028                 => v_data_array
                                                                               (28),
                                          p_c029                 => v_data_array
                                                                               (29),
                                          p_c030                 => v_data_array
                                                                               (30),
                                          p_c031                 => v_data_array
                                                                               (31),
                                          p_c032                 => v_data_array
                                                                               (32),
                                          p_c033                 => v_data_array
                                                                               (33),
                                          p_c034                 => v_data_array
                                                                               (34),
                                          p_c035                 => v_data_array
                                                                               (35),
                                          p_c036                 => v_data_array
                                                                               (36),
                                          p_c037                 => v_data_array
                                                                               (37),
                                          p_c038                 => v_data_array
                                                                               (38),
                                          p_c039                 => v_data_array
                                                                               (39),
                                          p_c040                 => v_data_array
                                                                               (40),
                                          p_c041                 => v_data_array
                                                                               (41),
                                          p_c042                 => v_data_array
                                                                               (42),
                                          p_c043                 => v_data_array
                                                                               (43),
                                          p_c044                 => v_data_array
                                                                               (44),
                                          p_c045                 => v_data_array
                                                                               (45),
                                          p_c046                 => v_data_array
                                                                               (46),
                                          p_c047                 => v_data_array
                                                                               (47),
                                          p_c048                 => v_data_array
                                                                               (48),
                                          p_c049                 => v_data_array
                                                                               (49),
                                          p_c050                 => v_data_array
                                                                               (50)                                                                          
                -- Clear the line
                v_line := NULL;
             END IF;
          END LOOP;
       END;
    END;In my apps, I save these straight into a table rather than an APEX collection because the number of columns can be longer than 50.
    I want to find out how can replace these line break inside a column to a space.
    If any one has any ideas, please let me know.
    Thanks a lot in advance.
    Ann

    Ann586341 wrote:
    I think the code split the whole thing by this line
    -- When the whole line is retrieved and not end of file or end of file
    IF v_char = CHR (10) AND v_position < v_clob_len OR v_position = v_clob_len + 1
    THEN
    Yes, exactly. That piece of code believes all CHR(10) occurences are record delimiters.
    It is not smart enough to recognize that a CHR(10) within quotation marks are part of the data.
    Optimally a solution should keep the CHR(10) rather than replacing with spaces, but that will be a bigger rewrite of the UTL_CSV code ;-)
    If you are happy with replacing with spaces, a "simple" solution could be something like:
    Declare a boolean variable in upload procedure:
    v_within_text_column   boolean := false;And use it like this:
          WHILE (v_position <= v_clob_len + 1)
          LOOP
             v_char := DBMS_LOB.SUBSTR (v_clob_data, c_chunk_len, v_position);
             IF v_char = '"' THEN
               v_within_text_column := NOT v_within_text_column;
             ELSIF v_char = CHR(10) AND v_within_text_column THEN
               v_char := ' ';
             END IF;
             v_line := v_line || v_char;
             v_position := v_position + c_chunk_len;
             -- When the whole line is retrieved and not end of file or end of file
             IF v_char = CHR (10) AND v_position < v_clob_len OR v_position = v_clob_len + 1
             THEN
               v_within_text_column := false; -- To be safe always set this on "true" linebreaks
    {code}
    +(This is untested code just written here in the text editor.)+
    It should work by toggling a flag whether you are "within" the quotes or not and then replacing CHR(10) with a space if you are within a text column.
    This way we avoid having to go through the clob more than once (it is enough that this code walks the clob one character at a time...)
    It will not handle if the clob contains situations like:
    {code}
    abc,123,"This is a text with a quote from a man who said \"To Be,
    or Not To Be\" some hundred years ago",123,xyz
    {code}
    Escaped quotes would need separate attention ;-)                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

  • How to get the column index inside a dataTable

    Hello,
    before I get staked, there are multiple threads handling familiar topics to the one I'm questioning about but none gives an anwer. If there is one, I'm propably to less skilled to see it.
    So here is my Problem: I've build a web-interface to a time-recording system. The hours worked on a certain project are displayed in a dataTable component which is generated out of a mySQL Query. Each entry (column/row) contains a inputText component to display and edit the specific value.
    Editing one of these inputText elements now fires a valueChangeEvent which reads the new value and stores it in the database. For that cause I need to know the row- and column-index of the inputText component that fired the event.
    Using the getClientId method from the valueChangeEvent I get some Information which makes it possible to calculate the row/column index. A typical clientID looks like "form_table:mainTable:0:_id14". "form_table" is the ID of the form the dataTable is in. "mainTable" is the id of the dataTable component. "0" is the row the component is in. And finally "_id14" stands for the id randomly given to the inputText component by JSF.
    My Problem is now, that though I can calculate the column out of the[i] "_id14", this calculation is hardcoded. So everytime I add a component in before the dataTable, the calculation needs to be adjusted in the code.
    The Questions:
    - How to force a sensefull id indicating a column-index for the inputText components inside the columns of a dataTable?
    - Nicer since no workaround: How to get the column-index inside the dataTable on a natural way? (e.g. out of the valueChangeEvent the specific inputText component fires)
    After some investigation here on the board and on the net I know multiple ways to get the row index, (Things like component-binding and so on) but I can't find a answer on how to get the column-index.
    Thanks to all answers and/or links to things my eyes missed while searching for one.

    ...then index 0 becomes index 1 and my program doesn't work properlyThe program works properly, just not as you expect it to.
    As you've noticed the table gives you the flexibility to move columns around. So if you move column 0 to column 1, why would you expect to still use 0 as the index? The table manages the reordering of columns for you to make sure the data being displayed in each table column comes from the correct column in the data model.
    You can manage this yourself using one of the following methods (I forget which one):
    table.convertColumnIndexToModel(int viewColumnIndex)
    table.convertColumnIndexToView(int modelColumnIndex)
    Or, you can get data from the data model directly:
    table.getModel().getValueAt(row, 0);

  • How do I wrap text around a picture in Pages 5.5?

    Using Yosemite, MacBook Pro (late 2009) Pages v. 5.5.  Previous version of Pages let me wrap text around pictures in newsletters.  I can't find this option or how-to anywhere in v. 5.5.  How do I wrap text around one side or another of an inserted picture?

    Assuming your text is in your document, and you insert a picture. While the picture is selected, you will notice that on the right format panel, the Arrange tab has appeared. Select either Stay on Page, or Move with Text — depending on your image goal — and then look at the Text Wrap feature. By default, once you drop a picture into the document, it is set to Automatic. This means you can place your pointer in the image and just move it around, while text flows around it. The smaller the image the better the flow effect. This is a discussion about Pages v5.2.2, but it will work the same in v5.5.
    Let's say you want the image flush aligned to the left margin, but want text to flow above, to the right, and below the image. Change text wrap automatic to Around, select the right icon for Text Fit, and adjust your spacing up or down for the proximity of the text wrap to the image. It looks like this with Text Fit spacing set to 9 pt.

Maybe you are looking for

  • "iTunes cannot run because some of its required files are missing" Error...

    After updating iTunes yesterday, to 7.3.1, that's the message that I get when trying to open iTunes. It further says "please reinstall itunes". How do I do that without losing all of my music in my library? PC   Windows XP  

  • Flash shockwave

    Hi! I have a problem where the local SWF-files won't open in firefox, IE works just fine but not for firefox for some reason which i cannot explain fully but i will try to with some pictures as help. https://imageshack.com/i/exOUUG2vp (Pic 1) If you

  • J2ME and BREW

    Hy, My name is Alexandre and I develop Java games.I am with the following problem:I have some old games here in the company that need to be ported to the brew solution, but they don�t have the source-code anymore(just the jars files), is there any to

  • HT201210 why can't i use my iphone 3s?

    it died.  i tried charging, but get i USB-->ITUNES Pic on my phone. I have tried to plug in to computer to restore, but it keeps giving error message.  ***!

  • I'm looking for iPad backup to windows software reviews

    I'm looking for software that will run on windows that will backup/restore reliably : iPad2 / iPhone 5 1. apps. 2. photoes / movies. 3. Settings. 4. Documents. 5. Contacts 6. iBooks Thank you, Docfxit