• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Tim Cooke
  • Campbell Ritchie
  • paul wheaton
  • Ron McLeod
  • Devaka Cooray
Sheriffs:
  • Jeanne Boyarsky
  • Liutauras Vilda
  • Paul Clapham
Saloon Keepers:
  • Tim Holloway
  • Carey Brown
  • Piet Souris
Bartenders:

ClassLoader.getSystemResourceAsStream() returning null

 
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am using eclipse ide for my java projects
and in eclipse there is an option to export the project as a runnable jar file
and it creates MINIFEST.MF file which has all the information about the main method and other jar's used by the code

and in my code i am using


now when i run my code using eclipse , it finds abc.properties file
but when i am running through command prompt
java -jar <jar-file-name> args




returns null

now i believe there is some class path problem
i have set the classpath in my environmental variables but still cannot find above file from class path

please help

 
Marshal
Posts: 80622
469
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Don't set the classpath as an environment variable.

Make sure the file is in the correct location. You will have a current directory, where you can invoke your classes with

java foo.bar.MyClassWithMainMethod

That is the sort of "root" for your package structure. Try copying the file into that location and see whether that improves things. If that doesn't help, don't know, sorry.
 
mahavir swami
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I moved my properties file at the level where META-INF folder is there in jar file and
my code worked, i mean ClassLoader could find the file there
but if i want the file to be any where on the machine and the path will be set in classpath
then how do we achive that?
reply
    Bookmark Topic Watch Topic
  • New Topic