33 Replies - 1594 Views - Last Post: 05 March 2012 - 09:42 PM
#1
Jar file error: could not find main class.
Posted 01 March 2012 - 04:11 PM
And so I decided to run it in cmd to see what's the problem:
<code>
C:\Users\user>java -jar "C:\Users\user\Documents\NetBeansProjects\PictureSliderG
ame\dist\PictureSliderGame.jar"
Exception in thread "main" java.lang.NoClassDefFoundError: pictureslidergame/Pic
tureSliderGame
Caused by: java.lang.ClassNotFoundException: pictureslidergame.PictureSliderGame
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: pictureslidergame.PictureSliderGame. Program will
exit.</code>
could somebody please explain to me where I gone wrong? thanks in advance.
Replies To: Jar file error: could not find main class.
#2
Re: Jar file error: could not find main class.
Posted 01 March 2012 - 04:30 PM
#3
Re: Jar file error: could not find main class.
Posted 01 March 2012 - 04:35 PM
g00se, on 01 March 2012 - 04:30 PM, said:
here's what I got when I build the project:
init:
deps-clean:
Updating property file: C:\Users\user\Documents\NetBeansProjects\PictureSliderGame\build\built-clean.properties
Deleting directory C:\Users\user\Documents\NetBeansProjects\PictureSliderGame\build
clean:
init:
deps-jar:
Created dir: C:\Users\user\Documents\NetBeansProjects\PictureSliderGame\build
Updating property file: C:\Users\user\Documents\NetBeansProjects\PictureSliderGame\build\built-jar.properties
Created dir: C:\Users\user\Documents\NetBeansProjects\PictureSliderGame\build\classes
Created dir: C:\Users\user\Documents\NetBeansProjects\PictureSliderGame\build\empty
Created dir: C:\Users\user\Documents\NetBeansProjects\PictureSliderGame\build\generated-sources\ap-source-output
Compiling 9 source files to C:\Users\user\Documents\NetBeansProjects\PictureSliderGame\build\classes
Copying 52 files to C:\Users\user\Documents\NetBeansProjects\PictureSliderGame\build\classes
compile:
Created dir: C:\Users\user\Documents\NetBeansProjects\PictureSliderGame\dist
Copying 1 file to C:\Users\user\Documents\NetBeansProjects\PictureSliderGame\build
Nothing to copy.
Building jar: C:\Users\user\Documents\NetBeansProjects\PictureSliderGame\dist\PictureSliderGame.jar
To run this application from the command line without Ant, try:
java -jar "C:\Users\user\Documents\NetBeansProjects\PictureSliderGame\dist\PictureSliderGame.jar"
jar:
BUILD SUCCESSFUL (total time: 2 seconds)
I'm not sure if it's a successful one..
#4
Re: Jar file error: could not find main class.
Posted 01 March 2012 - 04:58 PM
Quote
java -jar "C:\Users\user\Documents\NetBeansProjects\PictureSliderGame\dist\PictureSliderGame.jar"
#5
Re: Jar file error: could not find main class.
Posted 01 March 2012 - 05:02 PM
g00se, on 01 March 2012 - 04:58 PM, said:
Quote
java -jar "C:\Users\user\Documents\NetBeansProjects\PictureSliderGame\dist\PictureSliderGame.jar"
Yes sir I've tried to run it in command prompt to see then i got these errors:
C:\Users\user>java -jar "C:\Users\user\Documents\NetBeansProjects\PictureSliderG
ame\dist\PictureSliderGame.jar"
Exception in thread "main" java.lang.NoClassDefFoundError: pictureslidergame/Pic
tureSliderGame
Caused by: java.lang.ClassNotFoundException: pictureslidergame.PictureSliderGame
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
Could not find the main class: pictureslidergame.PictureSliderGame. Program will
exit.
#6
Re: Jar file error: could not find main class.
Posted 01 March 2012 - 05:10 PM
jar cfM PictureSliderGame.zip -C C:\Users\user\Documents\NetBeansProjects PictureSliderGame
This post has been edited by g00se: 01 March 2012 - 05:11 PM
#7
Re: Jar file error: could not find main class.
Posted 01 March 2012 - 10:28 PM
g00se, on 01 March 2012 - 05:10 PM, said:
jar cfM PictureSliderGame.zip -C C:\Users\user\Documents\NetBeansProjects PictureSliderGame
I tried it sir and it prompted options...sir what do you mean by attach the PictureSliderGame.zip file?
#8
Re: Jar file error: could not find main class.
Posted 02 March 2012 - 02:41 AM
Quote
That's strange - there should be little or no output
Quote
That file is created by the command i gave you
#9
Re: Jar file error: could not find main class.
Posted 03 March 2012 - 04:33 AM
g00se, on 02 March 2012 - 02:41 AM, said:
Quote
That's strange - there should be little or no output
Quote
That file is created by the command i gave you
I tried it already sir but it didn't produce a zip file.. instead, could i email you the rar file that i made so maybe you could check it...
g00se, on 02 March 2012 - 02:41 AM, said:
Quote
That's strange - there should be little or no output
Quote
That file is created by the command i gave you
I tried it already sir but it didn't produce a zip file.. instead, could i email you the rar file that i made so maybe you could check it?
#10
Re: Jar file error: could not find main class.
Posted 03 March 2012 - 06:08 AM
#11
Re: Jar file error: could not find main class.
Posted 03 March 2012 - 08:50 PM
#12
Re: Jar file error: could not find main class.
Posted 04 March 2012 - 03:59 AM
#13
Re: Jar file error: could not find main class.
Posted 04 March 2012 - 09:27 PM
#14
Re: Jar file error: could not find main class.
Posted 04 March 2012 - 09:50 PM
They might have pecky reaction based on the ast main() run
put that one in you Favorites
http://docs.oracle.c...asicsindex.html
and use it !!!
#15
Re: Jar file error: could not find main class.
Posted 04 March 2012 - 10:01 PM
kimuchii7, on 04 March 2012 - 09:27 PM, said:
here sir, you can download the package:
http://www.mediafire...p619pypd5t3trxb
|
|

New Topic/Question
Reply




MultiQuote



|