Welcome to Dream.In.Code
Become a Java Expert!

Join 150,179 Java Programmers for FREE! Get instant access to thousands of Java experts, tutorials, code snippets, and more! There are 2,144 people online right now. Registration is fast and FREE... Join Now!




creating a directory inside a jar

 
Reply to this topicStart new topic

creating a directory inside a jar

dc333
26 Aug, 2008 - 11:14 PM
Post #1

New D.I.C Head
*

Joined: 19 Aug, 2008
Posts: 12

Hi.

I'm creating a jar file using the following format:

jar cmf existing-manifest jar-file input-file(s)

The input file in my case is the class file, which is set in a certain package. There are two problems:

1. the package is called: my.package.util, meaning it has 3 directories and the class is under the util directory. I want to create the jar so that at the end of the process inside the jar file there'll be the three directories and under util the class file. Now i can get it so that under the jar there's the actual class or that there are a whole lot of directories starting from C:\... and ending with ..\my\package\util\the class file

2. currently i'm having no luck running the jar file (and yes, the manifest has a main-class header), so if anyone got ideas just how to make that happen i'll appreciate it smile.gif

Should mention that everything is being done through another java program in the default package using the runtime.exec() method and not directly through the cmd.

Thanks.
User is offlineProfile CardPM
+Quote Post

pbl
RE: Creating A Directory Inside A Jar
27 Aug, 2008 - 03:06 PM
Post #2

D.I.C Lover
Group Icon

Joined: 6 Mar, 2008
Posts: 3,587



Thanked: 233 times
Dream Kudos: 75
My Contributions
QUOTE(dc333 @ 27 Aug, 2008 - 12:14 AM) *

Hi.

I'm creating a jar file using the following format:

jar cmf existing-manifest jar-file input-file(s)

The input file in my case is the class file, which is set in a certain package. There are two problems:

1. the package is called: my.package.util, meaning it has 3 directories and the class is under the util directory. I want to create the jar so that at the end of the process inside the jar file there'll be the three directories and under util the class file. Now i can get it so that under the jar there's the actual class or that there are a whole lot of directories starting from C:\... and ending with ..\my\package\util\the class file

2. currently i'm having no luck running the jar file (and yes, the manifest has a main-class header), so if anyone got ideas just how to make that happen i'll appreciate it smile.gif

Should mention that everything is being done through another java program in the default package using the runtime.exec() method and not directly through the cmd.

Thanks.


cd to the directory containing the directory my and

jar cmf existing-manifest jar-file my

all the subs and their contents will follow and your manifest can reference my.package.util.mainClass

This post has been edited by pbl: 27 Aug, 2008 - 03:08 PM
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 1/9/09 03:45AM

Be Social

Dream.In.Code RSS Feed Dream.In.Code LinkedIn Group Follow Us On Twitter

Live Java Help!

Java Tutorials

Reference Sheets

Java Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month