My Original Thread of Dyanamic Array

Hello Everyone,
I can't give any size to the array because this array will be increased during run time.The entries are entered by the User into the form(or frame) will be inserted into the database. Then, all the records will be fetched from the database and shown in the JTable. So, I can't know the number of entries of the user but I know the columns of the JTable which are same as that of the database's. That's why, I am using Dynamic Array.
I referred another Constructor of JTable that accepts only Vector object argument that is,
JTable table = new JTable(Vector data, Vector columns);
then, I tried the following codings:
try
stmt=con.createStatement();
rs=stmt.executeQuery("SELECT * FROM Report");
Vector data = new Vector();
Vector colheads = new Vector();
while(rs.next())
data.addElement(rs.getString("Enter_Year"));
data.addElement(rs.getString("UG_Production_Mi_Te"));
data.addElement(rs.getString("OC_Production_Mi_Te"));
data.addElement(rs.getString("Total_Production_Mi_Te"));
data.addElement(rs.getString("OBR_MM3"));
data.addElement(rs.getString("OMS_Te"));
data.addElement(rs.getString("Coal_Offtake_Mi_Te"));
data.addElement(rs.getString("Supply_to_Steel_Plant_Th_Te"));
data.addElement(rs.getString("Royalty_SalesTax_MP_Crs"));
data.addElement(rs.getString("Royalty_SalesTax_CG_Crs"));
data.addElement(rs.getString("Total_ManPower"));
data.addElement(rs.getString("Fatality_Rate_per_Mi_Te_Output"));
data.addElement(rs.getString("Total_Wellfare_Expenditure_Crs"));
colheads.addElement("Year");
colheads.addElement("U.G.Production(in Mi.Te.)");
---------My all column names----------
JTable table = new JTable(data,colheads); // ClassCastExecption error
JScrollPane jsp = new JScrollPane(table);
add(jsp);
this.setVisible(true);
catch(Exception e)
System.out.println(e);
Then, I got an error in the statement containing comment line, ClassCastExecption . I cast the Vector object inside the JTable Constructor like,
JTable table = new JTable((String) data, colheads);
but, it gave an error related to JTable Constructor. Then, I cast it above the JTable object and then pass the String array object into the JTable Constructor but JTable accepts only Vector and 2D String array object for both of its argument. It is not accepting the One Dimensional String array object for data or info. it shows and one Vector object for column headings. How can I Cast the Vector object into the String object and pass the Vector objects into the Constuctor of JTable?
I am trying to cast the Vector object into String object because at the comment line Statement, I received an error " java.lang.ClassCastExecption"
and please tell me another thing that how can I iterate through the array records when the array is initialized during declaration like,
while(rs.next())
String [][] data = {{rs.getString("Enter_Year"),rs.getString("UG_Production_Mi_Te")}};
String colheads[] = {"Year", ---------};
table = new JTable(data,colheads);
jsp = new JScrollPane(table);
This coding is running and reading all the record from the database but it is showing only last record of database into the JTable and overlapps all the previous records. So, I am trying to iterate through the Array and I want to show one record at one time and then increment the index of Array by 1 and then show the next record into the JTable without overlapping.

jschell wrote:
M.V.Asolkar wrote:
This coding is running and reading all the record from the database but it is showing only last record of database into the JTable and overlapps all the previous records. So, I am trying to iterate through the Array and I want to show one record at one time and then increment the index of Array by 1 and then show the next record into the JTable without overlapping.This is just as confused as your last question. Right now your code is so jumbled that there really isn't any easy way to correct it.
You need to stop attempting to mix GUI and JDBC. Your code should have two classes.
1. Class that does jdbc and NO gui.
2. Class that does gui, it uses class 1.
You start by creating 2 or at least part of 2 so you can figure out the exact data structure that you need to populate your gui.
AFTER you do that then you write 1 such that it creates and returns the data structures that you discovered.jschell is absolutely on point, Asolkar, I feel like you are just putting some hacked code together... best practice would be create a seperate class that serve for jdbc and query construction. Then you you can use different class to do any kind of format or representation.
In this case generate a class class, like example:
DBConnect.java
*@author Anuradha Uduwage
public class DBConnect {
        static String url = "jdbc:oracle:thin:@tnsproperties";
        // shared datbase connection object
        private Connection conn;
        // shared statement object. 
        private Statement stmt;
        private Statement substmt;
         * connects to the oracle instance.  Also opens the statement object we use to communicate.
         * @return true if successful, false if an exception occurs
        public boolean init(){
                try {
                        // NOTE: If you want to use a different database this DriverManager statement needs to be replaced
                        //       with the appropriate driver.
                DriverManager.registerDriver (new oracle.jdbc.driver.OracleDriver());
                        conn = DriverManager.getConnection
                        stmt = conn.createStatement();
                        substmt = conn.createStatement();
                        return true;
                } catch (SQLException e) {
                        e.printStackTrace();
        // if we had an exception allow the system to close down gracefuly.            
                return false;
        //this is the method to generate ur query
        public Vector<Vector<String>> foo() {
                Vector<Vector<String>> fooVector = new Vector<Vector<String>>();
                try {
                        ResultSet rs = stmt.executeQuery("select column1, .. columnN from whatever");
                        while (rs.next()) {
                                Vector<String> boo = new Vector<String>();
                                boo.add(rs.getString("ColumnName"));
                                boo.add(rs.getString("ColumnName"));
                                fooVector.add(boo);
                } catch (SQLException e) {
                        e.printStackTrace();
                return fooVector;
}and then you can create a another class to generate your JTable or what ever you want.
And Geeze, if you want an answer please try to put sometime on writing the post, and be more clear...
Anuradha Uduwage
Edited by: Tilter on May 15, 2009 9:14 PM
Edited by: Tilter on May 15, 2009 9:15 PM

Similar Messages

  • How do I find komakai who has answered my question with 3 replies , I cant find my original thread or komakai what is wrong with me?

    An extension that I apparently downloaded 18 months ago has just started to play up and is preventing me accessing the net with Firefox. Komakai (bless his heart) has suggested a couple of solutions. I tried them an now want to get back to him with unsatisfactory results but, dummy that I am, I cant find the original thread nor komakai. Computers can drive me crazy sometimes, but then again i'm not the most experienced user

    To find questions that you have posted or replies that you have posted to questions asked by other users on this forum
    #sign-in to the forum with your user name and password
    #*click "Sign In" in the upper right corner of this page --> https://support.mozilla.com/en-US/questions/
    #after the page has reloaded, click "My Contributions" on the line just above the first question listed; the page will reload with only links to your questions/replies
    #when done, click on "All" just above the first question listed, to return to a list of all forum questions
    '''If this reply solves your problem, please click "Solved It" next to this reply when <u>signed-in</u> to the forum.'''

  • Wait for all threads in a array to die

    I everyone. I'm from Portugal and I have some experience in JAVA programming (approximately five years) but this is the first the first time that i'm trying to use threads. I'm trying to learn writing some simpler code that does almost exactly at the basic level the same stuff that a complex application that I need to write for my work.
    What I'm trying to do is execute a counter that counts all operations in threads belonging to the same array (an array of n threads).
    A static variable in the Thread class (implementing Runnable) counts all operations performed by all threads and sums them all and shoud display the total of operations after all threads terminate, but this exactly what I don't know how to do:
    This is my example code:
    public class TT1 implements Runnable {
         int id;
         double last_number;
         static int threads_counter = 0;
         static int total_threads = 4;
         static long total_numbers;
         int total_randoms = 1000;
         public void run() {
              for (int i=0;i<total_randoms;i++)
                   total_numbers++;
                   // does some stuff, in this case, generate a random number!
                   last_number = Math.random();
              System.out.printf("Thread %d:%f(%d)\n",id,last_number,total_numbers);
         public TT1() {
              id = threads_counter++;
              new Thread(this).start();
         public static void main(String[] args) {
              // TODO Auto-generated method stub
              Thread [] threads = new Thread[total_threads];
              for (int i=0;i<threads.length;i++)
                   threads[i] = new Thread(new TT1());
              /* commented code using join(), is not working or I don't know
              how to use it! */
              for (int i=0;i<threads.length;i++)
                   try {
                        threads.join();
                   } catch (InterruptedException e) {
                        e.printStackTrace();
              try {
                   threads[total_threads-1].join();
              } catch (InterruptedException e) {
                   e.printStackTrace();
              // this line should be executed ONLY after ALL threads have died!
              System.out.println("******GENERATED NUMBERS TOTAL:" + total_numbers);
    Somebody can give me a hint how to solve this ?

    Thanks for your replies.
    Actually, i've corrected the code, now i'm starting the threads outside the constructor. Originally I thought this could be a simpler way to create the threads: launching them at same time I'm creating them! Is this wrong ? :) Well, watching the results.
    I changed my code:
    public class TT1 implements Runnable {
         int id;
         double last_number;
         static int threads_counter = 0;
         static int total_threads = 4;
         static long total_numbers;
         int total_randoms = 1000;
         public void run() {
              for (int i=0;i<total_randoms;i++)
                   total_numbers++;
                   // does some stuff, in this case, generate a random number!
                   last_number = Math.random();
              System.out.printf("Thread %d:%f(%d)\n",id,last_number,total_numbers);
         public TT1() {
              id = threads_counter++;
         public static void main(String[] args) {
              // TODO Auto-generated method stub
              Thread [] threads = new Thread[total_threads];
              /* create individual threads */
              for (int i=0;i<threads.length;i++)
                   threads[i] = new Thread(new TT1());
              /* launch the threads (NEW CODE) */
              for (int i=0;i<threads.length;i++)
                   threads.start();
              /* commented code using join(), is not working or I don't know
              how to use it! */
              for (int i=0;i<threads.length;i++)
                   try {
                        threads[i].join();
                   } catch (InterruptedException e) {
                        e.printStackTrace();
              // this line should be executed ONLY after ALL threads have died!
              System.out.println("******GENERATED NUMBERS TOTAL:" + total_numbers);
    And I obtain the output:
    $ java TT1
    Thread 0:0,191546(1000)
    Thread 1:0,937476(2000)
    Thread 2:0,825079(3000)
    Thread 3:0,451367(4000)
    ******GENERATED NUMBERS TOTAL:4000Exactly as I want it!
    All is good when it works good ;)
    Best regards

  • How do I access objects from the original Thread?

    I have this simple JApplet that just makes a circle bounce around the screen. Here it is:
    import java.awt.Color;
    import javax.swing.JApplet;
    import java.awt.Graphics;
    import java.awt.event.MouseListener;
    import java.awt.event.MouseEvent;
    public class TestApplet3 extends JApplet implements MouseListener {
        private int lastX;          // x coordinate of circle
        private int lastY;          // y coordinate of circle
        private int d = 15;          // diameter of circle
        public void paint(Graphics g) {
        public void init() {
            addMouseListener(this);
        public void mouseClicked(MouseEvent event) {
            Graphics gx = this.getGraphics();
            for (int x = 0, y = 0, count = 0, horiz = 2, vert = 2, k = 2; count < 1000; x = x + horiz, y = y + vert, count++) {
                if ((x + d) >= 350) {
                    horiz = -horiz;
                if ((x <= 0) && (horiz < 0)) {
                    horiz = -horiz;
                if ((y + d) >= 200) {
                    vert = -vert;
                if ((y <= 0) && (vert < 0)) {
                    vert = -vert;
                gx.setColor(Color.WHITE);
                gx.fillOval(lastX, lastY, d, d);
                gx.setColor(Color.RED);
                lastX = x;
                lastY = y;
                gx.fillOval(lastX, lastY, d, d);
                try {
                    Thread.sleep(20);
                } catch (Exception ex) {
                    System.out.println(ex.getMessage());
        public void mouseEntered(MouseEvent event) {
        public void mouseExited(MouseEvent event) {
        public void mousePressed(MouseEvent event) {
        public void mouseReleased(MouseEvent event) {
    }But now I'd like to change it so that when the mouse is clicked a new Thread is spawned to run the code within the mouseClicked method..... this will allow multiple circles to bounce around and will also keep the applet responsive to new mouse clicks... so I've tried changing it below:
    * To change this template, choose Tools | Templates
    * and open the template in the editor.
    package runninggraph;
    * @author epuknol
    import java.awt.Color;
    import javax.swing.JApplet;
    import java.awt.Graphics;
    import java.awt.event.MouseListener;
    import java.awt.event.MouseEvent;
    public class TestApplet3 extends JApplet implements MouseListener, Runnable {
        private int lastX;          // x coordinate of circle
        private int lastY;          // y coordinate of circle
        private int d = 15;          // diameter of circle
        public void paint(Graphics g) {
        public void init() {
            addMouseListener(this);
        public void run() {
            Graphics gx = this.getGraphics();
            for (int x = 0, y = 0, count = 0, horiz = 2, vert = 2, k = 2; count < 1000; x = x + horiz, y = y + vert, count++) {
                if ((x + d) >= 350) {
                    horiz = -horiz;
                if ((x <= 0) && (horiz < 0)) {
                    horiz = -horiz;
                if ((y + d) >= 200) {
                    vert = -vert;
                if ((y <= 0) && (vert < 0)) {
                    vert = -vert;
                gx.setColor(Color.WHITE);
                gx.fillOval(lastX, lastY, d, d);
                gx.setColor(Color.RED);
                lastX = x;
                lastY = y;
                gx.fillOval(lastX, lastY, d, d);
                try {
                    Thread.sleep(20);
                } catch (Exception ex) {
                    System.out.println(ex.getMessage());
        public void mouseClicked(MouseEvent event) {
            (new Thread(new TestApplet())).start();       
        public void mouseEntered(MouseEvent event) {
        public void mouseExited(MouseEvent event) {
        public void mousePressed(MouseEvent event) {
        public void mouseReleased(MouseEvent event) {
    }but this doesn't work - I think because the this.getGraphics() doesn't refer back to the same object ..... I've tried some other things too - like defining the Graphics gx as a class variable and initializing it before spawning the new Thread ... but I can't access gx using that technique either.
    Can somebody please help me get where I'm trying to go?
    Thanks.

    Aw heck, got bored. For instance, this draws a bunch of balls without a direct call to Thread anything:
    BouncingCircles.java
    import java.awt.Color;
    import java.awt.Dimension;
    import java.awt.Graphics;
    import java.awt.Graphics2D;
    import java.awt.Point;
    import java.awt.RenderingHints;
    import java.awt.event.ActionEvent;
    import java.awt.event.ActionListener;
    import java.awt.event.MouseAdapter;
    import java.awt.event.MouseEvent;
    import java.util.ArrayList;
    import java.util.List;
    import javax.swing.JPanel;
    import javax.swing.Timer;
    * creates a JPanel that draws bouncing circles within it. 
    * @author Pete
    public class BouncingCircles {
      private static final int DELAY = 15;
      private static final int DIAMETER = 15;
      private static final int DELTA = 5;
      List<Ball> ballList = new ArrayList<Ball>(); // list of all balls
      private JPanel mainPanel = new JPanel() {
        @Override
        protected void paintComponent(Graphics g) {
          super.paintComponent(g);
          myPaint(g);
      // Swing Timer that tells the balls to move and tells the JPanel to then draw them
      private Timer sTimer = new Timer(DELAY, new ActionListener() {
        public void actionPerformed(ActionEvent e) {
          timerAction(e);
      public BouncingCircles() {
        mainPanel.setPreferredSize(new Dimension(400, 400));
        mainPanel.addMouseListener(new MouseAdapter() {
          @Override
          // add new ball with each mouse press
          public void mousePressed(MouseEvent e) {
            ballList.add(new Ball(e.getPoint(), new Point(DELTA, DELTA)));
        sTimer.start();
      public JPanel getPanel() {
        return mainPanel;
      private void timerAction(ActionEvent e) {
        Dimension d = mainPanel.getSize();
        for (Ball ball : ballList) {
          if (ball.getPoint().x < 0) {
            ball.setXDirectionRight(true);
          } else if (ball.getPoint().x + DIAMETER > d.width) {
            ball.setXDirectionRight(false);
          if (ball.getPoint().y < 0) {
            ball.setYDirectionDown(true);
          } else if (ball.getPoint().y + DIAMETER > d.height) {
            ball.setYDirectionDown(false);
          ball.increment();
        mainPanel.repaint();
       * paintComponent method draws all balls in List
       * @param g
      private void myPaint(Graphics g) {
        g.setColor(Color.red);
        Graphics2D g2d = (Graphics2D) g;
        RenderingHints rh = new RenderingHints(RenderingHints.KEY_ANTIALIASING,
            RenderingHints.VALUE_ANTIALIAS_ON);
        g2d.setRenderingHints(rh);
        for (Ball ball : ballList) {
          g.fillOval(ball.getPoint().x, ball.getPoint().y, DIAMETER, DIAMETER);
      private class Ball {
        private Point point = new Point();
        private Point velocity = new Point();
        public Ball(Point point, Point velocity) {
          this.point = point;
          this.velocity = velocity;
        public Point getPoint() {
          return point;
        public Point getVelocity() {
          return velocity;
        public void increment() {
          point = new Point(point.x + velocity.x, point.y + velocity.y);
        public void setXDirectionRight(boolean right) {
          int newVelocityX = Math.abs(velocity.x);
          if (!right) {
            newVelocityX = -newVelocityX;
          velocity = new Point(newVelocityX, velocity.y);
        public void setYDirectionDown(boolean down) {
          int newVelocityY = Math.abs(velocity.y);
          if (!down) {
            newVelocityY = -newVelocityY;
          velocity = new Point(velocity.x, newVelocityY);
    }And this displays the JPanel produced above in a standard JApplet.
    BouncingCircApplet.java
    import java.lang.reflect.InvocationTargetException;
    import javax.swing.JApplet;
    import javax.swing.SwingUtilities;
    public class BouncingCircApplet extends JApplet {
      @Override
      public void init() {
        try {
          SwingUtilities.invokeAndWait(new Runnable() {
            public void run() {
              getContentPane().add(new BouncingCircles().getPanel());
        } catch (InterruptedException e) {
          e.printStackTrace();
        } catch (InvocationTargetException e) {
          e.printStackTrace();
    }

  • Right-click in Image gallery Find Original Thread

    When browsing an users image gallery it would be very nice if we could right click an image (or whatever) and find the discusion where the image was originally posted. Finding all the links to that image on the forum will earn bonus points. This option is missing and will be very useful.
    Ben
    Ben Rayner
    I am currently active on.. MainStream Preppers
    Rayner's Ridge is under construction

    Thanks Ben, I have submitted this suggestions.
    Regards,
    Laura
    Web Support & Operations
    National Instruments

  • Launching two thread and killing the original thread

    I'm having problems developing my application.
    Hi,
    I'm running and application wich has to self-update periodically. the way it's done is that i launch a different project, included in a different jar file. This project downloads an update for the application and relaunchs my application.
    At first, i did that change of application using a process wich executes the update jar (using getRuntime.exec()), but it looks that once launched the process, my application waits until the update jar is finished.
    I've thought to use parallel threads, i mean, my application is running on a thread, if update is necessary, then i create a thread wich executes the update jar and, once the download and update have been completed, create a new thread with my updated application, finishing the update thread after launching it.
    Do you know if, once updated my application's jar, the new thread will be executed with my updated code?
    I hope somebody can help me, thank you

    well, on my computer works, but it has to work in the end on a PDA with a customized jdk from java 1.3, so i'm not sure yet if it works fine. Once i have done it, i will tell you

  • 64-bit JNI C++ to JAVA invocation multiple threads classloader problem

    Hi ALL,
    I have a C++ app that invokes Java classes on 64-bit Solaris 10 with 64-bit JVM.
    Here is the problem:
    The native non-main (not the thread that initializes the JVM) threads would not be able to find any user-define class.
    Here are the symptoms and observations:
    1. JNIEnv::ExceptionDescribe() showed the following StackOverflowError:
    Exception in thread "Thread-0" java.lang.StackOverflowError
            at java.util.Arrays.copyOf(Arrays.java:2734)
            at java.util.Vector.ensureCapacityHelper(Vector.java:226)
            at java.util.Vector.addElement(Vector.java:573)
            at java.lang.ClassLoader.addClass(ClassLoader.java:173)
            at java.lang.ClassLoader.defineClass1(Native Method)
            at java.lang.ClassLoader.defineClass(ClassLoader.java:621)
            at java.security.SecureClassLoader.defineClass(SecureClassLoader.java:124)
            at java.net.URLClassLoader.defineClass(URLClassLoader.java:260)
            at java.net.URLClassLoader.access$000(URLClassLoader.java:56)
            at java.net.URLClassLoader$1.run(URLClassLoader.java:195)
            at java.security.AccessController.doPrivileged(Native Method)
            at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
            at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
            at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
            at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)2. The "main thread" that instantiates the JVM has no problem finding and loading any class or method
    3. But the other threads (non-main threads) would not be able to find the user-defined classes unless the classes were already loaded by the main thread.
    4. The non-main threads can find the "standard" java classes with no problem
    5. The same app ran fine on 32-bit system.
    6. Except for the JVM reference is global, each thread acquired JNIEnv by either GetEnv() or AttachCurrentThread().
    Any idea why it is a problem with 64-bit?
    I have the sample program to reproduce this issue in this thread: http://forums.sun.com/thread.jspa?messageID=10885363&#10885363. That was the original thread I raised but I have narrowed it down to a more concrete scenario. That's why I am creating this new thread. I hope this does not break any rule on this forum. If it does, I apologize.
    I really appreciate it if anyone can provide any help/suggestion.
    Regards,
    - Triet

    Here is the sample program. Again, this works on 32-bit but not 64-bit.
    #include <string>
    #include "jni.h"
    #include "TestThread.h"
    static JavaVM *g_pjvm = NULL;  /* denotes a Java VM */
    static JNIEnv *g_penv = NULL;  /* pointer to native method interface */
    void initJVM(char** jvmOptions) {
        printf("RJniTest init starts...\n");
        JavaVMInitArgs vm_args; /* JDK/JRE 6 VM initialization arguments */
        JavaVMOption* poptions;
        int optionLen = 0;
        while (jvmOptions[optionLen]) {
            optionLen++;
        printf("RJniTest::init len=%d\n", optionLen);
        if (optionLen > 0) {
            printf("RJniWrapper::init jvmOptions\n");
            poptions = new JavaVMOption[optionLen];
            //poptions[0].optionString = "-Djava.class.path=/usr/lib/java";
            int idx = 0;
            while (jvmOptions[idx]) {
                poptions[idx].optionString = jvmOptions[idx];
                idx++;
        printf("RJniTest::init vm_args: version(%x), nOptions(%d)\n",
                JNI_VERSION_1_6, optionLen);
        vm_args.version = JNI_VERSION_1_6;
        vm_args.nOptions = optionLen;
        vm_args.options = poptions;
        vm_args.ignoreUnrecognized = JNI_FALSE;
        // load and initialize a Java VM, return a JNI interface
        // pointer in env
        printf("RJniTest::init creates JVM\n");
        JNI_CreateJavaVM(&g_pjvm, (void**)&g_penv, &vm_args);
        printf("RJniTest init ends\n");
    void findClass(const char* classname) {
        static const char* fname = "justFindClasses";
        printf("%s: findClass: %s\n", fname, classname);
        JNIEnv* jenv;
        jint ret = g_pjvm->GetEnv((void**)&jenv, JNI_VERSION_1_6);
        if (ret == JNI_EDETACHED) {
            ret = g_pjvm->AttachCurrentThread((void**)&jenv, NULL);
            if (ret != JNI_OK || jenv == NULL) {
                printf("%s: get env error: ret=%d\n", ret, fname);
            } else {
                printf("%s: got new env\n", fname);
        } else if (ret == JNI_OK) {
            printf("%s: env already there\n");
        jclass classref;
        classref = jenv->FindClass(classname);
        if (classref == NULL) {
            printf("%s: %s class not found!\n", fname, classname);
            if (jenv->ExceptionOccurred()) {
                jenv->ExceptionDescribe();
                jenv->ExceptionClear();
        printf("%s: found class: %s\n", fname, classname);
    class RJniTestThread : public TestThread {
    public:
        void threadmain();
    void RJniTestThread::threadmain() {
        printf("RJniTestThread::threadmain: Starting testing\n");
        findClass("org/apache/commons/logging/Log");
        findClass("java/util/List");
        printf("RJniTestThread::threadmain: done.\n");
    int main(int argc, char** argv) {
        char **jvmOptions = NULL;
        printf("RJniTestDriver starts...\n");
        if (argc > 1) {
            jvmOptions = new char*[argc];
            for (int i = 0; i < argc ; i ++) {
                jvmOptions[i] = argv[i + 1];
            jvmOptions[argc - 1] = NULL;
        } else {
            int size = 8;
            int i = 0;
            jvmOptions = new char*[size];
            jvmOptions[i++] = (char*) "-Djava.class.path=<list of jar files and path here>";
            jvmOptions[i++] = (char*) "-Djava.library.path=/sandbox/mxdev/3rdparty/java/unix/jdk1.6.0_14/jre/lib/sparc";
            jvmOptions[i++] = (char*) "-Djava.compiler=NONE";
            jvmOptions[i++] = (char*) "-verbose:jni";
            jvmOptions[i++] = (char*) "-Xcheck:jni";
            jvmOptions[i++] = NULL;
        printf("init JVM\n");
        initJVM(jvmOptions);
        // UNCOMMENT HERE
        // findClass("org/apache/commons/logging/Log");
        // findClass("java/util/List");
        // UNCOMMENT END
        printf("start test thread\n");
        RJniTestThread testThread;
        ThreadId tid = testThread.launch();
        printf("wait for test thread\n");
        int ret = pthread_join(tid, NULL);
        printf("RJniTestDriver ends\n");
    }

  • ABAP field symbols and PERL reference variables to unnamed arrays.

    Rob -
    Please do NOT delete this post even though it contains this link:
    ABAP field symbols and PERL reference variables to unnamed arrays.
    to a question I posted in the Scripting Languages forum.
    It's a question that should be of interest to ABAP programmers, and they may miss if they don't frequent the SL forum ...
    Thanks for your forbearance here (in advance, of course) ...
    Best
    djh
    Edited by: Rob Burbank on Jul 11, 2011 1:26 PM

    If interested, please reply in the original thread. We don't want multiple conversations at cross purposes do we?
    Rob

  • How to short 2d array in 0,2n,3n,4n​,,,,

    how to short array according to even and odd no of rows,
    example is given below
     x                  y
    1.236589        1
    0                    0
    3.236589        2   
    0                   0
    4.326589        3
    0                   0
    5.321456       4
    please reply
    regards
    prince 

    Is this the same as your other question: http://forums.ni.com/t5/LabVIEW/how-to-blank-value​-of-1-coloum-with-other-coloum/m-p/1797394
    If so, please stick to the original thread.
    If not, I suggest you look at the Decimate 1D Array function. It's not that difficult to use is it on your 2D array.

  • Synchronis​e time in array with the real time from computer

    i need help in syrnchonising my array and the real time running in my computer
    As stated in the text file attached,
    12:32:30 AM 0.38 1.14
    2nd column is wind speed, 3rd is gust speed.
    i would like to display the wind speed in a gauge with the right values. like for example, at 12:32:30 AM OF REAL TIME, NOT BASED ON THE TEXT, i would like to display the 0.38m's of wind speed in the gauge.
    how do i sync the time in array with the real-time?
    i have attached a program i made so far. its abit messy. im still a student, need a lil help
    Attachments:
    Wind Speed and Gust Speed.txt ‏13 KB
    Time and MaxMin.vi ‏18 KB

    wali123 wrote:
    wat u mean duplicate?
    Don't continually post the same question over and over. If you have new information, add it to the original thread. Did you actually click the link under the word "duplicate"?
    Chopping up a discussion about the same thing into several threads (like here is this thread, but also here and here) serves no useful purpose. It will not increase the chance of a good answer, in fact most people will simply ignore it.
    Imagine if everybody else would post like you! Every discussion would be if three different places and we would have three times more threads.
    LabVIEW Champion . Do more with less code and in less time .

  • Calibrating an array of grayscale pixel data

    If I obtain an array from a grayscale picture which shows the grayscale pixel values from 0-255, how do I calibrate this onto another array so I can use the new data within an equation. For my project each value of grayscale is equivalent to a temperature. For example the value of intensity 20 is equivalent to 2380K, 40~1920K How can I do this. Please help!

    Hi,
    I'm sorry I didn't reply to your original thread, like I said.
    If you have a 2d array of 8-bit values, make two for loops inside each
    other. For each value, do the calibration operation you like to do. The
    fastest way is to make a 1d array of values outside the two for loops, and
    in the two for loops, look each gray scale value up in the 1d array.
    If you are looking up the original values from the bitmap in the lookup
    table of the bitmap, you could modify the original lookup table to reflect
    the calibrated values. This will save processor time.
    Hope it helps,
    Wiebe.
    "mepgkas" wrote in message
    news:[email protected]..
    > If I obtain an array from a grayscale picture which shows the
    > grayscale pixel val
    ues from 0-255, how do I calibrate this onto
    > another array so I can use the new data within an equation. For my
    > project each value of grayscale is equivalent to a temperature. For
    > example the value of intensity 20 is equivalent to 2380K, 40~1920K How
    > can I do this. Please help!

  • Response to Plotting 1D array

    "In general, if the prototype of the method specifies a matrix for a parameter, you must specify a matrix and vector is not an option. Depending on what you're trying to do you could try creating a matrix that has a single row and passing that for the parameter.
    - Elton"
    My response:
    "If you don't know the size of array, and want to use say "malloc," you cannot create a 2-D array using it; however, dynamically creating a 1-D array using "malloc" is no problem. Then, given the 1-D array created by "malloc," how can I apply it to Plot3DSurface?"

    Please see the answer posted in the original thread about this issue.
    - Elton

  • Add waveform and array

    While looking at this thread, I discovered an undocumented "feature" of LV which can cause severe performace problems with modest sized arrays and waveforms.
    In the original thread an attempt was made to remove the DC component from a waveform by subtracting  an array (rather than a scalar). Both the Y array in the waveform and the array of DC components were the same size with less than 15000 elements. Attempting to run that part of that VI resulted in severe slow down of not only LV but the OS and everything else running on the computer because it was paging data to/from disk.  The only thing wired to the output of Subtract was a graph.
    The result of subtracting an array of numerics from a waveform is an array of waveforms having the same number of elements as the array of numerics. The size of the Y array in the waveform does not seem to matter. The attached VI has the array of numerics and the Y array of the waveform the same size.
    The same thing happens with Add.
    The Detailed Help for Add and Subtract do not mention this combination. The example linked on those help pages also does not show this combination.
    The Profiler gives this data for the attached VI:
    Samples Bytes
    10               15 kB
    100           295 kB
    1000          24 MB
    2000          97 MB
    3000        217 MB
    4000        385 MB
    5000        602 MB
    6000        866 MB
    7000      1178 MB
    8000      1538 MB
    At 7000 samples I start to hear the disk drive while the VI runs and at 8000 the disk is very busy.
    After some thought I decided that this is not a bug, but because of the way the data size explodes, it should be documented.
    Clearly this is not a common use case, but I could see someone trying to do baseline correction on data from an instrument this way, as that is essentially what the thread linked above was trying to do.
    Output configuration is not available after a waveform is wired, probably because of the polymorphic VI used for waveforms. An output configuration option to create a single waveform with element by element addition/subtraction might be useful.
    Lynn
    Attachments:
    Subtract array from waveform.vi ‏20 KB

    Wow, that is kind of weird.  The way I see it, when you subtract a waveform and a numeric array, the subtraction should just be done on the Y component of the waveform.  So you should still just have a single waveform out.  So by subtracting a waveform with an array of numerics, it should act the same as if you extracted the Y, did the subtraction, and put the Y back in.  This could lead to a shortened size of Y, but I see no reason why you should get an array of waveforms out.
    But after running your VI, I guess I can see what LabVIEW is doing.  It is as if you used a FOR loop with just the numeric array autoindexed and then you autoindex the output waveform.
    I can see the intent, but it just doesn't sit right with me.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines

  • Split 2D array to 1D arrays by row

    Hi
    I am trying to do 2 things with arrays and their dimensions. They both seem quite basic, but I can't figure out how to do them...
    1. Split a 2D array of size 2 x N into two 1D arrays of length N.
    2. Reshape a 2D array of size m x n into a 1D array of length mn, then do the inverse procedure and get it back to a 2D m x n array. (After doing some manipulation, interpolation, etc.)
    Thanks!

    Justin_Reina wrote:
    Back to the original question -
    1. Split a 2D array of 2xN into (2) 1D arrays of len N
         This code achieves this. It uses the cluster datatype to conceptually & visually segment
          the problem-statement's solution - try to make a cleaner visual solution
    A cleaner visual solution would be to just leave it as a 2D array! The existing display of rows and columns is very clear and easy to view and understand! Why all that song and dance of using complicated hierachical structures? Since when did the word "split" mean "wrap it into a complicated structure for easier viewing"?
    Justin_Reina wrote:
     I don't care about ragged 2D arrays, AKA 'sloppy programming' ... See the answer above
        for my clarifications.
    Ragged arrays have nothing to do with sloppy programming. They are a valid data structure useful for certain scenarios.
    Justin_Reina wrote:
    So ummm, thanks for your direct & public sarcasm but I would suggest that occur on the side in email in the future...
    Well, a public post deserves a public answer. I am probably not the only one confused by your post dangling from the end of an ancient solved thread so a public clarification is beneficial to all. Besides, your e-mail address is probably not public and even if I had it, e-mailing somebody out of the blue would need a very, very good reason. I rarely do that.
    I just asked for clarification and pointed out what parts of your posts confused me in the context of the original thread. No sarcasm anywhere.

  • External Hard Drive Questions... (original posting by Nile36)

    Original Post:
    I just installed a Western Digital 500GB External HD. I partitoined the drive (one side 150 GB to be a little larger than my iMac hard drive) using Disk Utility. Now, the icon of the External Drive is still listed in my finder as 150GB but I do not seem to have access to the additional 350GB on the drive.
    The initial thread has been marked as 'Answered' although there is one more thing that can be added. While I posted a resolution in the original thread I've added it here in case those interested/affected ignore the first one.
    You can download and try VolumeWorks. I found it at:
    http://mac.majorgeeks.com/download4983.html
    I ran in trial mode to see what it was capable of and it did allow me to take a partition of 'free space' and format it as HFS+ without affecting my other, data filled test partition. Contrary to what I previously thought (and unlike the iPartition demo), it wrote the changes to the drive.
    The new partition is HFS+ only. To add journaling, use the Disk Utility from Apple.
    iMac Core Duo (20")   Mac OS X (10.4.9)  

    There's something missing in your explanation. If you're getting the "original file..." message, that would indicate that you may have had all your music files on your laptop drive at one point and them moved some of them to the external drive without using the proper procedure.
    If you don't have a lot of playlists, star ratings, and that sort of information that you're trying to preserve, then Mike's suggestion is an easy way out. If you do have a lot of that kind of information, then you may need to see if you can restore your setup to its former condition, when it was all working, and then use proper procedures to move files to the external drive or whatever it was that you were trying to do.

Maybe you are looking for

  • Texts in method in different languages

    Hi, I have a report which generates a string in different languages depending on the selection input. I have translated the texts in method (for example text-t01) from original language EN to Chineese ZH. When the user is logged into the system using

  • How to organize Places tags in Elements 12

    Hi I have assigned pictures to several different locations in Colorado using the Photoshop Elements 12 Organizer. Most of these locations are listed under "Colorado" category but one location persistantly lists under "CO". I have the same issue with

  • IOS4 emailing photo error

    Ever since I upgraded to iOS4, I have had problems emailing photos. Pictures that I send out are mis-orientated and show up as attachments, meaning the pics are not embedded in the actual email. This never happened to me with the old OS... See for yo

  • Where is the focus after executing a statement in worksheet ? (804)

    After executing a statement in the sqlworksheet by hitting the 'execute statement' button, 'execute script' button or ctrl-enter the focus is no longer in the worksheet, forcing us to point/click the mouse to the edit area each time. Using pre-releas

  • Where can i get IEEE488 standard

    we are developing a product which including GPIB. Could you pls tell me where i can get the GPIB standard