Solved

Create a Jar file

Posted on 2007-03-20
6
192 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
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:Mayank S
ID: 18774803
0

Featured Post

Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

INTRODUCTION Working with files is a moderately common task in Java.  For most projects hard coding the file names, using parameters in configuration files, or using command-line arguments is sufficient.   However, when your application has vi…
Introduction This article is the second of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers the basic installation and configuration of the test automation tools used by…
Viewers learn about the third conditional statement “else if” and use it in an example program. Then additional information about conditional statements is provided, covering the topic thoroughly. Viewers learn about the third conditional statement …
Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
Suggested Courses

710 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