• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

jar not working

 
Ranch Hand
Posts: 97
Python VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
When I run this code normally it is fine but when I make it into a jar then it will not respond to the mouse click. It is a very simple Coloring book program.
any help would be appreciated.
[ December 23, 2007: Message edited by: colton peterson ]
 
Ranch Hand
Posts: 219
Firefox Browser Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi,

Perhaps there are some exceptions when you running the jar. Check the classpath maybe. Or maybe can you post the exception messages here?
 
author
Posts: 9050
21
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
let's slide this over to the intermediate forum...
 
colton peterson
Ranch Hand
Posts: 97
Python VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There are no errors or anything it runs and the gui shows but when you click on the picture it does not do anything. I have check and it is including the inner class that has my mouse listener
 
Marshal
Posts: 79178
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What operating System are you using? I have always found executable .jars to work with double-click on Windows�, but on Linux only by writing java -jar MyJar.jar.
Are the associations set up so a .jar is opened by java?
Have you tried another executable .jar to see whether that opens with a double-click?
What have you put as your main-class in the manifest file? Look at the Java Tutorial here, particularly where it says about setting entry point.
 
colton peterson
Ranch Hand
Posts: 97
Python VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using windows xp. When I double click on the jar file it runs. The gui pops up fine and all the buttons work. But when I go to click on part of the picture I am coloring in and it is supposed to fill in the area with that color it does not do anything. It does work when I run it using java at command prompt. I am making this for 3 year olds so I can not just run it from command prompt all the time. If there is a way to make a shortcut that runs a command than that would work to.
 
Hendy Setyo Mulyo
Ranch Hand
Posts: 219
Firefox Browser Java Ubuntu
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
code:

package CustomPaint;

import java.awt.*;
import java.awt.event.*;
import java.awt.image.*;
import javax.swing.*;
import java.io.*;
import king.lib.util.*;

public class CustomPaint{


public static void main(String[] args) {
System.out.println("we're in main");
UniCode start = new UniCode();
start.setUpGui();
}
}


Seems that you are using external library (import king.lib.util.*)
Are you sure when you running your jar, it has a reference to the external library? It could be the problem.
 
Campbell Ritchie
Marshal
Posts: 79178
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hendy Steyo Mulyo is probably correct. Make sure the location of the king jar is in the classpath in your manifest file.
 
colton peterson
Ranch Hand
Posts: 97
Python VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I know this is really late but thank you for helping me. I got the program to work but I found a way to do it without a jar file. Thanks again.
 
Campbell Ritchie
Marshal
Posts: 79178
377
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

Originally posted by colton peterson:
I got the program to work but I found a way to do it without a jar file. Thanks again.



You're welcome.

How did you get it to work?
 
colton peterson
Ranch Hand
Posts: 97
Python VI Editor Linux
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I made a shortcut with the location to javaw.exe in the java directory bin and added my classes full name on the end (E.G. Mypackage.MyPublicclass) then I set the working directory to the top of the class directory. I am sorry if that is confusing, it is probably more easy to just put it in a jar.
reply
    Bookmark Topic Watch Topic
  • New Topic