Solved

.exe / jar files - for application distribution

Posted on 2001-06-27
10
238 Views
Last Modified: 2013-11-23
hi lads/lassies,

I'd like to distribute a java app on a virgin machine and want to do as little setup as possible.
I think my two main options are .exe or jar...

What is the story with JAR files and will they save me copying all of my packages information across to the new machine and also save me configuring the classpath etc?

Would an exe be the answer to my prayers?
thanks!
0
Comment
Question by:dubliner
  • 3
  • 3
  • 2
  • +1
10 Comments
 
LVL 16

Expert Comment

by:Valeri
ID: 6230744
Yes, .jar is more suitable. It contains all of your packages and s.o. Use it...
Regards,
Valeri Kronin
0
 

Author Comment

by:dubliner
ID: 6230799
How do I use the jar once I have zipped up all my stuff in it?
Do I have to un-jar the class files first into a directory or something?
0
 
LVL 16

Expert Comment

by:Valeri
ID: 6230911
I'm using JBuilder / Deployment Wizard....

To place .jar file is the same to have directory structure of the packages. I think that you can build the zip by this directory using WinZip as well...
0
 
LVL 1

Expert Comment

by:wgilster
ID: 6232203
No just run the classes straight from the .jar.  Make sure the .jar is in your classpath and run the class with the fully qualified package name.

java package1.fred.MyClass

you can specify the classpath on the command line as well if you don't want to modify the environment classpath.
0
 
LVL 1

Expert Comment

by:wgilster
ID: 6232218
specify the classpath by doing this...


java -cp JarfileThatHoldsMyPackage.jar
0
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 1

Accepted Solution

by:
wgilster earned 150 total points
ID: 6232233
Now putting it all together...

java -cp JarfileThatHoldsMyPackage.jar package1.fred.MyClass

or

java -classpath JarfileThatHoldsMyPackage.jar package1.fred.MyClass


That should do it...

0
 
LVL 1

Expert Comment

by:sumeetsh
ID: 6264232
hi
you could do the following

1> Create a jar file consisting of your application
that could be done using
Syntax
=======
>jar cvmf manifist_filename jar_file name input_files
 
Your app.mf file could consist of following attributes:
=========================================================
Main-Class: main_class_name
Class-Path: swingall.jar classes102.zip
=========================================================
-This would set main class for your jar and classpath for the application
swingll.jar and classes102.zip r in same DIR as your jar file.

2>After Creating JAR file for your application you could
create an installable for you application
3> Nope u dont need to unjar youe files
can invoke your application by :-
>java -jar yourapp.jar

This would invoke your Main Class set in main class attribute of our mannifist file.

Regards
Sumeet




3>






0
 

Author Comment

by:dubliner
ID: 6276212
Thanks for the above but I'm still getting a couple of problems when I run the jar...

I've located another jar file which contains javax.comm stuff and I need to include this too.  How do I do this?
My directory structure is:

d:\work - general working directory
d:\work\packages - general classes and stuff
d:\java\comm - contains the bloody jar file

The class I need to run initially is in the 'work' directory and the stuff to include is in the 'work/packages' and 'java/com' directories.

Thanks!
0
 
LVL 1

Expert Comment

by:sumeetsh
ID: 6276224
hi
For that what u could do is to include the path for othe jar file in the manifist file i told u about lats time
this should work
0
 

Author Comment

by:dubliner
ID: 6337221
Thanks lads!
jamie
0

Featured Post

Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

Join & Write a Comment

For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
For customizing the look of your lightweight component and making it look lucid like it was made of glass. Or: how to make your component more Apple-ish ;) This tip assumes your component to be of rectangular shape and completely opaque. (COD…
The viewer will learn how to implement Singleton Design Pattern in Java.
This video teaches viewers about errors in exception handling.

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

12 Experts available now in Live!

Get 1:1 Help Now