Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

gapboy9m

[java] making executible jar

This topic is 5264 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

ok... i am trying to make my jcreator project an executible jar file....this is what i have done so far... 1. created new folder called "s" inside it i have placed all my .class files and my .txt files.....i have also created a manfest.mf file n that folder, i cretthe file using wordpad and it includes: " Manifest-Version: 1.0 Main-Class: Main Created-By: 1.3.0 (Sun Microsystems Inc.) " (without the quotes of corse) (main is the name of my .class file with the main method) ok then outside the folder i created a .bat file which contains: " jar cmf Manifest.mf App.jar s/Main.class s/FileRead.class s/Person.class s/Quiz.class s/Employee.class s/employer.class " (app.jar is the name of the .jar i want created)(the name of the .class file r the names of my .class files) now when i double click the .bat file it SHOULD create a .jar file named app.jar, right? well instead the command promt says that "jar is not a reconigized internal or external command" what does that mean? how do i fix it? PLEASE HELP!!!!!!!

Share this post


Link to post
Share on other sites
Advertisement
Find the program "jar" and add its path to %PATH%.

Your problem has absolutely nothing to do with Java and everything to do with DOS.

Share this post


Link to post
Share on other sites
what/where is program "jar"?
and what/where is %path%?

www.markphelan.com

[edited by - gapboy9m on June 8, 2004 10:20:14 PM]

Share this post


Link to post
Share on other sites
the jar is in your "jdk/bin" folder. and %Path% is refering to the Environment Variables Path property.

Add your jdk/bin ( complete folder path ) into the Path Variable under your system environmental variables property.

[ Windows user ]
go to control panel --> system --> Advanced --> Environmental Variables (at the bottom) --> scroll down the bottom section to the PATH property, and add your JDK/BIN directory into here ( paths are seperated with semi-colens ; )

hope that helps

Share this post


Link to post
Share on other sites
so i added the path:
"C:\Program Files\s1studio_jdk\j2sdk1.4.1_02\bin"
to the path evnironment varibles thing....
now out of curosity, sorry for being such a newb, i was wondering what exactly that did? what did it solve, and how did u know t was the right solution?

thanks

www.markphelan.com

Share this post


Link to post
Share on other sites
All that did was make it so that whenever anything tries to run the program ''jar'' it knows where to look for it. If the path to jar was not in your PATH variable, then it would only look in whatever directory the command was trying to be executed from. Otherwise, it''s not going to recursively search every directory to look for it for two reasons:

First, it would take way too much time.

Second, there may be multiple executables named ''jar'' and you only want a specific one.

Share this post


Link to post
Share on other sites
thank you soo much, i am now able to create the .jar file but now when i run it, using a .bat file that contains:
java -jar App.jar

i get an error that says:
exception in thread "main" java.lang.noClassDefFoundError: APP\Main (wrong name: Main)

now what do i do?

please help!!
thanks again

www.markphelan.com

Share this post


Link to post
Share on other sites
your app name has to be the same as your class name i believe so next time make your .jar file out of main.class and call it main.jar

Share this post


Link to post
Share on other sites
Quote:
Original post by gapboy9m

thank you soo much, i am now able to create the .jar file but now when i run it, using a .bat file that contains:
java -jar App.jar

i get an error that says:
exception in thread "main" java.lang.noClassDefFoundError: APP\Main (wrong name: Main)

now what do i do?

please help!!
thanks again

www.markphelan.com
check to see if the Main.class file is really at the root of the jar file and not in s/Main.class. And if it is move it out too the root folder....

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!