473,666 Members | 2,071 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How do I tell "jar" to include within a jar everything that a given applet or application requires?

I have gotten to the point where attempting to run my application using
"java -jar HotSpotImageTes t.jar" no longer generates a complaint about not
finding function main. It turned out that the problem was that there was a
package statement as the first line of the code generated by Borland's
JBuilder IDE. Yes, I used JBuidler's form designer to create it. I don't
normally worry about adding "package" to code I write, and didn't much care
as long as it worked. But as it turns out, it meant that I had to run "jar"
in the parent directory of the directory having the same name as the package
and the latter directory had to be the root directory to which all paths in
the project are relative.

The project now runs up to the point where the one object instantiating a
class in Borland's library that I used is used. At this point, it complains
about not finding the class. I know the proximate cause of this is related
to the classpath, and the short term fix is to specify one, but this is not
an adequate solution as I can't expect all users, or in fact any of them, to
install JBuilder, let alone install it to the same place I did.

The only option I see, to support deployment, is to package the bytecode for
everything my application uses (including swing, in case any user might have
a machine with an older version of Java that doesn't support swing. But,
HOW DO I DO THIS? And, assuming I CAN do this, how do I tell if it is using
the copy of swing embedded in the jar rather than that in the SDK directory
tree?

Thanks,

Ted
Jul 17 '05 #1
1 2551
Ted Byers wrote:

The project now runs up to the point where the one object instantiating a
class in Borland's library that I used is used. At this point, it complains
about not finding the class. I know the proximate cause of this is related
to the classpath, and the short term fix is to specify one, but this is not
an adequate solution as I can't expect all users, or in fact any of them, to
install JBuilder, let alone install it to the same place I did.

The only option I see, to support deployment, is to package the bytecode for
everything my application uses (including swing, in case any user might have
a machine with an older version of Java that doesn't support swing. But,
HOW DO I DO THIS? And, assuming I CAN do this, how do I tell if it is using
the copy of swing embedded in the jar rather than that in the SDK directory
tree?


Ted,

You have a couple of options. First, you should verify that the Borland
libraries are redistributable without cost.

You could package everything together in one jar file, but another
technique is preferred. In the MANIFEST.MF file, you can add a
Class-Path entry. The Class-Path entry contains the CLASSPATH of your
application. Each piece of the CLASSPATH should be separated by a
space. The pieces are interpreted as relative to the directory
containing the jar file. So if Borland gives you borland.jar you can
put the jars in the same directory and have:

Class-Path: borland.jar

in your MANIFEST.MF.
Now, you also mentioned packaging swing. I wouldn't recommend it.
First, it is very large. Second, if the JVM you are running on does not
already have swing it probably doesn't have a lot of new stuff from
later versions of Java. Stuff that you might also be using.... The
best bet is to determine the lowest version of Java your stuff compiles
and runs on and force your users to have at least that version. You can
check the version with System.getPrope rties() (see the javadoc).

Ray


Jul 17 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2355
by: lvcha.gouqizi | last post by:
I embed an applet in my php script which has a parameter providing an input file for the jar. Does this file has size limit? The code is as follows: <APPLET ARCHIVE="myapplet.jar" WIDTH=372 HEIGHT=360 VSPACE=0 HSPACE=0 ALIGN=middle> <?php echo "<PARAM NAME=\"data\" VALUE=\"myfile.\">";?> when "myfile" is beyond 15M, my applet cannot load sucessfully, but
0
2265
by: Murat Tasan | last post by:
I have an application that works perfectly... and at one point loads a class that is in a jar file listed in my $CLASSPATH. If I jar the application and create the appropriate manifest to run it, it starts working fine until it gets to the spot where it loads the class (Class.forName()), and then it gives me a ClassNotFound exception. My $CLASSPATH has not been altered between the 2 scenarios. Do I have to include classpath...
0
1089
by: Michael | last post by:
After trying to load my java applet from <OBJECT> tag (rather than <APPLET> tag), it renders fine, except when you click between the DESIGN view then back to HTML view, the <PARAM NAME="ARCHIVE" VALUE="jars/myapp.jar"> line completely vanishes. Click to HTML view again, and the applet just does not load or work (as would be expected!). Re-add the vanishing line and all is well again.
13
4796
by: Larry Menard | last post by:
Test code: $dbconn = odbc_connect($dbname, $username, $password); $path = "C:\Temp\myJar.jar"; $statement = "CALL SQLJ.INSTALL_JAR('file://$path', 'myJarId')"; $result = odbc_exec($dbconn, $statement); Result: PHP Warning: odbc_exec(): SQL error: CLI0119E Unexpected system failure.
1
2038
by: arnold | last post by:
Hi, I've been knocking my head against the wall trying to create an XSL transform to perform "normalizations" of a set of XML files that have a common structure. % XML file before transform
11
2722
by: jobs239 | last post by:
Can I use this line inside C program "system(java -jar <jarfilename>)" to run a java program from C? Or do I have to use some JNI interface.?
1
6477
by: laredotornado | last post by:
Hi, I'm using PHP 4.4.4 on Apache 2 on Fedora Core 5. PHP was installed using Apache's apxs and the php library was installed to /usr/local/php. However, when I set my "error_reporting" setting to be "E_ALL", notices are still not getting reported. The perms on my file are 664, with owner root and group root. The php.ini file is located at /usr/local/lib/php/php.ini. Any ideas why the setting does not seem to be having an effect? ...
6
32052
by: nrperry | last post by:
Hello, I have a question about this error: Exception in thread "main" java.lang.StringIndexOutOfBoundsException: String index out of range: -2 I am doing my java development in IBM Rationale eclipse. I am compiling and running everything just fine. When I try to run my application on a commandline I get this error. I don't know why this is happening since it is working perfectly in eclipse. I am running a .bat file and here is the...
1
2270
by: isra123 | last post by:
Dear All, Hope every one is feeling good, and happy new year . Can any one help me on this? I built an Alfreasco code and it works on eclipse, now on eclipse I made in the "main class" username and password (desktop application) and when I send the username and password it returns true , but on web Application when I take tha Jar file and use JSF code on netbeans and then enter the username and password it gives me an error like this: ...
0
8876
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8784
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8556
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8642
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7387
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6198
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4198
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4371
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1777
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.