Solved

Problem with the Classpath in Self Executable jar file

Posted on 2004-03-23
8
368 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
Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

 
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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

After being asked a question last year, I went into one of my moods where I did some research and code just for the fun and learning of it all.  Subsequently, from this journey, I put together this article on "Range Searching Using Visual Basic.NET …
Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
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 …
Viewers learn how to read error messages and identify possible mistakes that could cause hours of frustration. Coding is as much about debugging your code as it is about writing it. Define Error Message: Line Numbers: Type of Error: Break Down…

707 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

16 Experts available now in Live!

Get 1:1 Help Now