Home » Eclipse Projects » Standard Widget Toolkit (SWT) » Distributing as an Executable JAR File
Distributing as an Executable JAR File [message #446883] |
Sun, 05 December 2004 03:42 |
Daniel Spiewak Messages: 263 Registered: July 2009 |
Senior Member |
|
|
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html;charset=ISO-8859-1" http-equiv="Content-Type">
<title></title>
</head>
<body bgcolor="#ffffff" text="#000000">
<font face="serif">I have an application that I wish to distribute for
all major platforms (Mac, Windows, GTK, Motif, probably FOX) as one
single executable JAR file. I want this file to be runnable on my Mac
and then I network the single file over and run it again on my Fedora
box <i>with no modifications.</i> I want all the dependencies
contained within the JAR file. And, just to make life fun, I'd also
like to keep the JAR file's size down. :-) Any thoughts?<br>
<br>
My idea originally was to simply use the java.util.jar API to
decompress all the dependencies on first run and then refer to them
using the JAR classpath and by dynamically setting the
java.library.path system property. However, because of the way that
class loaders work, the setting of the library path didn't actually get
set in the ClassLoader. Thus, the Display class (and all other classes
for that matter) got loaded without the proper library path. Thus, it
didn't run. So I dug out my javadoc and wrote some code which uses
JNDI to start a new JVM instance with the proper library path set.
This works great, believe it or not. It starts fast, and has limited
memory usage. The problem (a rather embarrassing one) is that I can't
seem to package it as an executable JAR file. I've used the JAR
command, file-roller, nothing works. Basically, the JVM isn't finding
the classes in the JAR when I try to run it using the java -jar
command. It works if I use java -cp Application.jar
com.mycomp.app.MainClass Any thoughts on that?<br>
<br>
I read somewhere that Azureus (<a class="moz-txt-link-freetext" href="http://azureus.sourceforge.net">http://azureus.sourceforge.net</a>) is
packaged as a single JAR file. How do they do it? Am I completely out
of my mind? Can this be done at all?<br>
<br>
Daniel<br>
</font>
</body>
</html>
|
|
| | |
Re: Distributing as an Executable JAR File [message #446933 is a reply to message #446883] |
Mon, 06 December 2004 16:25 |
Radu Messages: 44 Registered: July 2009 |
Member |
|
|
take a look at
http://fjep.sourceforge.net/
regards.
Daniel Spiewak wrote:
> I have an application that I wish to distribute for all major platforms
> (Mac, Windows, GTK, Motif, probably FOX) as one single executable JAR
> file. I want this file to be runnable on my Mac and then I network the
> single file over and run it again on my Fedora box /with no
> modifications./ I want all the dependencies contained within the JAR
> file. And, just to make life fun, I'd also like to keep the JAR file's
> size down. :-) Any thoughts?
>
> My idea originally was to simply use the java.util.jar API to decompress
> all the dependencies on first run and then refer to them using the JAR
> classpath and by dynamically setting the java.library.path system
> property. However, because of the way that class loaders work, the
> setting of the library path didn't actually get set in the ClassLoader.
> Thus, the Display class (and all other classes for that matter) got
> loaded without the proper library path. Thus, it didn't run. So I dug
> out my javadoc and wrote some code which uses JNDI to start a new JVM
> instance with the proper library path set. This works great, believe it
> or not. It starts fast, and has limited memory usage. The problem (a
> rather embarrassing one) is that I can't seem to package it as an
> executable JAR file. I've used the JAR command, file-roller, nothing
> works. Basically, the JVM isn't finding the classes in the JAR when I
> try to run it using the java -jar command. It works if I use java -cp
> Application.jar com.mycomp.app.MainClass Any thoughts on that?
>
> I read somewhere that Azureus (http://azureus.sourceforge.net) is
> packaged as a single JAR file. How do they do it? Am I completely out
> of my mind? Can this be done at all?
>
> Daniel
|
|
|
Re: Distributing as an Executable JAR File [message #446947 is a reply to message #446933] |
Mon, 06 December 2004 23:46 |
Daniel Spiewak Messages: 263 Registered: July 2009 |
Senior Member |
|
|
Will that include native libraries and separate distributions of the
same Java API for different platforms dynamically selected? I'm
familiar with the plugin, in fact, it was a major inspiration for my
solution to the problem. I just can't figure out why the java command
won't recognize the classes in my JAR files.
Daniel
Radu Racariu wrote:
> take a look at
> http://fjep.sourceforge.net/
>
>
> regards.
>
>
> Daniel Spiewak wrote:
>
>> I have an application that I wish to distribute for all major
>> platforms (Mac, Windows, GTK, Motif, probably FOX) as one single
>> executable JAR file. I want this file to be runnable on my Mac and
>> then I network the single file over and run it again on my Fedora box
>> /with no modifications./ I want all the dependencies contained
>> within the JAR file. And, just to make life fun, I'd also like to
>> keep the JAR file's size down. :-) Any thoughts?
>>
>> My idea originally was to simply use the java.util.jar API to
>> decompress all the dependencies on first run and then refer to them
>> using the JAR classpath and by dynamically setting the
>> java.library.path system property. However, because of the way that
>> class loaders work, the setting of the library path didn't actually
>> get set in the ClassLoader. Thus, the Display class (and all other
>> classes for that matter) got loaded without the proper library path.
>> Thus, it didn't run. So I dug out my javadoc and wrote some code
>> which uses JNDI to start a new JVM instance with the proper library
>> path set. This works great, believe it or not. It starts fast, and
>> has limited memory usage. The problem (a rather embarrassing one) is
>> that I can't seem to package it as an executable JAR file. I've used
>> the JAR command, file-roller, nothing works. Basically, the JVM
>> isn't finding the classes in the JAR when I try to run it using the
>> java -jar command. It works if I use java -cp Application.jar
>> com.mycomp.app.MainClass Any thoughts on that?
>>
>> I read somewhere that Azureus (http://azureus.sourceforge.net) is
>> packaged as a single JAR file. How do they do it? Am I completely
>> out of my mind? Can this be done at all?
>>
>> Daniel
>
|
|
|
Goto Forum:
Current Time: Sat Apr 27 03:24:51 GMT 2024
Powered by FUDForum. Page generated in 0.02723 seconds
|