Solved

Create a Jar file

Posted on 2007-03-20
6
182 Views
Last Modified: 2013-11-23
I have just 2 classes in a package

com.user.Hello1
com.user.Hello2

I want to ship them as a jar file, so that user can put them in his class path and use the class he needs. In each class I am also using a logger (log4j.jar). So I have a log4j.properties file as well which contians the destination directory where the logger should write.

Please tell me
1. How to create a jar of these classes.
2. How should the log4j.properties be shipped, should it be inside the jar or send seperately. If it is inside the jar then user will not be able to chage the destination directory, so creating a properties files will become useless.

Both the classes have a main method, so they'll be run seperately

0
Comment
Question by:ruchie
  • 3
  • 2
6 Comments
 
LVL 12

Accepted Solution

by:
Gibu George earned 150 total points
ID: 18762037
jar -cvf myjar.jar com *.properties, will create the jar file
0
 
LVL 12

Expert Comment

by:Gibu George
ID: 18762041
the log4j.properties can be shipped separately and needs to be in the class path
0
 
LVL 19

Assisted Solution

by:Kuldeepchaturvedi
Kuldeepchaturvedi earned 50 total points
ID: 18762051
use command
jar cvf mypackage.jar -C yourdirectory/.

on the command line... the jar.exe is present in the bin folder of your JDK install directory
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 19

Expert Comment

by:Kuldeepchaturvedi
ID: 18762055
oops sorry Gibu.. I guess while I was typing you posted your comments..
0
 
LVL 12

Expert Comment

by:Gibu George
ID: 18762077
:-)
0
 
LVL 30

Expert Comment

by:mayankeagle
ID: 18774803
0

Featured Post

Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

Join & Write a Comment

Suggested Solutions

Java Flight Recorder and Java Mission Control together create a complete tool chain to continuously collect low level and detailed runtime information enabling after-the-fact incident analysis. Java Flight Recorder is a profiling and event collectio…
In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

11 Experts available now in Live!

Get 1:1 Help Now