Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Page 1 of 2 12 LastLast
Results 1 to 25 of 26

Thread: creating runnable JAR file

  1. #1
    Junior Member
    Join Date
    Dec 2011
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default creating runnable JAR file

    Hellow
    I have some problem with creating runnable JAR file in Eclipse. I made a class which use JMF library and I added this library in Eclipse (Build Path -> Configure Build Path -> Libraries -> Add External JARs -> and I pointed out locations of the required libraries (JMF.jar). When I compile and run my application in Eclipse everything is working properly and my problems start when I want to make a JAR file.

    I was searching in internet and couldn't find the solution of my probleme.

    I create a JAR file following by this steps: Export -> Runnable JAR file. The JAR is created but when I double click on it to opent it there is nothing happens. I tried to run it of the console (java -jar MYJARFILE.jar) and I get the following message:
    Exception in thread "main" java.util.NoSuchElementException
            at java.util.Vector.firstElement(Unknown Source)
            at VideoTransmisja.<init>(VideoTransmisja.java:62)
            at VideoTransmisja.main(VideoTransmisja.java:349)

    It seams to be a problem with using JMF library.



    Next I tried to create by: Export -> JAR file in two ways "generate the manifest file" and "use existing manifest from workspace" and the problem was the same :/

    my manifest file:
    Manifest-Version: 1.0
    Class-Path: jmf.jar
    Main-Class: VideoTransmisja

    Could someone help me please? I was trying to solve this probleme whole day

    I don't know if I correclty create my manifest file and if I could add jar library to creating jar file?


  2. #2
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: creating runnable JAR file

    Quote Originally Posted by olimpicco View Post
    Hellow
    I have some problem with creating runnable JAR file in Eclipse. I made a class which use JMF library and I added this library in Eclipse (Build Path -> Configure Build Path -> Libraries -> Add External JARs -> and I pointed out locations of the required libraries (JMF.jar). When I compile and run my application in Eclipse everything is working properly and my problems start when I want to make a JAR file.

    I was searching in internet and couldn't find the solution of my probleme.

    I create a JAR file following by this steps: Export -> Runnable JAR file. The JAR is created but when I double click on it to opent it there is nothing happens. I tried to run it of the console (java -jar MYJARFILE.jar) and I get the following message:
    Exception in thread "main" java.util.NoSuchElementException
            at java.util.Vector.firstElement(Unknown Source)
            at VideoTransmisja.<init>(VideoTransmisja.java:62)
            at VideoTransmisja.main(VideoTransmisja.java:349)

    It seams to be a problem with using JMF library.



    Next I tried to create by: Export -> JAR file in two ways "generate the manifest file" and "use existing manifest from workspace" and the problem was the same :/

    my manifest file:
    Manifest-Version: 1.0
    Class-Path: jmf.jar
    Main-Class: VideoTransmisja

    Could someone help me please? I was trying to solve this probleme whole day

    I don't know if I correclty create my manifest file and if I could add jar library to creating jar file?
    Did you installed JMF and get the jmf from the installed directory in your project's working directory?
    Also, try using NetBeans, (as i am not aware of eclipse) it will auto create your jar file.

  3. #3
    Junior Member
    Join Date
    Dec 2011
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: creating runnable JAR file

    Quote Originally Posted by Mr.777 View Post
    Did you installed JMF and get the jmf from the installed directory in your project's working directory?
    Also, try using NetBeans, (as i am not aware of eclipse) it will auto create your jar file.
    yes, I installed JMF and get jmf.jar
    I have tried in NetBeans as you recomend me but the problem is the same ;/

  4. #4
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: creating runnable JAR file

    Quote Originally Posted by olimpicco View Post
    yes, I installed JMF and get jmf.jar
    I have tried in NetBeans as you recomend me but the problem is the same ;/
    Are you really serious???? :-0

  5. #5
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: creating runnable JAR file

    Exception in thread "main" java.util.NoSuchElementException
    at java.util.Vector.firstElement(Unknown Source)
    at VideoTransmisja.<init>(VideoTransmisja.java:62)
    at VideoTransmisja.main(VideoTransmisja.java:349)
    What is the code doing at line 62? Why does it get the exception there?

    The Vector appears to be empty when the code calls the firstElement() method.

  6. #6
    Junior Member
    Join Date
    Dec 2011
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: creating runnable JAR file

    Quote Originally Posted by Mr.777 View Post
    Are you really serious???? :-0
    yes

    Quote Originally Posted by Norm View Post
    What is the code doing at line 62? Why does it get the exception there?

    The Vector appears to be empty when the code calls the firstElement() method.
    My code:
    Vector listaKamer = CaptureDeviceManager.getDeviceList(new VideoFormat(null));
    CaptureDeviceInfo kamera = (CaptureDeviceInfo) listaKamer.firstElement();
    MediaLocator lokalizacjaKam = kamera.getLocator();
    the error is because listaKamer han't got any elements. It is because that code doesn't work: CaptureDeviceManager.getDeviceList(new VideoFormat(null)) - its function from JMF.jar

    but when I run this program in eclipse it work properly. I don't know why this happen :/

  7. #7
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: creating runnable JAR file

    What is different when you move away from the IDE to execute from the jar?

  8. #8
    Junior Member
    Join Date
    Dec 2011
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: creating runnable JAR file

    Quote Originally Posted by Norm View Post
    What is different when you move away from the IDE to execute from the jar?
    when I execute my program from the jar I got the problem which I described in first post:

    Exception in thread "main" java.util.NoSuchElementException
            at java.util.Vector.firstElement(Unknown Source)
            at VideoTransmisja.<init>(VideoTransmisja.java:62)
            at VideoTransmisja.main(VideoTransmisja.java:349)

    executing from the IDE everything is OK and program work as I want.

  9. #9
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: creating runnable JAR file

    What is different when you move away from the IDE to execute from the jar?
    My question is about the environment: classpath, files, folders, etc
    NOT about the results of attempting the execution.
    Something is different that causes the program in the jar to fail. What is it???

  10. #10
    Junior Member
    Join Date
    Dec 2011
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: creating runnable JAR file

    I don't know if I understand you.

    Eclipse Project:
    src->(default packages)->VideoTransmit.java
    JRE System Library -> all jar files from java folder: C:\Program Files\Java\jre6\lib
    Referenced Libraries -> D:\Programy\JMF 2.1.1e\lib\jmf.jar

    The classpath, files folders depend on method which I use to create JAR file. I present you this two:
    1) Runnable JAR file -> Package required libraries into generated JAR
    org\eclipse\jdt\internal\jarinjarloader\[some classes]
    META-INF\MANIFEST.MF:
    Manifest-Version: 1.0
    Rsrc-Class-Path: ./ jmf.jar
    Class-Path: .
    Rsrc-Main-Class: VideoTransmit
    Main-Class: org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader
    jmf.jar
    VideoTransmit.class
    VideoTransmit$StateListener.class

    and after running this I get that communicate:
    deviceList.size() = 0
    Exception in thread "main" java.lang.reflect.InvocationTargetException
            at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
            at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
            at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
            at java.lang.reflect.Method.invoke(Unknown Source)
            at org.eclipse.jdt.internal.jarinjarloader.JarRsrcLoader.main(JarRsrcLoa
    der.java:58)
    Caused by: java.util.NoSuchElementException
            at java.util.Vector.firstElement(Unknown Source)
            at VideoTransmit.main(VideoTransmit.java:339)
            ... 5 more



    2) Runnable JAR file -> Copy required libraries into a sub-folder next to the generated JAR
    META-INF\MANIFEST.MF:
    Manifest-Version: 1.0
    Class-Path: . testJAR2_lib/jmf.jar
    Main-Class: VideoTransmit

    VideoTransmit.class
    VideoTransmit$StateListener.class

    after runing there is a communicate:
    deviceList.size() = 0
    Exception in thread "main" java.util.NoSuchElementException
            at java.util.Vector.firstElement(Unknown Source)
            at VideoTransmit.main(VideoTransmit.java:339)

    is that what you asked me?

  11. #11
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: creating runnable JAR file

    The basic question is: Why is the list returned by getDeviceList() empty when the code is executed outside of the IDE? What is different between executing inside and outside of the IDE?

  12. #12
    Junior Member
    Join Date
    Dec 2011
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: creating runnable JAR file

    sorry but I don't know how to check it. could you tell me what should i do?

  13. #13
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: creating runnable JAR file

    Sorry, I do not know how your IDE works.

  14. #14
    Junior Member
    Join Date
    Dec 2011
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: creating runnable JAR file

    if you have a webcam or microphone and you find free time could you try to create and run jar file in your computer please. I see that you are much more experienced than me

    the code which I'am using to capture from webcam:
    /*
     * @(#)VideoTransmit.java	1.7 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.awt.*;
    import javax.media.*;
    import javax.media.protocol.*;
    import javax.media.format.*;
    import javax.media.control.TrackControl;
    import javax.media.control.QualityControl;
    import java.io.*;
    import java.net.InetAddress;
    import java.net.UnknownHostException;
    import java.util.Vector;
     
    public class VideoTransmit {
     
        // Input MediaLocator
        // Can be a file or http or capture source
        private MediaLocator locator;
        private String ipAddress;
        private String port;
     
        private Processor processor = null;
        private DataSink  rtptransmitter = null;
        private DataSource dataOutput = null;
     
        public VideoTransmit(MediaLocator locator,
    			 String ipAddress,
    			 String port) {
     
    	this.locator = locator;
    	this.ipAddress = ipAddress;
    	this.port = port;
        }
     
        /**
         * Starts the transmission. Returns null if transmission started ok.
         * Otherwise it returns a string with the reason why the setup failed.
         */
        public synchronized String start() {
    	String result;
     
    	// Create a processor for the specified media locator
    	// and program it to output JPEG/RTP
    	result = createProcessor();
    	if (result != null)
    	    return result;
     
    	// Create an RTP session to transmit the output of the
    	// processor to the specified IP address and port no.
    	result = createTransmitter();
    	if (result != null) {
    	    processor.close();
    	    processor = null;
    	    return result;
    	}
     
    	// Start the transmission
    	processor.start();
     
    	return null;
        }
     
        /**
         * Stops the transmission if already started
         */
        public void stop() {
    	synchronized (this) {
    	    if (processor != null) {
    		processor.stop();
    		processor.close();
    		processor = null;
    		rtptransmitter.close();
    		rtptransmitter = null;
    	    }
    	}
        }
     
        private String createProcessor() {
    	if (locator == null)
    	    return "Locator is null";
     
    	DataSource ds;
    	DataSource clone;
     
    	try {
    	    ds = Manager.createDataSource(locator);
    	} catch (Exception e) {
    	    return "Couldn't create DataSource";
    	}
     
    	// Try to create a processor to handle the input media locator
    	try {
    	    processor = Manager.createProcessor(ds);
    	} catch (NoProcessorException npe) {
    	    return "Couldn't create processor";
    	} catch (IOException ioe) {
    	    return "IOException creating processor";
    	} 
     
    	// Wait for it to configure
    	boolean result = waitForState(processor, Processor.Configured);
    	if (result == false)
    	    return "Couldn't configure processor";
     
    	// Get the tracks from the processor
    	TrackControl [] tracks = processor.getTrackControls();
     
    	// Do we have atleast one track?
    	if (tracks == null || tracks.length < 1)
    	    return "Couldn't find tracks in processor";
     
    	boolean programmed = false;
     
    	// Search through the tracks for a video track
    	for (int i = 0; i < tracks.length; i++) {
    	    Format format = tracks[i].getFormat();
    	    if (  tracks[i].isEnabled() &&
    		  format instanceof VideoFormat &&
    		  !programmed) {
     
    		// Found a video track. Try to program it to output JPEG/RTP
    		// Make sure the sizes are multiple of 8's.
    		Dimension size = ((VideoFormat)format).getSize();
    		float frameRate = ((VideoFormat)format).getFrameRate();
    		int w = (size.width % 8 == 0 ? size.width :
    				(int)(size.width / 8) * 8);
    		int h = (size.height % 8 == 0 ? size.height :
    				(int)(size.height / 8) * 8);
    		VideoFormat jpegFormat = new VideoFormat(VideoFormat.JPEG_RTP,
    							 new Dimension(w, h),
    							 Format.NOT_SPECIFIED,
    							 Format.byteArray,
    							 frameRate);
    		tracks[i].setFormat(jpegFormat);
    		System.err.println("Video transmitted as:");
    		System.err.println("  " + jpegFormat);
    		// Assume succesful
    		programmed = true;
    	    } else
    		tracks[i].setEnabled(false);
    	}
     
    	if (!programmed)
    	    return "Couldn't find video track";
     
    	// Set the output content descriptor to RAW_RTP
    	ContentDescriptor cd = new ContentDescriptor(ContentDescriptor.RAW_RTP);
    	processor.setContentDescriptor(cd);
     
    	// Realize the processor. This will internally create a flow
    	// graph and attempt to create an output datasource for JPEG/RTP
    	// video frames.
    	result = waitForState(processor, Controller.Realized);
    	if (result == false)
    	    return "Couldn't realize processor";
     
    	// Set the JPEG quality to .5.
    	setJPEGQuality(processor, 0.5f);
     
    	// Get the output data source of the processor
    	dataOutput = processor.getDataOutput();
    	return null;
        }
     
        // Creates an RTP transmit data sink. This is the easiest way to create
        // an RTP transmitter. The other way is to use the RTPSessionManager API.
        // Using an RTP session manager gives you more control if you wish to
        // fine tune your transmission and set other parameters.
        private String createTransmitter() {
    	// Create a media locator for the RTP data sink.
    	// For example:
    	//    rtp://129.130.131.132:42050/video
    	String rtpURL = "rtp://" + ipAddress + ":" + port + "/video";
    	MediaLocator outputLocator = new MediaLocator(rtpURL);
     
    	// Create a data sink, open it and start transmission. It will wait
    	// for the processor to start sending data. So we need to start the
    	// output data source of the processor. We also need to start the
    	// processor itself, which is done after this method returns.
    	try {
    	    rtptransmitter = Manager.createDataSink(dataOutput, outputLocator);
    	    rtptransmitter.open();
    	    rtptransmitter.start();
    	    dataOutput.start();
    	} catch (MediaException me) {
    	    return "Couldn't create RTP data sink";
    	} catch (IOException ioe) {
    	    return "Couldn't create RTP data sink";
    	}
     
    	return null;
        }
     
     
        /**
         * Setting the encoding quality to the specified value on the JPEG encoder.
         * 0.5 is a good default.
         */
        void setJPEGQuality(Player p, float val) {
     
    	Control cs[] = p.getControls();
    	QualityControl qc = null;
    	VideoFormat jpegFmt = new VideoFormat(VideoFormat.JPEG);
     
    	// Loop through the controls to find the Quality control for
     	// the JPEG encoder.
    	for (int i = 0; i < cs.length; i++) {
     
    	    if (cs[i] instanceof QualityControl &&
    		cs[i] instanceof Owned) {
    		Object owner = ((Owned)cs[i]).getOwner();
     
    		// Check to see if the owner is a Codec.
    		// Then check for the output format.
    		if (owner instanceof Codec) {
    		    Format fmts[] = ((Codec)owner).getSupportedOutputFormats(null);
    		    for (int j = 0; j < fmts.length; j++) {
    			if (fmts[j].matches(jpegFmt)) {
    			    qc = (QualityControl)cs[i];
    	    		    qc.setQuality(val);
    			    System.err.println("- Setting quality to " + 
    					val + " on " + qc);
    			    break;
    			}
    		    }
    		}
    		if (qc != null)
    		    break;
    	    }
    	}
        }
     
     
        /****************************************************************
         * Convenience methods to handle processor's state changes.
         ****************************************************************/
     
        private Integer stateLock = new Integer(0);
        private boolean failed = false;
     
        Integer getStateLock() {
    	return stateLock;
        }
     
        void setFailed() {
    	failed = true;
        }
     
        private synchronized boolean waitForState(Processor p, int state) {
    	p.addControllerListener(new StateListener());
    	failed = false;
     
    	// Call the required method on the processor
    	if (state == Processor.Configured) {
    	    p.configure();
    	} else if (state == Processor.Realized) {
    	    p.realize();
    	}
     
    	// Wait until we get an event that confirms the
    	// success of the method, or a failure event.
    	// See StateListener inner class
    	while (p.getState() < state && !failed) {
    	    synchronized (getStateLock()) {
    		try {
    		    getStateLock().wait();
    		} catch (InterruptedException ie) {
    		    return false;
    		}
    	    }
    	}
     
    	if (failed)
    	    return false;
    	else
    	    return true;
        }
     
        /****************************************************************
         * Inner Classes
         ****************************************************************/
     
        class StateListener implements ControllerListener {
     
    	public void controllerUpdate(ControllerEvent ce) {
     
    	    // If there was an error during configure or
    	    // realize, the processor will be closed
    	    if (ce instanceof ControllerClosedEvent)
    		setFailed();
     
    	    // All controller events, send a notification
    	    // to the waiting thread in waitForState method.
    	    if (ce instanceof ControllerEvent) {
    		synchronized (getStateLock()) {
    		    getStateLock().notifyAll();
    		}
    	    }
    	}
        }
     
     
        /****************************************************************
         * Sample Usage for VideoTransmit class
         ****************************************************************/
     
        public static void main(String [] args) {
       	 Vector deviceList = CaptureDeviceManager.getDeviceList(new YUVFormat());
       	 System.err.println("deviceList.size() = " + deviceList.size());
     
       	 CaptureDeviceInfo device = (CaptureDeviceInfo) deviceList.firstElement();
       	 MediaLocator ml = device.getLocator();
     
       	 InetAddress thisIp = null;
       	 try {
    			thisIp = InetAddress.getLocalHost();
       	 } catch (UnknownHostException e) {
    			// TODO Auto-generated catch block
    			e.printStackTrace();
       	 }
       	 String ip = thisIp.getHostAddress();
       	 VideoTransmit vt = new VideoTransmit(ml, ip , "8092");
     
       	 // Start the transmission
       	 String result = vt.start();
     
    		 // result will be non-null if there was an error. The return
    		 // value is a String describing the possible error. Print it.
    		 if (result != null) {
    		    System.err.println("Error : " + result);
    		    System.exit(0);
    		 }
     
    		 System.err.println("Start transmission for 60 seconds...");
     
    	// Transmit for 60 seconds and then close the processor
    	// This is a safeguard when using a capture data source
    	// so that the capture device will be properly released
    	// before quitting.
    	// The right thing to do would be to have a GUI with a
    	// "Stop" button that would call stop on VideoTransmit
    	try {
    	    Thread.currentThread().sleep(60000);
    	} catch (InterruptedException ie) {
    	}
     
    	// Stop the transmission
    	vt.stop();
     
    	System.err.println("...transmission ended.");
     
    	System.exit(0);
        }
    }

    the JMF library you could download from here: JMF 2.1.1e Software

  15. #15
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: creating runnable JAR file

    The JMF does an install. Have you read the readme doc and done all it requires?

  16. #16
    Junior Member
    Join Date
    Dec 2011
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: creating runnable JAR file

    yes, but in windows there is nothing to do. setting CLASSPATH to jmf.jar was made automaticlly.

  17. #17
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: creating runnable JAR file

    Whatever, I did not do the install so I won't know what should be done or what will happen.

  18. #18
    Junior Member
    Join Date
    Dec 2011
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: creating runnable JAR file

    I am windows user and after instalation I got changed CLASSPATH .;d:\programy\JMF21~1.1E\lib\sound.jar;d:\programy \JMF21~1.1E\lib\jmf.jar;d:\programy\JMF21~1.1E\lib ;D:\Programy\JMF 2.1.1e\lib; D:\Programy\JMF 2.1.1e\bin

  19. #19
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: creating runnable JAR file

    Why Put a bin folder on the classpath?

  20. #20
    Junior Member
    Join Date
    Dec 2011
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: creating runnable JAR file

    I don't know it was made automaticly

  21. #21
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: creating runnable JAR file

    Quote Originally Posted by olimpicco View Post
    I don't know it was made automaticly
    I worked on a JMF project and it created the jar file successfully as well as executed it too. I don't know what is your environment or why doesn't it find cam on jar execution.

  22. #22
    Junior Member
    Join Date
    Dec 2011
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: creating runnable JAR file

    nice, could you tell me what is your IDE and how you create the jar file please?

  23. #23
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: creating runnable JAR file

    I used NetBeans IDEA at that time and it auto generated jar file in the project directory in a folder named "dist"

  24. #24
    Junior Member
    Join Date
    Dec 2011
    Posts
    14
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: creating runnable JAR file

    I created new project in NetBeans and auto generated jar file. When I executed it I got the same problem as the jar file which I generated in Eclipse.

    deviceList.size() = 0
    Exception in thread "main" java.util.NoSuchElementException
            at java.util.Vector.firstElement(Unknown Source)
            at VideoTransmit.main(VideoTransmit.java:340)

    So it means that I adding the JMF library wrong. Could you tell me how you add this library in NetBeans:

    I'm doing this as follows:
    right click on Library folder -> Add JAR/Folder... -> and then indicating the path to the jmf.jar file

    I must doing something wrong

  25. #25
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: creating runnable JAR file

    I'm doing this as follows:
    right click on Library folder -> Add JAR/Folder... -> and then indicating the path to the jmf.jar file
    From where do you importing this jar file? Make sure that you import it from the installed directory of JMF on your OS.

Page 1 of 2 12 LastLast

Similar Threads

  1. Creating JAR file in eclipse HELP !
    By Maheshkh in forum Java IDEs
    Replies: 3
    Last Post: September 16th, 2011, 12:37 PM
  2. Image location on a Runnable JAR file?
    By DarrenReeder in forum What's Wrong With My Code?
    Replies: 3
    Last Post: March 11th, 2010, 07:59 AM
  3. Problem in Creating Jar file
    By sikriyogesh in forum Member Introductions
    Replies: 0
    Last Post: November 20th, 2009, 02:12 AM
  4. Creating a class file
    By ipatch in forum What's Wrong With My Code?
    Replies: 2
    Last Post: November 8th, 2009, 07:19 PM