Solved

Problem with the Classpath in Self Executable jar file

Posted on 2004-03-23
8
373 Views
Last Modified: 2013-11-23
Hi All,
I am facing a problem in my application.
I wanted to create a stand alone application that needs the weblogic.jar in its class path to run
I had created a self executable jar file for this.  
weblogic.jar file is usually located at C:/bea/weblogic81/server/lib/ folder
I created a manifest file as follows

Manifest-Version: 1.0
Main-Class: com.Starter
Class-Path: file:///C:/bea/weblogic81/server/lib/weblogic.jar


and i use the following command to jar it

jar cfm myapplication.jar manifest.mf com/

Manifest file in the jar file is as follows
Manifest-Version: 1.0
Created-By: 1.4.1_02-er (Sun Microsystems Inc.)
Main-Class: com.Starter

and the application fails to work ,
can u please help me in this regard ?
Thanks in advance  :-)
0
Comment
Question by:ajithprabhakar
  • 3
  • 2
8 Comments
 
LVL 92

Expert Comment

by:objects
ID: 10665346
> Class-Path: file:///C:/bea/weblogic81/server/lib/weblogic.jar

this need to include the relative location of jar.
eg. if weblogic.jar is in same directory:

Class-Path: weblogic.jar
0
 

Author Comment

by:ajithprabhakar
ID: 10665604
Then in which way i can set a class path,  Can u please explain how can i set the class path for a stand alone self executable jar file?
0
 
LVL 13

Expert Comment

by:Webstorm
ID: 10665705
Hi ajithprabhakar,

Try to run your application using the following command line:
  java -classpath C:\bea\weblogic81\server\lib\weblogic.jar   -jar myapplication.jar

0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
LVL 92

Expert Comment

by:objects
ID: 10665755
> Then in which way i can set a class path

you need to use the Class-Path as you are, you just need to supply the *relative* location of the jar.
0
 

Author Comment

by:ajithprabhakar
ID: 10665850
hi there,
i am aware that i can use both the ways, but what i want to do is to set a path to a jar file which is not in the same directory , that means i want to give absolute path in my self executable jar file.
But for the relative location the jar to which my class path points should be a part of the new archive that i am creating right ?

0
 
LVL 92

Accepted Solution

by:
objects earned 75 total points
ID: 10665896
> that means i want to give absolute path in my self executable jar file.

you can't.
You'll need to install any required jars as extensions (in the 'ext' directory) if you do not specifiy them using Class-Path:
Or don't use a executable jar of course.

> But for the relative location the jar to which my class path points should be a part of the new archive that i am creating right ?

Not sure what you mean by 'creating'?
It should be pointing to the location of any other jars/directories that are required by the executable jar.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
custom annotations 9 42
object oriented programming comparison 5 77
Way to decrease size of apk file 9 86
JavaFX TableView not displaying correctly 3 57
Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
Video by: Michael
Viewers learn about how to reduce the potential repetitiveness of coding in main by developing methods to perform specific tasks for their program. Additionally, objects are introduced for the purpose of learning how to call methods in Java. Define …

860 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