Welcome, Guest: Register On Nairaland / LOGIN! / Trending / Recent / New
Stats: 3,143,279 members, 7,780,641 topics. Date: Thursday, 28 March 2024 at 06:20 PM

How Do I Jar A Java File. - Programming - Nairaland

Nairaland Forum / Science/Technology / Programming / How Do I Jar A Java File. (767 Views)

Where Can I Download Free Programming Language Ebook(both In Jar & Pdf Format)? / Im A Java Expert Here To Teach Those Who Wants To Learn. / I Want To Be Developing .jar Aps For Nokia Phones. Where Do I Start?developing .jar Mobile Apps What (2) (3) (4)

(1) (Reply) (Go Down)

How Do I Jar A Java File. by technobayo(m): 1:53pm On Oct 27, 2009
Please, how do i jar a java file in jdk 1.6. Specifically, i've often had problems accessing a database program i wrote after jarring the application. Maybe, that's where the problem lies. hola folks
Re: How Do I Jar A Java File. by Ghenghis(m): 8:21pm On Oct 27, 2009
I'm going to assume you compiled your classes with something like

javac -cp foo.jar -d outputĀ  *.java
where foo.jar is an external library you used

so that the full class directory structure is created in directory output

then for jar :

jar cvf myApp.jar output\*

If the jar is to be run in windows like an executable jar, you might need to create your own manifest file ,
Re: How Do I Jar A Java File. by Seun(m): 10:01pm On Oct 27, 2009
How about a WAR file?
Re: How Do I Jar A Java File. by Ghenghis(m): 10:27am On Oct 28, 2009
A war file can also be created using the same technique however the directory structure must follow that of a standard WAR archive.
i.e WEB-INF, WEB-INF/classes, WEB-INF/lib etc.

Also remember to use myApp.war instead of myApp.jar
Re: How Do I Jar A Java File. by logica(m): 11:00am On Oct 28, 2009
Or you go the dummy way and use an IDE (such as Eclipse). In Eclipse you can create any archive (JAR, WAR, EAR) by exporting the project. Eclipse figures out which type of archive you are trying to create by the type of project (Java Standard Application - JAR, Java Web Application - WAR, Java Enterprise Application - EAR).
Re: How Do I Jar A Java File. by candylips(m): 12:07pm On Oct 30, 2009
or better still automate the whole thing from the command line using Ant or Ivy or Maven. Java has got a lot easier with all these open source tools
Re: How Do I Jar A Java File. by Ghenghis(m): 8:26pm On Oct 30, 2009
candylips:

or better still automate the whole thing from the command line using Ant or Ivy or Maven. Java has got a lot easier with all these open source tools

I love ANT (hate maven) , when the build starts getting complex , with jars scattered all over then you should start thinking ANT (or Maven cry)

but for simple builds with a few jars, nothing beats javac and jar. Knowing both commands has saved me many times at, say, a client's site with only the JDK as a weapon.

I think most people's problem is a lack of understanding of java CLASSPATH, once the JCP gets rid of it finally, maybe we'll have fewer jar or compile issues undecided

Cheers
Re: How Do I Jar A Java File. by candylips(m): 11:34am On Oct 31, 2009
Ghenghis i normaly refer to Maven as Ant Version 2. I hated it initially too but now i can't do without it.

Once u get a handle over it u will see how powerful and easy it is
Re: How Do I Jar A Java File. by javarules(m): 7:49am On Nov 03, 2009
logica:

Or you go the dummy way and use an IDE (such as Eclipse). In Eclipse you can create any archive (JAR, WAR, EAR) by exporting the project. Eclipse figures out which type of archive you are trying to create by the type of project (Java Standard Application - JAR, Java Web Application - WAR, Java Enterprise Application - EAR).
I don't agree with you on this. Using an IDE (especially for Java Developement) is no longer the dummy way, in fact its the smart way. Ask @javalove lol

(1) (Reply)

I Need Help / Please Help To Dowld Text Book / ZF2 Article Explaining The Process

(Go Up)

Sections: politics (1) business autos (1) jobs (1) career education (1) romance computers phones travel sports fashion health
religion celebs tv-movies music-radio literature webmasters programming techmarket

Links: (1) (2) (3) (4) (5) (6) (7) (8) (9) (10)

Nairaland - Copyright © 2005 - 2024 Oluwaseun Osewa. All rights reserved. See How To Advertise. 13
Disclaimer: Every Nairaland member is solely responsible for anything that he/she posts or uploads on Nairaland.