aspose file tools*
The moose likes IDEs, Version Control and other tools and the fly likes Adding class-path to manifest 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 » Engineering » IDEs, Version Control and other tools
Bookmark "Adding class-path to manifest" Watch "Adding class-path to manifest" New topic
Author

Adding class-path to manifest

Sarah Raf
Ranch Hand

Joined: May 08, 2011
Posts: 35

Hi All,
Sorry to have reopened this post , but can anyone help me out with this.
I have a properties file in the resources folder in my project. I have created a JAR file by excluding this properties file, so that any changes made to the properties file will reflect in my JAR file. Now I want to include this properties file path in the class path entry of my manifest file. How can I do this? I tried this , but when i do this, the other libraries that I include aren't being detected by the JAR file. How do I proceed.
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 9995
    
    7

Recommended reading http://download.oracle.com/javase/tutorial/deployment/jar/downman.html


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

Joined: May 08, 2011
Posts: 35

Thanks for the reply Maneesh. I had been through this article before, but my doubt isn't cleared. I need to access my properties file through the class path. AFAIK in the class-path entry of the manifest file we can add only JAR files and classes. Is there a way to add properties file?
Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 9995
    
    7

Sarah Raf wrote: AFAIK in the class-path entry of the manifest file we can add only JAR files and classes. Is there a way to add properties file?

This might or might not be true. I haven't tried it myself. However, I have my doubts. Class path signifies the path where required resources (including classes, as well as images, properties etc) can be found. You can easily test this by actually adding the properties to the class path.
Also note, it should be Class-Path: and not class-path=
Sarah Raf
Ranch Hand

Joined: May 08, 2011
Posts: 35

My manifest file looks like this

so to include the properties file i tried this

but this dint work out. So i tried this

when i do this I need to add the label.properties file outside the resources folder, into the current directory. The properties file is getting detected but the derby database isn't. What could be wrong?
Sarah Raf
Ranch Hand

Joined: May 08, 2011
Posts: 35

I found a way to set the classpath for the resource file. I am using a batch file to run my JAR. I have set the path like this


But now when I do any changes to the contents of the resource folder (properties file), the GUI does not recognize the database from the data folder. How do I proceed?

Regards,
Sarah
Sarah Raf
Ranch Hand

Joined: May 08, 2011
Posts: 35

Solved it Thanks for all the Help

I had to give an empty line at the starting of my resource file, and class path should be included in the batch file as i mentioned ( this should be done if you want to run your JAR file through an external batch file, NOT REQUIRED IN CASE OF ECLIPSE). The problem that my database wasn't getting recognized was all because that I forgot to include a blank line at the start of the resource file.

Once again thanks for all the help
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Adding class-path to manifest
 
Similar Threads
Jar file problems
Defining Ant build.xml java properties files for a run targer
Manifest file with ant
jar file prob
SQLite and connecting with Java Swing Application