aspose file tools*
The moose likes Java in General and the fly likes Defining  batch files with classpath variables Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Java 8 in Action this week in the Java 8 forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "Defining  batch files with classpath variables" Watch "Defining  batch files with classpath variables" New topic
Author

Defining batch files with classpath variables

ramya narayanan
Ranch Hand

Joined: Oct 06, 2008
Posts: 338
Dear all,
In another topic, while discussing about using third party jars I was told that we can use batch files with classpath variables.
As far as I know a batch file is similar to a text file only with a extension .bat.
Is it correct?

a.bat:


I want to know in using 3rd party jar, how can we use these batch files?
Regards.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 9993
    
    7

I do not understand why you are considering the batch file approach. If you switch platforms, you will have to go through the trouble of modifying the bat file to a shell script or something similar.

You can always define the classpath in your jar's manifest file.
Something like

Notice the white space between the two jars.

Check this out for more detailed information
http://www.j2ee.me/docs/books/tutorial/deployment/jar/downman.html
[ December 22, 2008: Message edited by: Maneesh Godbole ]

[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
ramya narayanan
Ranch Hand

Joined: Oct 06, 2008
Posts: 338
The link was very useful but somehow I cannot sync what's the use of this article with my post here.
But anyhow thanks.
Regards.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 9993
    
    7

I thought the article would be more helpful, as it described in more details, how to set the class path element in the manifest file to point to various external jars.
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 36563
    
  16
3rd-party jars? No longer a beginner's topic . . . moving.

Batch files are in fact text files with a .bat extension, but they are liable to be executed by a DOS or Windows computer automatically, maybe even at start-up time. That's about as much as I know about them.
You might do better to create an executable .jar with the 3rd-party jar specified in the manifest file. Look in the Java Tutorials: this section.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Defining batch files with classpath variables
 
Similar Threads
How to run several JVMs on my local PC?
Executable
Servlet in Package Issue
abt path, classpath, and system DSN
question on package and classpath