Re: Jar File Not Working.
it is not working? actually its working(just an assumption), running a java program withing an IDE and without it is a different scenario. you just cant see whats going on... a forum mate helped me with that.. i just forget how to run it manually in CMD line to see the error your jar file is encountering, let me look on the forum itself with my previous post. and it might give you the thing that you want.
Re: Jar File Not Working.
Okay, Thank You.
But it is a JFrame By The Way.
Re: Jar File Not Working.
and please clarify the problem, what is it that is NOT WORKING?, how does it not work?, does a window open and it doesnt do what you expect? or when you clicked it nothing really happens?
Re: Jar File Not Working.
Quote:
Originally Posted by
chronoz13
and please clarify the problem, what is it that is NOT WORKING?, how does it not work?, does a window open and it doesnt do what you expect? or when you clicked it nothing really happens?
Nothing at all happens lol, dont know how to explain nothing..
i was expecting my jframe it pop up like before but all it did was nothing?
Re: Jar File Not Working.
lol man, look at this, i hope this help you.. this was my post year ago and Norm a forum mate helped me with it, i solved it by running the jar file outside the IDE itself, and BOOM, i saw tons of Exceptions that i didnt encounter inside the IDE,
http://www.javaprogrammingforums.com...ing-jar-2.html
Re: Jar File Not Working.
i would like to add, for example case sensitivity with external files like images, a small .png is different with an uppercase .PNG when you run it OUTSIDE your IDE, i really dont know why..
you might as well look at the similar threads below your thread posts, scroll down your screen below, you will see similar thread titles, that can enhance your search
Re: Jar File Not Working.
how do i copy whats in my CMD on windows xp. .-.
1 Attachment(s)
Re: Jar File Not Working.
Attachment 932
This is my error. :e
Re: Jar File Not Working.
click on the very top left of the CMD window, you can see CMD options, like edit, copy paste.
Re: Jar File Not Working.
Re: Jar File Not Working.
C:\Documents and Settings\Owner\Desktop\MessageBox\Files>jar cfmv MessageBoxCrea
tor.jar mainClass.txt MessageBoxCreator.class MainClass.class
added manifest
adding: MessageBoxCreator.class(in = 445) (out= 329)(deflated 26%)
adding: MainClass.class(in = 1641) (out= 846)(deflated 48%)
C:\Documents and Settings\Owner\Desktop\MessageBox\Files>java -jar MessageBoxCre
ator.jar
Exception in thread "main" java.lang.NoClassDefFoundError: MainClass$1
at MainClass.<init>(MainClass.java:60)
at MessageBoxCreator.main(MessageBoxCreator.java:6)
Caused by: java.lang.ClassNotFoundException: MainClass$1
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 2 more
Re: Jar File Not Working.
i think i found my problem: Classpath For Java?
Re: Jar File Not Working.
yeah i suppose, the system cant locate your classes properly
Re: Jar File Not Working.
CLASSPATH
C:\Program Files\Java\jdk1.7.0_02\bin
I'm Confused. :[]
Re: Jar File Not Working.
its not about your JDK, your system cannot locate the classes properly that is why you get NoClassDefFoundError, make sure they are set on the correct folder when you run your jar via CMD
Re: Jar File Not Working.
C:\Documents and Settings\Owner\Desktop\MessageBox\Files>java -jar MessageBoxCreator.jar Is Where Its Located?
Re: Jar File Not Working.
Quote:
Originally Posted by
chronoz13
its not about your JDK, your system cannot locate the classes properly that is why you get NoClassDefFoundError, make sure they are set on the correct folder when you run your jar via CMD
I Do Thank you For The Help, I've Followed Several Tuts And Snippets On How To Create Jar Files But I Don't Understand Them, Thanks For Trying I Just Don't Understand.
Re: Jar File Not Working.
np, its a little bit complicated, im not that much of an expert, i can only share what i had once before. sorry if i cant make you resolve your issue, but be positive, its just there :D
Re: Jar File Not Working.
Quote:
Originally Posted by
chronoz13
np, its a little bit complicated, im not that much of an expert, i can only share what i had once before. sorry if i cant make you resolve your issue, but be positive, its just there :D
been trying to make a sharable jar file for a month
time to stop being Positive. :|
Re: Jar File Not Working.
ok let me share the only thing left in my mind, try to re-compile or re-build (clean and build) all, NoClassDefFoundError is being thrown when JVM cant load the class although it can see it(although its not the correct statement to say it),
Re: Jar File Not Working.
Quote:
Originally Posted by
Java Programmer
C:\Documents and Settings\Owner\Desktop\MessageBox\Files>jar cfmv MessageBoxCrea
tor.jar mainClass.txt MessageBoxCreator.class MainClass.class
added manifest
adding: MessageBoxCreator.class(in = 445) (out= 329)(deflated 26%)
adding: MainClass.class(in = 1641) (out= 846)(deflated 48%)
C:\Documents and Settings\Owner\Desktop\MessageBox\Files>java -jar MessageBoxCre
ator.jar
Exception in thread "main" java.lang.NoClassDefFoundError: MainClass$1
at MainClass.<init>(MainClass.java:60)
at MessageBoxCreator.main(MessageBoxCreator.java:6)
Caused by: java.lang.ClassNotFoundException: MainClass$1
at java.net.URLClassLoader$1.run(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 2 more
The error message is saying that it cannot find a class called MainClass$1. And - sure enough! - you didn't add it when you created the jar file.
Try putting all the class files into the jar with:
Code :
C:\Documents and Settings\Owner\Desktop\MessageBox\Files>jar cfmv MessageBoxCreator.jar mainClass.txt *.class
MainClass$1 will be some anonymous inner class within MainClass - a button handler for example. At any rate it will be created when you compile your program and it has to be added to the jar file.
Re: Jar File Not Working.
i hope it solves his problem, now i see myself again, being so dependent on my IDE, i use to forget the things im getting along the road. thanks for that mate, now i have a bunch of tabs in my browser again LOL,
Re: Jar File Not Working.
Quote:
Originally Posted by
pbrockway2
The error message is saying that it cannot find a class called MainClass$1. And - sure enough! - you didn't add it when you created the jar file.
Try putting
all the class files into the jar with:
Code :
C:\Documents and Settings\Owner\Desktop\MessageBox\Files>jar cfmv MessageBoxCreator.jar mainClass.txt *.class
MainClass$1 will be some anonymous inner class within MainClass - a button handler for example. At any rate it will be created when you compile your program and it has to be added to the jar file.
OMG THANK YOU THANK YOU THANK YOU THANK YOU~!!!!!!!
I Thought that was just a random file created by my complier!!!!!
so i kept deleting it <3 THANK YOU SO MUCH!!!
Re: Jar File Not Working.