Can Only Load One PNG File

Sep 10, 2014

I'am trying to finish my first Java Game with the slick2D library. I had it all working in eclipse but when i was about to make a jar file of it i did realize that i had to use class loader to load my png - SpriteSheets. But now to the problem. My ResourceLoader Class looks like this:

public static InputStream load(String path){
InputStream input = MyResourceLoader.class.getResourceAsStream(path);
if(input==null){
input = MyResourceLoader.class.getResourceAsStream("/"+path);
}
return input;
}

My init-Method in the BasicGame class, where i try to load my png-files looks like this:

public void init(GameContainer arg0) throws SlickException {
InputStream inputStream1 = MyResourceLoader.load("images/piratR.png");
sprite1 = new SpriteSheet("",inputStream1,32,32);

InputStream inputStream2 = MyResourceLoader.load("images/monkey.png");
sprite2 = new SpriteSheet("",inputStream2,32,32);

animation1 = new Animation(sprite1,200);
animation2 = new Animation(sprite2,250);
}

And that works fine for loading the FIRST png-file(eg piratR.png), but whenever i try to load another file it just loads the first one again. So in this case sprite1 and sprite2 looks the same though there are different images.

When i switch the "Load order" and Load sprite2 before sprite1 both animations looks different, so I'm sure that i have two different pictures and its always the one that i load first that will get loaded to all the other SpriteSheets.

View Replies


ADVERTISEMENT

How To Load XML File Inside Of Java Class File In Netbeans Project

Feb 26, 2015

try {
File configFile= new File("C: Documents and SettingsstudentMy DocumentsNetBeansProjectsCDASsrcconfig.xml ");
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
Document doc = dBuilder.parse(fXmlFile);
doc.getDocumentElement().normalize();
NodeList nList = doc.getElementsByTagName("config");

[Code] .....

This code is working properly but i have use path like this

File configFile= new File("srcconfig.xml");

Instead of system directory path i have to use path inside of project but i am getting an error-cannot find the specified file...

View Replies View Related

Executable Jar File - Will Not Load Data From CSV File

May 5, 2015

I have a small application that I have been working on for several months. It works great. Now when I created an executable .jar file for it, it will not load data from a .csv file. I have tried looking into everything I can think if. I checked file paths, etc. I am using OpenCVS to read the csv. Is there an issue with that when you include it into another .jar file? I am trying to log if there is an error but I don't even get an error. I just doesn't run past that statement...

View Replies View Related

Cannot Load JAR File

Feb 8, 2014

I can not load my jar file and it is telling me it can not find the main and I thought I had the right files in the right spots. Do I need the .class of my main file for it to make the jar file. I do not understand If I need to make a .jar out of the main then add all the other files to create the jar.

added manifest
adding: Board.class(in = 2431) (out= 1371)(deflated 43%)
adding: Cell.class(in = 1702) (out= 959)(deflated 43%)
adding: Mark.class(in = 1195) (out= 673)(deflated 43%)
adding: Outcome.class(in = 960) (out= 538)(deflated 43%)
adding: Player.class(in = 832) (out= 472)(deflated 43%)

TacToeGUIGame.jar

Error: Could not find or load main class TicTacToeGUIGame

View Replies View Related

JSP :: How To Load A Properties File

Jul 21, 2014

I am using JPF controllers. Already, i am loading a properties file in the controller

(using annotations @Jpf.Controller(messageBundles = { @Jpf.Message Bundle(bundlePath = "validation.validator.Messages") },).

I have a problem. Depending on one of the request variables, i need to load different properties files. All these property files have same keys, but with different messages. I need to take the user to different sites(though internally, the backend logic remains same...Look and feel of the front end along with messages to be shown change to make the users feel they are being directed to a different site).

I am thinking of loading the properties file from the JSP when the user logs in first time from login page so that these properties are available until the session expires & not read the properties file in Controller.

View Replies View Related

File Transfer But Cannot Load In Its Launcher

Feb 3, 2015

Okay I am having a problem I wrote some code to transfer a file from my server when requested by the client. The problem is that when the file which is requested is transferred the file cannot be open in its respected file launcher when clicked. The File launcher throws back this msg "My Issue It request the File but after the File is requested and stored on the Client Machine when I Hit the File to be Launch adobe says the file "Adobe could not open the File for it is not supported file type or because the file as been damage"

So i have two pair sets of code for original coded by me. Original code i had first Server

import java.io.*;
import java.net.*;
public class SimpleFileServer {
public final static String FILE_TO_SEND = "c:/Users/Acer/Downloads/COAFlags.pdf"; // you may change this
public static void main(String args[]) {

[code]....

View Replies View Related

How To Load Java File Into Netbeans So Can Work With It

May 12, 2015

I have a couple .java examples I want to mess with but don't know how to get them into Netbeans so I can work with them. What is the process in loading a .java into Netbeans so I can work with the code and run it in Netbeans?

View Replies View Related

Unable To Load Class File Into Oracle Using Loadjava

Jun 5, 2013

I'm trying to load a class file into Oracle using loadjava and I get the following error:

ORA-29552: verification warning: java.lang.UnsupportedClassVersionError: helloworld (Unsupported major.minor version 51.0)

Presumably this is related to an inconsistency between the jdk that I used to compile helloworld and the Oracle JVM? Or something like that?

My JAVA_HOME is C:Program Files (x86)Javajre7bin
My javac version used to compile the code is javac 1.7.0_15
java -version is "1.7.0_15"
When I do a find on java.exe in the oracle installation directory (I'm running 11.2) I get

J-PC:J >find -name java.exe
./product/11.2.0/dbhome_1/jdk/bin/java.exe
./product/11.2.0/dbhome_1/jdk/jre/bin/java.exe
./product/11.2.0/dbhome_1/jre/1.5.0/bin/java.exe

Finally, the jdbc jar is ojdbc6.jar

Btw the code is just the usual little tester:

import oracle.jdbc.driver.*;
public class helloworld {
    public static String hello()
    {
        return "Hello World";
    }
    public static String hello(String s)
 
[Code]...

How can I get this class file loaded?

View Replies View Related

JavaFX 2.0 :: Other Methods To Load CSS File From MySQL DB Table

Jan 29, 2015

I am trying to load a CSS file from a mySql DB  table (each row represent a customer that use the application, and each one can set  his own CSS file).

How can I convert the Stream / String that I loaded from the Clob column to something that I can use here XXXX

scene().getStylesheets().add( XXXX );
  
I found alot of examples, but they all talking about files from filesystem, or URLs. My CSS file is in the application memory. I want to prevent the option to write my string as a new file and then read it again. I have no problem with loading the CSS file from database, this part is O.K.

View Replies View Related

Write A File To Disk And Then Load It - No Main Class Found?

Jun 19, 2014

Whenever I try to write a file to the disk and then load it within the same Class (if it is even possible) ...

It gives me an error: Could not find the main class: score.Score. Program will exit.

I have tried this with 2 different classes and it works fine? Why that error is appearing.

Code:

package score;
import java.io.BufferedReader;
import java.io.FileReader;
import java.io.FileWriter;
import java.util.Scanner;
public class Score {
public static void main(String [] args) throws Exception

[Code] .....

View Replies View Related

Runtime Error - Could Not Find Or Load Main File Java

Aug 2, 2014

i have a run time error that could not find or load the main file java .

View Replies View Related

How To Load A Site Or URL

Jan 11, 2014

So the user is on a website and I want them to go to another site using the same browser and tab.Can this be done in java? And yes the java program is running on the browser .

View Replies View Related

Load A Class From Src Folder

Mar 13, 2014

Within my program I allow users to write their own code to be executed. I then save that code in a .java file and then compile. This gives me a .java file and a .class file within the same package in the src folder. However, the compilation process also creates a .class file in the build folder. When the user edits their code and then re-runs it, the .class file in the build folder does not get updated with the new data, but the .class in the src folder does.

What I want to do is to execute the .class file in the src folder and not the build folder. So far I have the following method, but that somehow refers to the .class file in the build folder:

public void runMethod(String packageFilePath, String className){
try{
URI fileURI = new URI("file:/src/uk/learningAid/UserInputs/");
URL url = fileURI.toURL();
URL[] urls = new URL[]{url};

[code]....

View Replies View Related

Cannot Load Library JDIC

Jun 17, 2014

When I try to create a WebBrowser object

WebBrowser browser = new WebBrowser ();

I get this error

Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: Can't load library: C:UsersChris.m2
epositoryorgjdesktopjdicjdic.9.5windowsamd64jdic.dll

The problem is that the path does not exists after windowsamd64jdic.dll

So i cant put the dll file there..its the first time i use dll files ....

View Replies View Related

Applets :: Classloader Can't Load Properties

May 29, 2014

I'm developing an Applet that print a bar code using Jpos API. I need some jars and two configuration file. I've added jars to the classpath and configuration files in src directory. In Eclipse everything works fine.

DefaultProperties prop = new DefaultProperties();
prop.loadJposProperties();
SimpleXmlRegPopulator xmlReg = new SimpleXmlRegPopulator();
xmlReg.load(wincor.jpos17.THxxx.xml");

Everything works fine in Eclispe but I can't find property files when i call the applet from a web page. So I've checked the JavaPos sources and I've paste the loadJposProperties() and xmlReg.load("wincor.jpos17.THxxx.xml") content in my source code:

InputStream isD = prop.getClass().getClassLoader().getResourceAsStream(prop.JPOS_PROPERTIES_FILENAME); // (1) content of loadProperties
if (isD != null){
System.out.println("jpos/res/jpos.properties found");

[Code] ...

The same method is used to found wincor.jpos17.THxxx.xml. So when I call applet form the browser I get INPUT STREAM FROM PROPERTIES OK!! from (1) and jpos/res/jpos.properties not found from (2).

So getClass().getClassLoader().getResourceAsStream works if i write it directly in my code, but doesn't work if i call a jar method.

View Replies View Related

Swing/AWT/SWT :: How To Load Image To JFrame

Jul 23, 2014

How to load an image to a swing application?? I want to load it to myframe(JFrame)..

View Replies View Related

JDK 1.6 - Could Not Find Or Load Main Class

Sep 23, 2014

I have permanently set the path of bin of JDK 1.6 in the environment variables of my system. I am able to compile any of my java programs successfully. But when I give command to run the program I am getting an error "could not find or load main class".

When I write the command "set classpath=.;" program runs successfully. I want to know whether I have to set this classpath everytime I run a new progaram. Is there any permanent way to set classpath ?

View Replies View Related

JSF :: Load Images From CSS On Composite Component?

May 9, 2014

I have an issue about loading images from css using a composite component. The folder structure is:

resources
resources -> css -> componentname
resources -> images - > componentname
resources -> WEB-INF

If i write in the css something like

border-image: url(resources/images/componentname/image.png) !important;
or
border-image: url(images/componentname/image.png) !important;

i have a 404 error and i can't see the image.

I able to load the image only if i write path with context-root:

border-image: url(/<CONTEXTROOT>/resources/images/componentname/image.png) !important;

but i can't write explicit context root in css files!!

So, i tried to use resource EL variable:

border-image: url(#{resource[image/componentname/image.png]}) !important;

but this last way render

border-image: url("/<CONTEXTROOT>/javax.faces.resource/images/componentname/image.png.faces.faces") !important;

and i not able to replicate the right way written above.

The project is developed with RSA9 and WebSphere Portal 8, but if i try to execute it in NetBeans (no portal) it run correctly!

View Replies View Related

Swing/AWT/SWT :: JMenuItem Disable On Load?

Oct 10, 2014

I want to disable one of the JMenuItem on load itself but when i tried with following code it is disabling after I selected the JMenuitem.

what additional changes are needed to make it work accordingly.

this.onOffItem = new JMenuItem("Filter");
this.onOffItem.addActionListener(new ActionListener() {
public void actionPerformed(ActionEvent e) {
applyTruthFlag(currentBTE.isTruthFlag());
}
});
this.menuFilter.add(this.onOffItem);
private void applyTruthFlag(boolean truthAuswertung) {
this.onOffItem.setEnabled(truthAuswertung);
//this.onOffItem.repaint();
}

View Replies View Related

Easy Way To Load Images Using For Loop?

Apr 17, 2015

I am looking for a way to tidy up my setup at the beginning of my java project.

piece[0].picture = loadImage("Piece1.png");
piece[1].picture = loadImage("Piece2.png");
piece[2].picture = loadImage("Piece3.png");
piece[3].picture = loadImage("Piece4.png");
piece[4].picture = loadImage("Piece5.png");
piece[5].picture = loadImage("Piece6.png");

[code]...

I though a for loop might work but im not sure how id get it to use the file names above

for(int l=0; l<=76; l++){
piece[l].picture = loadImage("part unsure about")
}

View Replies View Related

Could Not Find Or Load Main Class

Mar 1, 2015

I creates this simple code (shown below) inside a package of a major opensource code (i.e., openSHA), but when i run it the following error appears. The error mentions a class named "KT_testGmpeForScenarioRupture" that i wrote before and did not run showing exactly the same error.

Code:

package org.opensha.sha.gcim.imr.attenRelImpl;
public class KT_Test {
private static void main(String args) {
int x=4;
System.out.println("x is " + x);
}
}

Error: Could not find or load main class org.opensha.sha.gcim.imr.attenRelImpl.KT_testGmpeF orScenarioRupture

View Replies View Related

JSP :: Unable To Load Tag Handler Class

Nov 21, 2014

I am trying to create a custom tag, but I am getting the error message:

Unable to load tag handler class "com.tutorialspoint.HelloTag" for tag "ex:Hello"

I am following the steps given in the tutorial: [URL] ....

/Users/s.m/Documents/com/tutorialspoint/HelloTag.java
package com.tutorialspoint;
import javax.servlet.jsp.tagext.*;
import javax.servlet.jsp.*;
import java.io.*;
public class HelloTag extends SimpleTagSupport {

[Code] ....

I am running under MAC system. What could be wrong?

View Replies View Related

JSP :: Could Not Load Tomcat Server Configuration

Jul 31, 2014

I am using RAD and I copied the Tomcat server from server to local folder. Then I tried to add this tomcat by adding new server. I got the error in title. After searching, I copied the Tomcatconf files to myworkspaceserver omcat at localhost-config, restart RAD and refresh. But now I am getting the error that the conf may corrupted or incomplete.

View Replies View Related

How To Load Bitmap Image In Android

Apr 23, 2014

I have been trying to draw a bitmap image onto the canvas from Android and all it displays is a blank white screen. Whenever my app starts up, I am calling this in my game - view class which extends View and overrides the onDraw method:

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Canvas;
import android.graphics.Paint;
import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;

[Code] ....

View Replies View Related

Cannot Get Simple Image To Load In Jpanel

Aug 7, 2014

I cannot get an image to display. The code here is my latest attempt. I have tried ImageIcon, applets using getImage() among many other things. I do not know if it is a file path problem. The file I am using is in the src folder of the package I am using on Eclipse. I am on Windows 8. Here is the code.

import java.awt.*;
import javax.swing.*;
import javax.swing.ImageIcon;

[Code].....

View Replies View Related

Cannot Find Or Load Main Class

Nov 19, 2014

I am using Netbeans as my IDE and I have created a program called Saluton.java

I navigate to the folder holding the class file using the command line under Windows 7 but when I issue the command java Saluton.class I get an error it cannot load or find the main class.

View Replies View Related







Copyrights 2005-15 www.BigResource.com, All rights reserved