Solved

Create a Jar file

Posted on 2007-03-20
6
183 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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
bitbucket vs gitbucket 3 57
java.io.BufferedReader   readLine()  //returns the entire file ? 4 60
eclipse argument 14 53
varialbe initialization 11 30
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…
Viewers learn about the “for” loop and how it works in Java. By comparing it to the while loop learned before, viewers can make the transition easily. You will learn about the formatting of the for loop as we write a program that prints even numbers…
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…

895 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

15 Experts available now in Live!

Get 1:1 Help Now