resources

Java: opening a resource (txt file) which is in a jar with OS standard application

烂漫一生 提交于 2020-01-15 07:47:45
问题 i get the error "AWT-EventQueue-0 java.lang.IllegalArgumentException: URI is not hierarchical". -I'm trying to use the java.awt.Desktop api to open a text file with the OS's default application. -The application i'm running is launched from the autorunning jar. I understand that getting a "file from a file" is not the correct way and that it's called resource. I still can't open it and can't figure out how to do this. open(new File((this.getClass().getResource("prova.txt")).toURI())); Is

Java: opening a resource (txt file) which is in a jar with OS standard application

早过忘川 提交于 2020-01-15 07:47:13
问题 i get the error "AWT-EventQueue-0 java.lang.IllegalArgumentException: URI is not hierarchical". -I'm trying to use the java.awt.Desktop api to open a text file with the OS's default application. -The application i'm running is launched from the autorunning jar. I understand that getting a "file from a file" is not the correct way and that it's called resource. I still can't open it and can't figure out how to do this. open(new File((this.getClass().getResource("prova.txt")).toURI())); Is

Java: opening a resource (txt file) which is in a jar with OS standard application

ε祈祈猫儿з 提交于 2020-01-15 07:47:06
问题 i get the error "AWT-EventQueue-0 java.lang.IllegalArgumentException: URI is not hierarchical". -I'm trying to use the java.awt.Desktop api to open a text file with the OS's default application. -The application i'm running is launched from the autorunning jar. I understand that getting a "file from a file" is not the correct way and that it's called resource. I still can't open it and can't figure out how to do this. open(new File((this.getClass().getResource("prova.txt")).toURI())); Is

How to add resource to existing signed assembly

蹲街弑〆低调 提交于 2020-01-15 01:49:16
问题 Given: - an assembly (e.g. "SomeLib.dll") - a text file (e.g. "myconfig.xml") I need to embed the file myconfig.xml into the existing assembly SomeLib.dll Please consider before pressing "Answer": I know about resources embeding during compile (csc.exe .. /embedresource:file ... ). The thing is that I need to embed a resource after assembly has created. Is it possible? I also know about ILMerge. But havn't found how it could help. 回答1: You can use Cecil for this: load an assembly, add a

Can't access resource in a JAR on all computers

三世轮回 提交于 2020-01-14 08:35:33
问题 I'm writing an application (specifically a plugin for the Bukkit Minecraft server). Doing this requires that I access a .properties file from the JAR of the application. This is where I encounter a strange problem. When I test the program on my development PC, it runs just fine. The .properties file gets loaded and everything is fine. However, on the other computer that I test it on, I try to start the app, and it can't loaded the properties, and the InputStream is null . Here is the method

How to set up a <Resource> in Tomcat 7 so that I don't need to use “java:/comp/env” in the code?

蹲街弑〆低调 提交于 2020-01-14 08:01:06
问题 I am new to setting up JNDI resources and setting up JNDI resources in Tomcat. I inherited a servlet application. It runs on a test server via WebLogic. The servlet application accesses its database resource in the following way: ctx = new InitialContext(); ds = (javax.sql.DataSource)ctx.lookup("myDataBaseName"); conn = ds.getConnection(); When I tried that in a test JSP it doesn't work. I get javax.naming.NameNotFoundException: Name myDataBaseName is not bound in this Context However I was

Getting Resources from another package

走远了吗. 提交于 2020-01-14 05:00:07
问题 Inside src/ I have the following packages:com.app.animals, com.app.animals.threads, com.app.animals.games When I try to get my proyect resources (drawable folder) from a class called "CarreraJuego.java" inside com.app.animals.games, it says that 'R cannot be resolved to a variable' How can I access resources folder from that package?The class is a surfaceview 回答1: Here is a simple and quick way to achieve it: try { PackageManager manager = getPackageManager(); Resources resources = manager

How to customize flash message based on success or failure with Inherited Resources Rails plugin?

烈酒焚心 提交于 2020-01-14 03:32:07
问题 I'm using the inherited resources plugin in a 2.3.5 Rails application and was wondering how to change the flash[:notice] (or any other flash) based on the success OR failure in my create and update actions. So given the below, how do I add flash[:notice] = "All good" if success ... and flash[:notice] = "All bad" if failure? Thanks class ArticleController < InheritedResources::Base actions :show, :create, :update respond_to :html, :json before_filter :authorize_upsert, :only => [:create,

Calling Resources.Load on a texture is not working

本小妞迷上赌 提交于 2020-01-13 20:43:27
问题 I'm trying to load a Texture from the Resources folder but it keeps on returning null . t = (Texture)Resources.Load("Circle") as Texture; The circle texture has an extension of .tga . 回答1: You must put Circle.tga in Assets/Resources folder. Plus if you have subfolder, for example Resources/Textures/Circle.tga then do like this: Texture t = Resources.Load("Textures/Circle") as Texture; 回答2: The extension of the file isn't necessary. So this is correct: t = (Texture)Resources.Load("Circle") as

Java applet cannot locate resources

99封情书 提交于 2020-01-13 19:24:31
问题 I am sorry if this is a repeat but I already read dozens of posts regarding the issue and I still cant solve it. I am working on a project in java with Intellij IDE (it's actually this game http://www.kilobolt.com/unit-2-creating-a-game-i.html and it appeared on this forum allot). My issue is that the java applet cannot locate any resources (images and texts). getImage() method cant load images with "../data/image.png", nor "/data/image.png", nor the regular "data/image.png". same goes for