Win a copy of Think Java: How to Think Like a Computer Scientist this week in the Java in General forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Adding class-path to manifest

 
Sarah Raf
Ranch Hand
Posts: 35
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11027
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
 
Sarah Raf
Ranch Hand
Posts: 35
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 11027
12
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 35
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 35
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 35
Android Eclipse IDE Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic