resources

How to add resources into jar file

浪尽此生 提交于 2019-12-20 01:13:37
问题 I need to add an exel file into my jar so it's portable. I know the answer is using getClass().getResource.... but i don't have a clue on how to go about using this code. I have the exel file in the src folder with my class files, it works in netbeans but not when i open the jar file on another PC. i get filenotfound exception here is the code i have used: public class WindageLogic { //.... public void GetValues() throws Exception { File exel=new File("src/Calculator/table1.xls"); Workbook w1

Concate define and string in resources

此生再无相见时 提交于 2019-12-20 01:08:53
问题 I have a resource file where needed create string define with concatenation macros and string, something like this #define _STRINGIZE(n) #n #define STRINGIZE(n) _STRINGIZE(n) #define Word_ Word 100 DIALOGEX 0, 0, 172, 118 STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Hello"STRINGIZE(Word_)=>"Hello"Word" but needed simple "HelloWord" without average quotes. 回答1: For anyone who cares: a .rc file is a resource file from an MFC project that defines UI elements,

Concate define and string in resources

戏子无情 提交于 2019-12-20 01:08:01
问题 I have a resource file where needed create string define with concatenation macros and string, something like this #define _STRINGIZE(n) #n #define STRINGIZE(n) _STRINGIZE(n) #define Word_ Word 100 DIALOGEX 0, 0, 172, 118 STYLE DS_SETFONT | DS_MODALFRAME | WS_POPUP | WS_CAPTION | WS_SYSMENU CAPTION "Hello"STRINGIZE(Word_)=>"Hello"Word" but needed simple "HelloWord" without average quotes. 回答1: For anyone who cares: a .rc file is a resource file from an MFC project that defines UI elements,

Get HModule from inside a DLL

感情迁移 提交于 2019-12-19 21:44:52
问题 I need to load some resource from my DLL (i need to load them from the DLL code), for doing that I'm using FindResource. To do that i need the HModule of the DLL. How to find that? (I do not know the name (filename) of the DLL (the user can change it)) 回答1: The first argument to DllMain() is the HMODULE of the DLL. 回答2: You get it from the DllMain() entrypoint, 1st argument. Write one, store it in a global variable: HMODULE DllHandle; BOOL APIENTRY DllMain(HMODULE hModule, DWORD dwReason,

Netbeans - adding resource files to jar file with Ant

老子叫甜甜 提交于 2019-12-19 21:44:12
问题 I want add some resource files (non-code text-based files) to the jar file in a Java project using Netbeans 6.9, I'd expect using Ant. I had thought that this would be reasonably simple...but after quite a bit of searching I can't find how to do it..! Any pointers in the right direction? 回答1: The answer I think I was looking for is as follows: In the build.xml file (as per trashgod's answer) you can use the hooks already in the ant build script to add the following: <target name="-post-jar">

Spring mvc:resources access to outside folder

点点圈 提交于 2019-12-19 20:34:51
问题 I have stored medias (pictures and movies) in a folder (for example C:\test\tes.png) and I'm trying to access to pictures with an url like : http://localhost:8080/app/picture/test.png. To do that, i have used resources tag (spring 3) as below : <mvc:resources mapping="/picture/**" location="file:/test" /> When I try to access, I have an error with no more details. Requested Resource Not Found I have in logs : 2011-11-07 20:48:55,241 [http-8080-2] DEBUG org.springframework.web.servlet

List of resources in a folder of jar file?

北城以北 提交于 2019-12-19 17:45:55
问题 As usually I read resources from jar file as following: getClassLoader().getResource(pTextPath + "/" + pLang +".xml"); I need to read all resources with certain name from known folder in jar file. E.g. read *.xml from addon/resources/texts Could I somehow get from jar files list of resources according to path and name template? UPDATE: Exact duplication of Get a list of resources from classpath directory Please close the question. 回答1: CodeSource src = MyClass.class.getProtectionDomain()

android Listview button

北城余情 提交于 2019-12-19 11:46:43
问题 I am trying to add a button in my list view. But the button is not showing up. I am using json parsing to take data from my server. I am using hashmap and listviews. Moreover i cannot adda button in the list view too. Here's my code: package acb.xiynove; import java.util.ArrayList; import java.util.HashMap; import java.util.List; import java.util.Map; import java.util.Vector; import org.json.JSONArray; import org.json.JSONObject; import android.app.Activity; import android.app.ListActivity;

Retrieve image resource using string variable in foreach loop

谁都会走 提交于 2019-12-19 10:44:44
问题 I have a string array "abc" I put this in a for each loop. I want to retrieve an image from resources using the value in the foreach loop and put it into a picture box. code below: char[] stringArr = inputted.ToCharArray(); foreach (char i in stringArr) { PictureBox pictureBox = new PictureBox(); object obj = ResourceManager.GetObject(i.ToString()); pictureBox.Image = ((System.Drawing.Bitmap)(obj)); Controls.Add(pictureBox); } What do i have to do to get this working? What i am trying to

Android Soundpool Load(String path, int priority)

被刻印的时光 ゝ 提交于 2019-12-19 09:57:38
问题 I am trying to load a sound from android. The sound is under res/raw/myownsound.wav . I know that I can already load the sound using: soundPool.load(context, R.raw.myownsound, 1) For customization purposes, I would like to load it using: soundPool.load("res/raw/myownsound", 1) ... but I get the following error : error loading res/raw/myownsound . I also tried the following : soundPool.loadSound("android.resource://upg.GraphismeBase/raw/myownsound", 1) .. but I get an error as well : error