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.

Results 1 to 5 of 5

Thread: I cant export my applet into a runnable jar file

  1. #1
    Junior Member
    Join Date
    Feb 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default I cant export my applet into a runnable jar file

    import java.applet.Applet;
    import java.awt.Color;
    import java.awt.Graphics;
    import java.awt.Image;
     
    public class StartingPoints extends Applet implements Runnable {
     
    	/**
    	 * 
    	 */
    	private static final long serialVersionUID = 1L;
    	private Image i;
    	private Graphics doubleG;
     
    	Ball b, b2, b3, b4;
     
    	@Override
    	public void init() {
    		setSize(800, 600);
    		setBackground(Color.black);
     
    	}
     
    	@Override
    	public void start() {
    		b4 = new Ball(Color.RED);
    		b3 = new Ball(Color.BLUE);
    		b = new Ball();
    		b2 = new Ball(250, 250);
    		Thread thread = new Thread(this);
    		thread.start();
     
    	}
     
    	@Override
    	public void run() {
    		// TODO Auto-generated method stub
    		// thread information
    		while (true) {
    			b4.update(this);
    			b3.update(this);
    			b.update(this);
    			b2.update(this);
    			repaint();
    			try {
    				Thread.sleep(17);
    			} catch (InterruptedException e) {
    				// TODO Auto-generated catch block
    				e.printStackTrace();
    			}
    		}
    	}
     
    	@Override
    	public void stop() {
     
    	}
     
    	@Override
    	public void destroy() {
     
    	}
     
    	@Override
    	public void update(Graphics g) {
    		if (i == null) {
    			i = createImage(this.getSize().width, this.getSize().height);
    			doubleG = i.getGraphics();
    		}
    		doubleG.setColor(getBackground());
    		doubleG.fillRect(0, 0, this.getSize().width, this.getSize().height);
     
    		doubleG.setColor(getForeground());
    		paint(doubleG);
     
    		g.drawImage(i, 0, 0, this);
    	}
     
    	@Override
    	public void paint(Graphics g) {
    		b.paint(g);
    		b2.paint(g);
    		b3.paint(g);
    		b4.paint(g);
     
    	}
     
    }


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: I cant export my applet into a runnable jar file

    How are you trying to execute the Applet? They normally execute in a browser within an html page.
    If you don't understand my answer, don't ignore it, ask a question.

  3. #3
    Junior Member
    Join Date
    Feb 2013
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: I cant export my applet into a runnable jar file

    I wanna have an exe file on desktop and run it

  4. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,042
    Thanks
    63
    Thanked 2,708 Times in 2,658 Posts

    Default Re: I cant export my applet into a runnable jar file

    Applets run in a browser. If you want a desktop app, rewrite the code to not require a browser.

    I don't know anything about creating an exe file.
    If you don't understand my answer, don't ignore it, ask a question.

  5. #5
    Junior Member
    Join Date
    Feb 2013
    Location
    Finland
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: I cant export my applet into a runnable jar file

    I fyou want create Desktop application you should use JFrame and here is the code how you can run it on web browser

    <html>
    <body>
    <applet code="nameofclassfile.class" width="whateveryouwant" height="whateveryouwant">
    </applet>
    </body>
    </html>

    and save as whaterveryouwant.html

    --- Update ---

    I kinda fixed it, but if you wanted more balls in there i didn't add them but i added moving
    heres the link for download:

    https://dl.dropbox.com/u/95019436/StartingPoint.java

Similar Threads

  1. Need help to export .jar file
    By piulitza in forum AWT / Java Swing
    Replies: 4
    Last Post: June 8th, 2012, 11:34 AM
  2. Exporting Runnable JAR File
    By cr80expert5 in forum Object Oriented Programming
    Replies: 3
    Last Post: January 26th, 2012, 09:35 PM
  3. creating runnable JAR file
    By olimpicco in forum Java IDEs
    Replies: 25
    Last Post: January 11th, 2012, 09:15 AM
  4. Replies: 10
    Last Post: January 12th, 2011, 05:48 AM
  5. 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

Tags for this Thread