Questions tagged [resources]

Assets (like memory, disk space, CPU power or alike) necessary for effective operation or physical files (like images, configuration files or other) to provide some externalized enrichment to an application.

Typically resources are materials or other assets that are transformed to produce benefit and in the process may be consumed or made unavailable

9303 questions
94
votes
5 answers

How to use ClassLoader.getResources() correctly?

How can I use ClassLoader.getResources() to find recursivly resources from my classpath? E.g. finding all resources in the META-INF "directory": Imagine something like getClass().getClassLoader().getResources("META-INF") Unfortunately, this does…
MRalwasser
  • 15,605
  • 15
  • 101
  • 147
93
votes
13 answers

open resource with relative path in Java

In my Java app I need to get some files and directories. This is the program structure: ./main.java ./package1/guiclass.java ./package1/resources/resourcesloader.java ./package1/resources/repository/modules/ -> this is the dir I need to…
JuanDeLosMuertos
  • 4,532
  • 15
  • 55
  • 87
92
votes
1 answer

Spring: Difference of /** and /* with regards to paths

What's the difference between two asterisks instead of one asterisk when we refer to paths? Earlier I was debugging my Spring 3 project. I was trying to add a .swf using With my…
mpmp
  • 2,409
  • 4
  • 33
  • 46
89
votes
4 answers

What are some good resources for writing a chess engine?

I'm interested in writing a chess engine (mostly as a learning exercise) and would be interested in any resources that people know of that could be of interest or use, anything really: Papers, Books, Theory, Tutorials, anything that could be useful.
Paul Wicks
  • 62,960
  • 55
  • 119
  • 146
89
votes
6 answers

Embedding resources in executable using GCC

I'm looking for a way to easily embed any external binary data in a C/C++ application compiled by GCC. A good example of what I'd like to do is handling shader code - I can just keep it in source files like const char* shader = "source here"; but…
Kos
  • 70,399
  • 25
  • 169
  • 233
89
votes
7 answers

Accessing a resource via codebehind in WPF

I have a custom collection defined in my window resources as follows (in a Sketchflow app so the window is actually a UserControl): I want to be…
randomsequence
  • 1,338
  • 1
  • 11
  • 14
85
votes
6 answers

Java Jar file: use resource errors: URI is not hierarchical

I have deployed my app to jar file. When I need to copy data from one file of resource to outside of jar file, I do this code: URL resourceUrl = getClass().getResource("/resource/data.sav"); File src = new File(resourceUrl.toURI()); //ERROR…
hqt
  • 29,632
  • 51
  • 171
  • 250
84
votes
3 answers

How to combine imported and local resources in WPF user control

I'm writing several WPF user controls that need both shared and individual resources. I have figured out the syntax for loading resources from a separate resource file:
Tor Haugen
  • 19,509
  • 9
  • 45
  • 63
80
votes
6 answers

How to use relative paths without including the context root name?

To working my static file (CSS, JS) I have to write absolute path like /AppName/templates/style/main.css. Is there any solution, that I could write relative path like style/main.css?
kspacja
  • 4,648
  • 11
  • 38
  • 41
79
votes
6 answers

How to get a test resource file?

In a unit test I need to import a csv file. This is located in the resources folder, i.e. src/test/resources
simpatico
  • 10,709
  • 20
  • 81
  • 126
79
votes
12 answers

How to design extensible software (plugin architecture)?

I need some resources that talk about how to design your software to be extensible, i.e. so that other people can write add-ons/plug-ins that adds functionality to it. What do you recommend? Any books out there that discuss the subject? I would…
hasen
  • 161,647
  • 65
  • 194
  • 231
76
votes
3 answers

Difference between getString() and getResources.getString()

I noticed that the Activity class has two different methods to get a String resource. This is possible by using: getString(int resId): Return a localized string from the application's package's default string table. getResources().getString(int…
Valentin
  • 5,379
  • 7
  • 36
  • 50
75
votes
4 answers

Get a resource using getResource()

I need to get a resource image file in a java project. What I'm doing is: URL url = TestGameTable.class.getClass(). getClassLoader().getResource("unibo.lsb.res/dice.jpg"); The directory structure is the following: unibo/ lsb/ res/ …
lbedogni
  • 7,917
  • 8
  • 30
  • 51
74
votes
5 answers

How do I use an icon that is a resource in WPF?

I have a .ico file that is embedded as a resource (build action set to resource). I am trying to create a NotifyIcon. How can I reference my icon? notifyIcon = new NotifyIcon(); notifyIcon.Icon = ?? // my icon file is called MyIcon.ico and is…
ScottG
  • 10,711
  • 25
  • 82
  • 111
73
votes
8 answers

Spring Boot access static resources missing scr/main/resources

I am working on a Spring Boot application. I need to parse an XML file (countries.xml) on start. The problem is that I do not understand where to put it so that I could access it. My folders structure is…
lenach87
  • 949
  • 3
  • 11
  • 18