Generating Code with NetBeans

I'm using NetBeans IDE 6.1 UML editor to generate java code. When I choose the "Generate Code" option and select the options I want. The console shows the message:
Generating source from template "Java/CompilationUnit.java" ...ERROR: java.lang.NullPointerException
How do I find where the Null Pointer Exception is being thrown?

Rick.Lohmeyer wrote:
I'm using NetBeans IDE 6.1 UML editor to generate java code. When I choose the "Generate Code" option and select the options I want. The console shows the message:
Generating source from template "Java/CompilationUnit.java" ...ERROR: java.lang.NullPointerException
How do I find where the Null Pointer Exception is being thrown?You go over to the NetBeans forum and ask them the same questions, since this is not a Java question, but a IDE specific question. Also if you are not a fairly seasoned programmer, then may I happily wish you cheers with all the frustration and grief that inevitably awaits you in your autocoding endeavors.

Similar Messages

  • In other words jQuery mobile does not generate code with result can not test Apps in dw cs6

    from the time compiled in phonegap dw c6 tools and tested from dw the App in Android sdk, for a jQuery mobile App the, code in split/Live is the same as split/Live/Live Code.... in other words jQuery mobile does not generate code with result can not test Apps in dw cs6, but design shown without jQ mobile generated code, well?

    well, jQuery mobile stopped to generate code with result can not test Apps in dw cs6, but design shown without jQ mobile generated code, well (neither generated code seems nor design as seem in mobile)....????

  • Generated code with some transformations - need help

    I have a mapping as below:
    1. Source table and input parameter are input to splitter
    2. Splitter has conditions as if input parameter is NULL then insert/update target table
    3. There is a constant with 4 Attributes, which also directly insert into the target table
    4. If the input parameter is NOT NULL then output from splitter goes into a filter where the condition is checked with the value from input parameter
    5. the output from filter is inserted/ updated into the target table. Here again the values from constant are also inserted into the target table.
    The Target table has 15 columns out of which I have 11 columns set for matching. I have the loading type set to 'UPDATE/INSERT'
    When I generate this code a merge statement is included in the code and everything works fine.
    My environment is:
    OWB: 10.2.0.2
    DB source & Target : 10g Rel2.
    I changed the mapping so that instead of 4 attributes in the constant above, I have 2 attributes.
    I have another constant with one of the 2 attributes removed from the above constant.
    The value from this constant goes as an input to transformation operator, the transformation operator has 2 outputs. I mapped these outputs to the splitter input.
    There after this is similar to the above mapping explained earlier. Basically the 2 attributes which were part of the constant in the first mapping are now from a transformation operator (procedure) and I have these values passed all across the mapping (through splitter and filter as is without any changes).
    Now when I generate the code, the generated code does not have a merge statement but processed row by row and hence have a cursor and then separate update and insert.
    This code is much slower than the earlier one.
    I want to retrieve the values through a procedure as in the second case instead of the constant but want to have a set based processing as in the first case. How Can I do this?
    Any help please?
    Thanks,
    Maruthi

    Hi,
    Do not use the transformation operator. All transformation are nothing but built-in SQL functions. Take your constant values into an expression operator and then make two output attributes in it. In the expression builder call the function appropriately and as mentioned above, generate the code in set based fail over to row based (default mode) and execute it. The mapping should execute in Set Based Mode.
    Regards
    -AP

  • Embed labview generated code with c++ gui application

    Hey everyone ,
      I am very new to labview and trying to learn it  ... but before that i wanted to make sure a doubt which i have in my mind , the problem is that i have a realtime GUI application built on c++ widgets and i want to change the existing DSP block in this application with the code generated by using the LABVIEW , i am sorry that have very
    less amount of knowledge regarding labview so i turn up with thread ... So can generate c++ code for the DSP blocks designed in labview ... if yes how and if not why . Any
    sincere help will be appreciated . And I very much apologise for any mistakes in my question .
    Thanks

    Tonph wrote:
    Thanks rolf, is it possible that i use labview to disign my DSP block only and the output be fed to my custom c++ blocks and also wxwidget GUI ... suggest some means thanks ...
    Well, have you followed the link I gave in my post? You can download an evaluation version of the add-on and try it out in LabVIEW. It generates C code, not C++, but that should be no problem, since it is very easy to call C code from a C++ application. I can't vouch for the suitability of this add-on for you, nor do I know the exact price range so that are certainly things you have to do for your own.
    As to nathans solution, that could work too. If your application is for Windows, or MacOS X, or Linux you can create a shared library from your LabVIEW code and call it as such from your C++ application.
    Personally I would find it a rather roundabout way to include LabVIEW generated code in a wxWidget application. One of the strengths of LabVIEW is not only signal acquisition and analysis but also simple GUI design, at least as long as you are after a functional GUI, and not a very specific style of a GUI. So I would never even consider to do the GUI part with anything but LabVIEW if some other parts are already to be done in LabVIEW.
    Rolf Kalbermatter
    CIT Engineering Netherlands
    a division of Test & Measurement Solutions

  • ImageIcon Exception when I generate code from netbeans 5

    Hi,
    I want to execute my application from jCreator.I use NetBeans 5 and all seem to be good. When I am trying to run it in jCreator(it is being compiled successfully) but I am getting an Exception :
    Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException
    at javax.swing.ImageIcon.<init><ImageIcon.java:138>
    at project.init.initComponents<init.java:58>
    Can anyone help me with this?

    Thank you warnerja.
    This was the problem.Specifically I am not passing it as null, but I have insert a *.gif icon and it doesn't accepts that instead of netbeans.Did you know the reason?
    Thank you again!

  • How to use generated code from "Import Web Services" with Cairngorm Framework

    I recently downloaded Flex Builder 3 beta 2 and tried out the
    wizard that lets you import web services. The code that is
    auto-generated makes if fairly straight forward to consume web
    services using the object types defined in the WSDL. No longer does
    the developer need to decode the XML payload! The only problem I am
    having is how does you integrate the auto- generated code with the
    Cairngorm framework? This seems like a huge question for anyone who
    might want to leverage Cairngorm and the auto-generated proxy code
    in the same project (like me).
    Here are the problems that I see so far.
    1) How do you configure the generated service class to work
    with the Cairngorm service locator? The service constructor only
    accepts a “LCDS destination string” which implies that
    you must use Lifecycle data services. Unfortunately, the project I
    am trying to retrofit currently uses a WebService and does not use
    data services. All I really need to do is change the endpoint URL
    (ie from local to a development server). This issue is noted in the
    bug https://bugs.adobe.com/jira/browse/FB-8456. What I think is
    needed is a way to set the endpointURI in the Services.mxml file.
    2) Even if I come up with a hack around #1, I do not receive
    a callback to my IResponder even though I register it immediately
    after the method call. I can register and listener function within
    my business delegate and receive the callback, but my Command
    object, which implements IResponder, does not receive the call back
    even though it is registered. From what I read in the ASDocs it
    should but it doesn’t for me!
    These are the issues I have observed in 3 hours of messing
    with this. I hope this makes sense. I would love to integrate
    auto-generated web service proxies into Cairngorm but I don’t
    see a straight forward way without re-architecting Cairngorm. Has
    any one else run across this issue? If so, do you have any insights
    on how to proceed? Any help is appreciated.

    Since I posted this question, I have abandoned the notion of
    auto-generated web services and embraced the good old FDS concept
    where the RemoteObject meta-tag does all the conversion work for
    me. We are now using the Granite DS package and it is working well
    for us. I would love to consume web services, but it just isn't
    worth the hassle when all you have to do with Granite (and FDS) is
    cast your return objects to the proper object type.
    BTW, since this posting, I have investigated competing Flex
    app frameworks. After my research, I checked out the PureMVC
    framework. Wow!! Cairngorm always left me with an uneasy feeling
    and I guess I am not alone. Apparently, Cliff Hall felt the same
    way. That is why he started the project. I like his approach alot
    more than Cairngorm especially since it includes notifications
    which allow me to broadcast my own app level events independent
    from the AS Event framework. Check out PureMVC. For what it is
    worth, it has my humble endorsement. Cliff was even gracious enough
    to acknowledge the other Adobe Consulting guys for their work. Good
    for you Cliff, I respect that. Check out a better way at
    http://www.puremvc.org/

  • Adding parameters to Netbeans generated code

    I'm new to Netbeans and I'm sure this functionality exists, I just don't know what properties to select...
    I'm using the MigLayout and cannot figure out how to get the .add(Component) to pass additional parameters in the generated code.
    Netbeans Generated Code: jPanel4.add(jButton1);
    Desired Code:  panel.add(comp3, "wrap");
    There are custom code options for "pre-adding" and "post-adding" however that puts code in the lines above/below the .add(component) line. XXX.add(...) can take one - several parameters, how control them in Netbeans? I am finding the Netbeans support documentation to be extremely difficult to search and google usually turns up better results.
    Any suggestions??

    Thanks for the reply...
    Following these instructions,
    Right clicking on Component in the Object Browser
    Selecting Customize Code (edit only edited text on the component)
    I could only edit:
    jPanel4 = new javax.swing.JPanel();
    jRadioButton1.setText("jRadioButton1");
    but not:
    jPanel4.add(jButton1);
    Have a screen capture but don't see a way to attach files...

  • Need Help With NetBeans (Java Studio Enterprise 8)'s code generation

    Hi!
    I am using Java Studio Enterprise 8 with NetBeans 4.1 IDE bundled together with it. When trying to create GUI out from NetBeans Form Designer, I don't like the way it generates the code. When I try to use a JTextField, it uses "Fully Qualifed Class Names" (e.g: javax.swing.JTextField) on the code. How do I set NetBeans not to use it but rather use only the class name and generate import lines on top of the code? Also, how do I set it up that it will generate the variable declarations (which is on the uneditable blue portion of the code) on top rather than the default which is placed at the bottom of the class code body. I have tried tweaking the Options menu of this IDE but haven't got any luck...
    Hope you could help, and thanks in advance!

    To address the location of the var decl codegen section (or any codegen location issues), there is a workaround, admittedly, it is a bit tedious.
    Once the form code is generated, as Kris mentioned, open the class in an external editor so that you can edit the generated code.
    Then cut the entire var declaration section along with the begin/end gen-code markers and paste it to the section of the file you desire.
    When you add more components to your form, the codegen will find this section wherever it is and add to it.
    Alternatively, you could just move the non-protected code around the protected within the NB editor, but you would not be able to rearrange the order of the actual code-genned sections.
    craig

  • Netbeans generated code

    Hi I have casually added an entity manager to the UI and am unable to remove it completely as some reference is still maintained in the generated code.
    (I can find it it in the Declarations View) - thanks

    I am unsure how to proceed.I dunno... but this isn't a java language question... so you'll do probably do better:
    1. search the netbeans FAQ's; and/or
    2. posting on the netbeans forum.
    Some of the locals here get narky whenever anyone posts any even slightly "off topic"... Personally I couldn't give a toss, but I do know (from personal experience) that IDE specific questions don't tend to attract a good response on this forum... And this thread is yet more evidence... I'm the only one who is currently active who is willing to address the problem at all.
    I wish you the best of luck with it... and very merry Yuletide to boot.
    beer++;

  • CUCM 8.6.2 Generating CSRs With Incorrect Country Code

    Hi folks, I'm running CUCM 8.6.2.25900-8 on a single cluster (1x pub, 4x sub). My CA certs for the tomcat service are due to expire shortly so I've generated CSRs for all the servers and submitted them to our provider. All but one of the requests went through with no issues but one failed because the CSR specified a country code of 'US'. We are in the UK and the four other servers all generated CSRs specifying C=GB.
    Examining the current tomcat cert or issuing "show web-security" on the command-line of the server who's CSR failed also show 'C=GB'
    Looking at the 'set web-security' command it appears that I cannot change the country code.
    Why is the server generating CSRs with 'C=US'?
    How do I change this behaviour such that they are generated with 'C=GB' instead?

    Surprisingly, it has made it all the way to 10.5(x) with the same info and the same error...
    I did found a method to change it via root access, and you might not require root access, but I can't tell for sure as I would need to look at exactly what the contents of the file that TAC changes, but apparently it's just the platformConfig.xml that they need to change and reboot.
    If that's the case, using the utils import config using pretty much all the same info, except the country, would end up with the same outcome.
    Again, not 100% sure but theory says that should do the trick, you can run that thru TAC if you open the case and see what they think about it.

  • How can I generate AVI with this code?

    Here is the code which I got
    import java.io.*;
    import java.util.*;
    import java.awt.Dimension;
    import javax.media.*;
    import javax.media.control.*;
    import javax.media.protocol.*;
    import javax.media.protocol.DataSource;
    import javax.media.datasink.*;
    import javax.media.format.VideoFormat;
    * This program takes a list of JPEG image files and convert them into
    * a QuickTime movie.
    public class JpegImagesToMovie implements ControllerListener, DataSinkListener {
    public boolean doIt(int width, int height, int frameRate, Vector inFiles, MediaLocator outML) {
         ImageDataSource ids = new ImageDataSource(width, height, frameRate, inFiles);
         Processor p;
         try {
         System.err.println("- create processor for the image datasource ...");
         p = Manager.createProcessor(ids);
         } catch (Exception e) {
         System.err.println("Yikes! Cannot create a processor from the data source.");
         return false;
         p.addControllerListener(this);
         // Put the Processor into configured state so we can set
         // some processing options on the processor.
         p.configure();
         if (!waitForState(p, p.Configured)) {
         System.err.println("Failed to configure the processor.");
         return false;
         // Set the output content descriptor to QuickTime.
         p.setContentDescriptor(new ContentDescriptor(FileTypeDescriptor.MSVIDEO));
         // Query for the processor for supported formats.
         // Then set it on the processor.
         TrackControl tcs[] = p.getTrackControls();
         Format f[] = tcs[0].getSupportedFormats();
         if (f == null || f.length <= 0) {
         System.err.println("The mux does not support the input format: " + tcs[0].getFormat());
         return false;
         tcs[0].setFormat(f[0]);
         System.err.println("Setting the track format to: " + f[0]);
         // We are done with programming the processor. Let's just
         // realize it.
         p.realize();
         if (!waitForState(p, p.Realized)) {
         System.err.println("Failed to realize the processor.");
         return false;
         // Now, we'll need to create a DataSink.
         DataSink dsink;
         if ((dsink = createDataSink(p, outML)) == null) {
         System.err.println("Failed to create a DataSink for the given output MediaLocator: " + outML);
         return false;
         dsink.addDataSinkListener(this);
         fileDone = false;
         System.err.println("start processing...");
         // OK, we can now start the actual transcoding.
         try {
         p.start();
         dsink.start();
         } catch (IOException e) {
         System.err.println("IO error during processing");
         return false;
         // Wait for EndOfStream event.
         waitForFileDone();
         // Cleanup.
         try {
         dsink.close();
         } catch (Exception e) {}
         p.removeControllerListener(this);
         System.err.println("...done processing.");
         return true;
    * Create the DataSink.
    DataSink createDataSink(Processor p, MediaLocator outML) {
         DataSource ds;
         if ((ds = p.getDataOutput()) == null) {
         System.err.println("Something is really wrong: the processor does not have an output DataSource");
         return null;
         DataSink dsink;
         try {
         System.err.println("- create DataSink for: " + outML);
         dsink = Manager.createDataSink(ds, outML);
         dsink.open();
         } catch (Exception e) {
         System.err.println("Cannot create the DataSink: " + e);
         return null;
         return dsink;
    Object waitSync = new Object();
    boolean stateTransitionOK = true;
    * Block until the processor has transitioned to the given state.
    * Return false if the transition failed.
    boolean waitForState(Processor p, int state) {
         synchronized (waitSync) {
         try {
              while (p.getState() < state && stateTransitionOK)
              waitSync.wait();
         } catch (Exception e) {}
         return stateTransitionOK;
    * Controller Listener.
    public void controllerUpdate(ControllerEvent evt) {
         if (evt instanceof ConfigureCompleteEvent ||
         evt instanceof RealizeCompleteEvent ||
         evt instanceof PrefetchCompleteEvent) {
         synchronized (waitSync) {
              stateTransitionOK = true;
              waitSync.notifyAll();
         } else if (evt instanceof ResourceUnavailableEvent) {
         synchronized (waitSync) {
              stateTransitionOK = false;
              waitSync.notifyAll();
         } else if (evt instanceof EndOfMediaEvent) {
         evt.getSourceController().stop();
         evt.getSourceController().close();
    Object waitFileSync = new Object();
    boolean fileDone = false;
    boolean fileSuccess = true;
    * Block until file writing is done.
    boolean waitForFileDone() {
         synchronized (waitFileSync) {
         try {
              while (!fileDone)
              waitFileSync.wait();
         } catch (Exception e) {}
         return fileSuccess;
    * Event handler for the file writer.
    public void dataSinkUpdate(DataSinkEvent evt) {
         if (evt instanceof EndOfStreamEvent) {
         synchronized (waitFileSync) {
              fileDone = true;
              waitFileSync.notifyAll();
         } else if (evt instanceof DataSinkErrorEvent) {
         synchronized (waitFileSync) {
              fileDone = true;
              fileSuccess = false;
              waitFileSync.notifyAll();
    public static void main(String args[]) {
         if (args.length == 0)
         prUsage();
         // Parse the arguments.
         int i = 0;
         int width = -1, height = -1, frameRate = 1;
         Vector inputFiles = new Vector();
         String outputURL = null;
         while (i < args.length) {
         if (args.equals("-w")) {
              i++;
              if (i >= args.length)
              prUsage();
              width = new Integer(args[i]).intValue();
         } else if (args[i].equals("-h")) {
              i++;
              if (i >= args.length)
              prUsage();
              height = new Integer(args[i]).intValue();
         } else if (args[i].equals("-f")) {
              i++;
              if (i >= args.length)
              prUsage();
              frameRate = new Integer(args[i]).intValue();
         } else if (args[i].equals("-o")) {
              i++;
              if (i >= args.length)
              prUsage();
              outputURL = args[i];
         } else {
              inputFiles.addElement(args[i]);
         i++;
         if (outputURL == null || inputFiles.size() == 0)
         prUsage();
         // Check for output file extension.
         if (!outputURL.endsWith(".avi") && !outputURL.endsWith(".AVI")) {
         System.err.println("The output file extension should end with a .avi extension");
         prUsage();
         if (width < 0 || height < 0) {
         System.err.println("Please specify the correct image size.");
         prUsage();
         // Check the frame rate.
         if (frameRate < 1)
         frameRate = 1;
         // Generate the output media locators.
         MediaLocator oml;
         if ((oml = createMediaLocator(outputURL)) == null) {
         System.err.println("Cannot build media locator from: " + outputURL);
         System.exit(0);
         JpegImagesToMovie imageToMovie = new JpegImagesToMovie();
         imageToMovie.doIt(width, height, frameRate, inputFiles, oml);
         System.exit(0);
    static void prUsage() {
         System.err.println("Usage: java JpegImagesToMovie -w <width> -h <height> -f <frame rate> -o <output URL> <input JPEG file 1> <input JPEG file 2> ...");
         System.exit(-1);
    * Create a media locator from the given string.
    static MediaLocator createMediaLocator(String url) {
         MediaLocator ml;
         if (url.indexOf(":") > 0 && (ml = new MediaLocator(url)) != null)
         return ml;
         if (url.startsWith(File.separator)) {
         if ((ml = new MediaLocator("file:" + url)) != null)
              return ml;
         } else {
         String file = "file:" + System.getProperty("user.dir") + File.separator + url;
         if ((ml = new MediaLocator(file)) != null)
              return ml;
         return null;
    // Inner classes.
    * A DataSource to read from a list of JPEG image files and
    * turn that into a stream of JMF buffers.
    * The DataSource is not seekable or positionable.
    class ImageDataSource extends PullBufferDataSource {
         ImageSourceStream streams[];
         ImageDataSource(int width, int height, int frameRate, Vector images) {
         streams = new ImageSourceStream[1];
         streams[0] = new ImageSourceStream(width, height, frameRate, images);
         public void setLocator(MediaLocator source) {
         public MediaLocator getLocator() {
         return null;
         * Content type is of RAW since we are sending buffers of video
         * frames without a container format.
         public String getContentType() {
         return ContentDescriptor.RAW;
         public void connect() {
         public void disconnect() {
         public void start() {
         public void stop() {
         * Return the ImageSourceStreams.
         public PullBufferStream[] getStreams() {
         return streams;
         * We could have derived the duration from the number of
         * frames and frame rate. But for the purpose of this program,
         * it's not necessary.
         public Time getDuration() {
         return DURATION_UNKNOWN;
         public Object[] getControls() {
         return new Object[0];
         public Object getControl(String type) {
         return null;
    * The source stream to go along with ImageDataSource.
    class ImageSourceStream implements PullBufferStream {
         Vector images;
         int width, height;
         VideoFormat format;
         int nextImage = 0;     // index of the next image to be read.
         boolean ended = false;
         public ImageSourceStream(int width, int height, int frameRate, Vector images) {
         this.width = width;
         this.height = height;
         this.images = images;
         format = new VideoFormat(VideoFormat.JPEG,
                        new Dimension(width, height),
                        Format.NOT_SPECIFIED,
                        Format.byteArray,
                        (float)frameRate);
         * We should never need to block assuming data are read from files.
         public boolean willReadBlock() {
         return false;
         * This is called from the Processor to read a frame worth
         * of video data.
         public void read(Buffer buf) throws IOException {
         // Check if we've finished all the frames.
         if (nextImage >= images.size()) {
              // We are done. Set EndOfMedia.
              System.err.println("Done reading all images.");
              buf.setEOM(true);
              buf.setOffset(0);
              buf.setLength(0);
              ended = true;
              return;
         String imageFile = (String)images.elementAt(nextImage);
         nextImage++;
         System.err.println(" - reading image file: " + imageFile);
         // Open a random access file for the next image.
         RandomAccessFile raFile;
         raFile = new RandomAccessFile(imageFile, "r");
         byte data[] = null;
         // Check the input buffer type & size.
         if (buf.getData() instanceof byte[])
              data = (byte[])buf.getData();
         // Check to see the given buffer is big enough for the frame.
         if (data == null || data.length < raFile.length()) {
              data = new byte[(int)raFile.length()];
              buf.setData(data);
         // Read the entire JPEG image from the file.
         raFile.readFully(data, 0, (int)raFile.length());
         System.err.println(" read " + raFile.length() + " bytes.");
         buf.setOffset(0);
         buf.setLength((int)raFile.length());
         buf.setFormat(format);
         buf.setFlags(buf.getFlags() | buf.FLAG_KEY_FRAME);
         // Close the random access file.
         raFile.close();
         * Return the format of each video frame. That will be JPEG.
         public Format getFormat() {
         return format;
         public ContentDescriptor getContentDescriptor() {
         return new ContentDescriptor(ContentDescriptor.RAW);
         public long getContentLength() {
         return 0;
         public boolean endOfStream() {
         return ended;
         public Object[] getControls() {
         return new Object[0];
         public Object getControl(String type) {
         return null;
    when I execute this file then no error comes but the output file do not get played on any player?
    where is the error?

    here is the code with QUICKTIME
    * @(#)JpegImagesToMovie.java     1.3 01/03/13
    * Copyright (c) 1999-2001 Sun Microsystems, Inc. All Rights Reserved.
    * Sun grants you ("Licensee") a non-exclusive, royalty free, license to use,
    * modify and redistribute this software in source and binary code form,
    * provided that i) this copyright notice and license appear on all copies of
    * the software; and ii) Licensee does not utilize the software in a manner
    * which is disparaging to Sun.
    * This software is provided "AS IS," without a warranty of any kind. ALL
    * EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND WARRANTIES, INCLUDING ANY
    * IMPLIED WARRANTY OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE OR
    * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN AND ITS LICENSORS SHALL NOT BE
    * LIABLE FOR ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING
    * OR DISTRIBUTING THE SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL SUN OR ITS
    * LICENSORS BE LIABLE FOR ANY LOST REVENUE, PROFIT OR DATA, OR FOR DIRECT,
    * INDIRECT, SPECIAL, CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER
    * CAUSED AND REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF
    * OR INABILITY TO USE SOFTWARE, EVEN IF SUN HAS BEEN ADVISED OF THE
    * POSSIBILITY OF SUCH DAMAGES.
    * This software is not designed or intended for use in on-line control of
    * aircraft, air traffic, aircraft navigation or aircraft communications; or in
    * the design, construction, operation or maintenance of any nuclear
    * facility. Licensee represents and warrants that it will not use or
    * redistribute the Software for such purposes.
    import java.io.*;
    import java.util.*;
    import java.awt.Dimension;
    import javax.media.*;
    import javax.media.control.*;
    import javax.media.protocol.*;
    import javax.media.protocol.DataSource;
    import javax.media.datasink.*;
    import javax.media.format.VideoFormat;
    * This program takes a list of JPEG image files and convert them into
    * a QuickTime movie.
    public class JpegImagesToMovie implements ControllerListener, DataSinkListener {
        public boolean doIt(int width, int height, int frameRate, Vector inFiles, MediaLocator outML) {
         ImageDataSource ids = new ImageDataSource(width, height, frameRate, inFiles);
         Processor p;
         try {
             System.err.println("- create processor for the image datasource ...");
             p = Manager.createProcessor(ids);
         } catch (Exception e) {
             System.err.println("Yikes!  Cannot create a processor from the data source.");
             return false;
         p.addControllerListener(this);
         // Put the Processor into configured state so we can set
         // some processing options on the processor.
         p.configure();
         if (!waitForState(p, p.Configured)) {
             System.err.println("Failed to configure the processor.");
             return false;
         // Set the output content descriptor to QuickTime.
         p.setContentDescriptor(new ContentDescriptor(FileTypeDescriptor.QUICKTIME));
         // Query for the processor for supported formats.
         // Then set it on the processor.
         TrackControl tcs[] = p.getTrackControls();
         Format f[] = tcs[0].getSupportedFormats();
         if (f == null || f.length <= 0) {
             System.err.println("The mux does not support the input format: " + tcs[0].getFormat());
             return false;
         tcs[0].setFormat(f[0]);
         System.err.println("Setting the track format to: " + f[0]);
         // We are done with programming the processor.  Let's just
         // realize it.
         p.realize();
         if (!waitForState(p, p.Realized)) {
             System.err.println("Failed to realize the processor.");
             return false;
         // Now, we'll need to create a DataSink.
         DataSink dsink;
         if ((dsink = createDataSink(p, outML)) == null) {
             System.err.println("Failed to create a DataSink for the given output MediaLocator: " + outML);
             return false;
         dsink.addDataSinkListener(this);
         fileDone = false;
         System.err.println("start processing...");
         // OK, we can now start the actual transcoding.
         try {
             p.start();
             dsink.start();
         } catch (IOException e) {
             System.err.println("IO error during processing");
             return false;
         // Wait for EndOfStream event.
         waitForFileDone();
         // Cleanup.
         try {
             dsink.close();
         } catch (Exception e) {}
         p.removeControllerListener(this);
         System.err.println("...done processing.");
         return true;
         * Create the DataSink.
        DataSink createDataSink(Processor p, MediaLocator outML) {
         DataSource ds;
         if ((ds = p.getDataOutput()) == null) {
             System.err.println("Something is really wrong: the processor does not have an output DataSource");
             return null;
         DataSink dsink;
         try {
             System.err.println("- create DataSink for: " + outML);
             dsink = Manager.createDataSink(ds, outML);
             dsink.open();
         } catch (Exception e) {
             System.err.println("Cannot create the DataSink: " + e);
             return null;
         return dsink;
        Object waitSync = new Object();
        boolean stateTransitionOK = true;
         * Block until the processor has transitioned to the given state.
         * Return false if the transition failed.
        boolean waitForState(Processor p, int state) {
         synchronized (waitSync) {
             try {
              while (p.getState() < state && stateTransitionOK)
                  waitSync.wait();
             } catch (Exception e) {}
         return stateTransitionOK;
         * Controller Listener.
        public void controllerUpdate(ControllerEvent evt) {
         if (evt instanceof ConfigureCompleteEvent ||
             evt instanceof RealizeCompleteEvent ||
             evt instanceof PrefetchCompleteEvent) {
             synchronized (waitSync) {
              stateTransitionOK = true;
              waitSync.notifyAll();
         } else if (evt instanceof ResourceUnavailableEvent) {
             synchronized (waitSync) {
              stateTransitionOK = false;
              waitSync.notifyAll();
         } else if (evt instanceof EndOfMediaEvent) {
             evt.getSourceController().stop();
             evt.getSourceController().close();
        Object waitFileSync = new Object();
        boolean fileDone = false;
        boolean fileSuccess = true;
         * Block until file writing is done.
        boolean waitForFileDone() {
         synchronized (waitFileSync) {
             try {
              while (!fileDone)
                  waitFileSync.wait();
             } catch (Exception e) {}
         return fileSuccess;
         * Event handler for the file writer.
        public void dataSinkUpdate(DataSinkEvent evt) {
         if (evt instanceof EndOfStreamEvent) {
             synchronized (waitFileSync) {
              fileDone = true;
              waitFileSync.notifyAll();
         } else if (evt instanceof DataSinkErrorEvent) {
             synchronized (waitFileSync) {
              fileDone = true;
              fileSuccess = false;
              waitFileSync.notifyAll();
        public static void main(String args[]) {
         if (args.length == 0)
             prUsage();
         // Parse the arguments.
         int i = 0;
         int width = -1, height = -1, frameRate = 1;
         Vector inputFiles = new Vector();
         String outputURL = null;
         while (i < args.length) {
             if (args.equals("-w")) {
              i++;
              if (i >= args.length)
              prUsage();
              width = new Integer(args[i]).intValue();
         } else if (args[i].equals("-h")) {
              i++;
              if (i >= args.length)
              prUsage();
              height = new Integer(args[i]).intValue();
         } else if (args[i].equals("-f")) {
              i++;
              if (i >= args.length)
              prUsage();
              frameRate = new Integer(args[i]).intValue();
         } else if (args[i].equals("-o")) {
              i++;
              if (i >= args.length)
              prUsage();
              outputURL = args[i];
         } else {
              inputFiles.addElement(args[i]);
         i++;
         if (outputURL == null || inputFiles.size() == 0)
         prUsage();
         // Check for output file extension.
         if (!outputURL.endsWith(".mov") && !outputURL.endsWith(".MOV")) {
         System.err.println("The output file extension should end with a .mov extension");
         prUsage();
         if (width < 0 || height < 0) {
         System.err.println("Please specify the correct image size.");
         prUsage();
         // Check the frame rate.
         if (frameRate < 1)
         frameRate = 1;
         // Generate the output media locators.
         MediaLocator oml;
         if ((oml = createMediaLocator(outputURL)) == null) {
         System.err.println("Cannot build media locator from: " + outputURL);
         System.exit(0);
         JpegImagesToMovie imageToMovie = new JpegImagesToMovie();
         imageToMovie.doIt(width, height, frameRate, inputFiles, oml);
         System.exit(0);
    static void prUsage() {
         System.err.println("Usage: java JpegImagesToMovie -w <width> -h <height> -f <frame rate> -o <output URL> <input JPEG file 1> <input JPEG file 2> ...");
         System.exit(-1);
    * Create a media locator from the given string.
    static MediaLocator createMediaLocator(String url) {
         MediaLocator ml;
         if (url.indexOf(":") > 0 && (ml = new MediaLocator(url)) != null)
         return ml;
         if (url.startsWith(File.separator)) {
         if ((ml = new MediaLocator("file:" + url)) != null)
              return ml;
         } else {
         String file = "file:" + System.getProperty("user.dir") + File.separator + url;
         if ((ml = new MediaLocator(file)) != null)
              return ml;
         return null;
    // Inner classes.
    * A DataSource to read from a list of JPEG image files and
    * turn that into a stream of JMF buffers.
    * The DataSource is not seekable or positionable.
    class ImageDataSource extends PullBufferDataSource {
         ImageSourceStream streams[];
         ImageDataSource(int width, int height, int frameRate, Vector images) {
         streams = new ImageSourceStream[1];
         streams[0] = new ImageSourceStream(width, height, frameRate, images);
         public void setLocator(MediaLocator source) {
         public MediaLocator getLocator() {
         return null;
         * Content type is of RAW since we are sending buffers of video
         * frames without a container format.
         public String getContentType() {
         return ContentDescriptor.RAW;
         public void connect() {
         public void disconnect() {
         public void start() {
         public void stop() {
         * Return the ImageSourceStreams.
         public PullBufferStream[] getStreams() {
         return streams;
         * We could have derived the duration from the number of
         * frames and frame rate. But for the purpose of this program,
         * it's not necessary.
         public Time getDuration() {
         return DURATION_UNKNOWN;
         public Object[] getControls() {
         return new Object[0];
         public Object getControl(String type) {
         return null;
    * The source stream to go along with ImageDataSource.
    class ImageSourceStream implements PullBufferStream {
         Vector images;
         int width, height;
         VideoFormat format;
         int nextImage = 0;     // index of the next image to be read.
         boolean ended = false;
         public ImageSourceStream(int width, int height, int frameRate, Vector images) {
         this.width = width;
         this.height = height;
         this.images = images;
         format = new VideoFormat(VideoFormat.JPEG,
                        new Dimension(width, height),
                        Format.NOT_SPECIFIED,
                        Format.byteArray,
                        (float)frameRate);
         * We should never need to block assuming data are read from files.
         public boolean willReadBlock() {
         return false;
         * This is called from the Processor to read a frame worth
         * of video data.
         public void read(Buffer buf) throws IOException {
         // Check if we've finished all the frames.
         if (nextImage >= images.size()) {
              // We are done. Set EndOfMedia.
              System.err.println("Done reading all images.");
              buf.setEOM(true);
              buf.setOffset(0);
              buf.setLength(0);
              ended = true;
              return;
         String imageFile = (String)images.elementAt(nextImage);
         nextImage++;
         System.err.println(" - reading image file: " + imageFile);
         // Open a random access file for the next image.
         RandomAccessFile raFile;
         raFile = new RandomAccessFile(imageFile, "r");
         byte data[] = null;
         // Check the input buffer type & size.
         if (buf.getData() instanceof byte[])
              data = (byte[])buf.getData();
         // Check to see the given buffer is big enough for the frame.
         if (data == null || data.length < raFile.length()) {
              data = new byte[(int)raFile.length()];
              buf.setData(data);
         // Read the entire JPEG image from the file.
         raFile.readFully(data, 0, (int)raFile.length());
         System.err.println(" read " + raFile.length() + " bytes.");
         buf.setOffset(0);
         buf.setLength((int)raFile.length());
         buf.setFormat(format);
         buf.setFlags(buf.getFlags() | buf.FLAG_KEY_FRAME);
         // Close the random access file.
         raFile.close();
         * Return the format of each video frame. That will be JPEG.
         public Format getFormat() {
         return format;
         public ContentDescriptor getContentDescriptor() {
         return new ContentDescriptor(ContentDescriptor.RAW);
         public long getContentLength() {
         return 0;
         public boolean endOfStream() {
         return ended;
         public Object[] getControls() {
         return new Object[0];
         public Object getControl(String type) {
         return null;
    and here is the output
    C:\>java JpegImagesToMovie -w 1024 -h 768 -f 1 -o out.mov file:/c:/images/5.jpg file:/c:/images/6.jp
    g
    - create processor for the image datasource ...
    Setting the track format to: JPEG
    - create DataSink for: file:C:\\out.mov
    start processing...
    - reading image file: file:/c:/images/5.jpg
    - reading image file: file:/c:/images/6.jpg
    Done reading all images.
    Exception in thread "JMF thread: SendEventQueue: com.sun.media.processor.unknown.Handler" java.lang.
    NullPointerException
    at com.sun.media.multiplexer.video.QuicktimeMux.writeVideoSampleDescription(QuicktimeMux.jav
    a:936)
    at com.sun.media.multiplexer.video.QuicktimeMux.writeSTSD(QuicktimeMux.java:925)
    at com.sun.media.multiplexer.video.QuicktimeMux.writeSTBL(QuicktimeMux.java:905)
    at com.sun.media.multiplexer.video.QuicktimeMux.writeMINF(QuicktimeMux.java:806)
    at com.sun.media.multiplexer.video.QuicktimeMux.writeMDIA(QuicktimeMux.java:727)
    at com.sun.media.multiplexer.video.QuicktimeMux.writeTRAK(QuicktimeMux.java:644)
    at com.sun.media.multiplexer.video.QuicktimeMux.writeMOOV(QuicktimeMux.java:582)
    at com.sun.media.multiplexer.video.QuicktimeMux.writeFooter(QuicktimeMux.java:519)
    at com.sun.media.multiplexer.BasicMux.close(BasicMux.java:142)
    at com.sun.media.BasicMuxModule.doClose(BasicMuxModule.java:172)
    at com.sun.media.PlaybackEngine.doClose(PlaybackEngine.java:872)
    at com.sun.media.BasicController.close(BasicController.java:261)
    at com.sun.media.BasicPlayer.doClose(BasicPlayer.java:229)
    at com.sun.media.BasicController.close(BasicController.java:261)
    at JpegImagesToMovie.controllerUpdate(JpegImagesToMovie.java:196)
    at com.sun.media.BasicController.dispatchEvent(BasicController.java:1254)
    at com.sun.media.SendEventQueue.processEvent(BasicController.java:1286)
    at com.sun.media.util.ThreadedEventQueue.dispatchEvents(ThreadedEventQueue.java:65)
    at com.sun.media.util.ThreadedEventQueue.run(ThreadedEventQueue.java:92)

  • Need help with flashvars in cs5.5 html generated code

    how could use flashvars in cs5.5 html generated code, there are tutorial in net about flashvars but its all cs4 with javascript in it while cs5.5 html code doesn't have. here is the code for non-IE generated by cs5.5
    <!--[if !IE]>-->
    <object type="application/x-shockwave-flash" data="sample.swf" width="800" height="800">
    <param name="movie" value="sample.swf" />
    <param name="quality" value="high" />
    <param name="bgcolor" value="#000000" />
    <param name="play" value="true" />
    <param name="loop" value="true" />
    <param name="wmode" value="window" />
    <param name="scale" value="showall" />
    <param name="menu" value="true" />
    <param name="devicefont" value="false" />
    <param name="salign" value="" />
    <param name="allowScriptAccess" value="sameDomain" />
    <!--<![endif]-->
    <a href="http://www.adobe.com/go/getflash">
    <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.gif" alt="Get Adobe Flash player" />
    </a>
    <!--[if !IE]>-->
    how can I put flashvars in html and as3?

    <!--[if !IE]>-->
    <object type="application/x-shockwave-flash" data="sample.swf" width="800" height="800">
    <param name="movie" value="sample.swf" />
    <param name="quality" value="high" />
    <param name="bgcolor" value="#000000" />
    <param name="play" value="true" />
    <param name="loop" value="true" />
    <param name="wmode" value="window" />
    <param name="scale" value="showall" />
    <param name="menu" value="true" />
    <param name="devicefont" value="false" />
    <param name="salign" value="" />
    <PARAM NAME=FlashVars VALUE="imageFilename=images%2Fimage1%2Ejpg">
    <param name="allowScriptAccess" value="sameDomain" />
    <!--<![endif]-->
    <a href="http://www.adobe.com/go/getflash">
    <img src="http://www.adobe.com/images/shared/download_buttons/get_flash_player.g if" alt="Get Adobe Flash player" />
    </a>
    <!--[if !IE]>-->
    and you can read via flash AS3:
    http://www.permadi.com/tutorial/flashVars/indexAs3.html

  • Generating Bar-code with barcode no.

    Hi Experts,
              my requirement is to generate bar-code for data from certain fields like material no,batch no, expiry date etc. Well i am
              able to generate the bar-code with the help of smart style but i am not getting any no below the generated bar-code as
              bar-code no. As i have come across that there are basically 2 types of bar-code no. 1) UPC   and   2) EAN
              Please help me in generation of bar-code with its no below (either in UPC   or   EAN )  type.
    Thanks.
    Praveen Kumar.

    Hi, Praveen,
    I am more a barcode expart than SAP expert.  Here is a link to an article that may be helpful:
    [Printing barcodes from SAP|http://www.makebarcode.com/info/appnote/app_024.html]
    You mentioned using UPC-A or EAN-13.  I recommend that you do not use these symbologies for general-purpose fields like material no,batch no, expiry date etc.  Both of these codes are fixed length, numeric only.  It will be much better if you use a variable-length, alpha-numeric symbol like Code 39 or Code 128.  Code 39 is the easiest to work with; Code 128 requires a little more work to set up your software, but it supports a wider range of characters (lower case, symbols, etc.). 
    Here is a link to a barcode comparison chart.  From there you can find details about these codes.
    [Barcode comparison chart|http://www.makebarcode.com/specs/barcodechart.html]
    Bob

  • Generated consumer code with GWPA

    Hi,
    We are developing an android application using GWPA(The oData toolkit for android).
    Our oData service is modeled with Complex types that their properties are also Complex types. (hierarchy of  complex types).
    When trying to do requests using the generated code, I saw that the parsing is not working for this type of complex types.
    Is anyone familiar with this issue? Is this type of complex types supported by the oData protocol?
    Thanks,
    Ifat.

    You seem to have chosen the wrong space. Moving to SAP NetWeaver Gateway Developer Center.

  • Unlock the machine generated code - NetBeans

    In Netbeans IDE how to unlock the machine generated code.
    i.e:
    if we create a GUI form it automatically put some lines to it.
    IDE Generated Code
    How can i edit those lines???
    ugp

    As long as you continue to use NetBean's editor, it will continue to regenerate the blue code and overwrite your changes.
    Solution 1 - stop using the NB editor to change the code. You will no longer be able to use NB's graphic UI when you use another editor, so you should finalize the layout first.
    Solution 2 - use NB's capabilities that allow you to add custom code to the blue code. Each component's Properties windows shows a Code button at the top, which lists Pre-Creation, Post-creation, Pre-Init, and Post-Init Code entries. Each of these allow you to create code and insert it at the location specified.

Maybe you are looking for

  • Windows 7 slower on Macbook Pro 8,2 vs MacBook 4,1

    So I've owned 2 Apple laptops which have been the only 2 laptops I've ever owned. One is an Early-2008 black MacBook (4,1 I think) and my current laptop which is a Late-2011 MacBook Pro (8,2). After getting my MacBook Pro I gave my parents my old bla

  • What's wrong with my Mac App store.

    It says I have insufficient funds for my purchase for Grand Theft Auto: San Andreas ($14.99). But I have more than enough money to buy it($15.31). What's going on

  • Sequence - cache size ?

    I created my sequence to increment by 1 with a default cache size of 20. This works fine as long as all my entries are done in the same session ( n + 1, n + 1... and so on). However, when I exit/return to my app the new sequence begins like: Last n +

  • The Curious Case of the Cursed User Account

    I'm having a strange problem with a 4.5 year old MacBook Pro recently upgraded to Mavericks.  I recently got a new laptop and I tried a couple programs aimed at cloud- or non-cloud-based syncing between them (box.com and bittorrent sync).  On the old

  • OS 10.8.3 can't connect to Apple TV through Airport

    I have an Apple TV, MacBook Pro, iPad, iPhone all on an Airport WiFi network.  I can control the Airport or use the Airport for Airplay form both my iPhone and my iPad, but cannot from my MacBook Pro.  So, this leads me to think there is a software i