Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

Create a Jar file

Posted on 2007-03-20
6
Medium Priority
?
201 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 600 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 200 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
The top UI technologies you need to be aware of

An important part of the job as a front-end developer is to stay up to date and in contact with new tools, trends and workflows. That’s why you cannot miss this upcoming webinar to explore the latest trends in UI technologies!

 
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

Build and deliver software with DevOps

A digital transformation requires faster time to market, shorter software development lifecycles, and the ability to adapt rapidly to changing customer demands. DevOps provides the solution.

Question has a verified solution.

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

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
How to fix incompatible JVM issue while installing Eclipse While installing Eclipse in windows, got one error like above and unable to proceed with the installation. This video describes how to successfully install Eclipse. How to solve incompa…
Suggested Courses

704 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