|
technobayo (m)
|
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
|
|
|
|
|
|
Ghenghis (m)
|
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 ,
|
|
|
|
|
|
Seun (m)
|
How about a WAR file?
|
|
|
|
|
|
Ghenghis (m)
|
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
|
|
|
|
|
|
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).
|
|
|
|
|
|
candylips (m)
|
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
|
|
|
|
|
|
Ghenghis (m)
|
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  ) 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  Cheers
|
|
|
|
|
|
candylips (m)
|
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
|
|
|
|
|
|
javarules (m)
|
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
|
|
|
|
|
|