my program includes pictures and audio, do i have add that to my project and then create a jar file? or i just have to include the source file and that's it?

Recommended Answers

All 8 Replies

You may need to add classpath parameter for the jar file when you compile.

What exactly do I put there? The path of my main class?
Btw my entire program is in one class with multiple private classes inside. Would affect the fact that my jar file is not running?

normally not. it just makes it a hell of a lot harder to maintain (if you are interreseted in that)

yeah i was thinking that i was going to put the different classes into its own file, but i've been lazy..

ok so i converted my program to an applet and it runs perfectly. i am still unable to get the jar file running. does anybody have any clue or hint??

dunno ... we can't say very much without seeing your code and environment settings, now can we?

my code is kind of long, so i erased a ton of stuff, but some are self-explanatory.

import javax.swing.*;
import javax.swing.event.*;
import java.util.*;
import java.io.*;
import java.awt.image.BufferedImage;
import javax.imageio.*;
import java.applet.*;

public class WorkingTitle extends JFrame{

	public WorkingTitle(){
		super("Working Title");
		setSize(550,429);
		setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
		loadPictures();//load all pictures
		loadSounds();//load all sounds
		
		ps = new PaintScreen();//extends jpanel
		add(ps);
		
		start1 = new MovePlayer();//player movements
		start1.start();	
		start2 = new MoveBoat();//boat movements
		
		setVisible(true);
		
		addKeyListener(new ButtonListener());
		
	}
	
	private class PaintScreen extends JPanel{
		public void paintComponent(Graphics g){	
			super.paintComponent(g);
			//paint stuff
	}
	
	private class MoveBoat extends Thread{
		public void run(){
			while(true){
				try{
					repaint();
					Thread.sleep(40);
				}
				catch(Exception e){
					break;
				}
			}
			
		}
	}
	
	private class MovePlayer extends Thread{
		public void run(){
			while(true){
				try{
					repaint();
					Thread.sleep(40);
				}
				catch(Exception e){
					break;
				}
			}
			
		}
	}

	private class ButtonListener implements KeyListener{
			public void keyPressed(KeyEvent e){
				//key listener code 
			}
	}
	
	public static void main (String [] args)
	{
		WorkingTitle wt = new WorkingTitle();
	}


}

ok, and what is in your meta-inf folder (manifest.mf file, to be exact) and your environment settings?

Manifest-Version: 1.0
Main-Class: WorkingTitle

and what do you mean by environment settings?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.