Solved

.exe / jar files - for application distribution

Posted on 2001-06-27
10
246 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
Problems using Powershell and Active Directory?

Managing Active Directory does not always have to be complicated.  If you are spending more time trying instead of doing, then it's time to look at something else. For nearly 20 years, AD admins around the world have used one tool for day-to-day AD management: Hyena. Discover why

 
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
 
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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
eclipse shortcuts 9 55
eclipse apache tomcat admin console 52 97
Java exception bubble up 2 18
Java string replace 11 48
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)
Introduction Java can be integrated with native programs using an interface called JNI(Java Native Interface). Native programs are programs which can directly run on the processor. JNI is simply a naming and calling convention so that the JVM (Java…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.

809 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