I am currently testing Slick2D and thats why i am writing a Pong Game,
Also, in this PongGame you can select Music Files, which are in the ./music Folder
When i run it through Eclipse, all works perfectly.
When i export it, run it with all natives and Librarys in the Folder, it also starts,
but the Music Menu does not work (It just crashes when i select a Music)
The code you can see on:
https://bitbucket.org/JohnnyCrazy/pingpong/src/f2fd635ccfef/src/me/Johnny/Slick2D?at=master
Error: Mon Feb 04 13:47:05 CET 2013 ERROR:OpenAL error: Invalid
Operation (40964) org.lwjgl.openal.OpenALException: OpenAL error:
Invalid Operation (40964)
at org.lwjgl.openal.Util.checkALError(Util.java:64)
at org.lwjgl.openal.AL10.alDeleteBuffers(AL10.java:1097)
at org.newdawn.slick.openal.AudioImpl.release(AudioImpl.java:56)
at org.newdawn.slick.Music.release(Music.java:424)
at me.Johnny.Slick2D.Slick2D.setMusic(Slick2D.java:57)
at me.Johnny.Slick2D.MusikState.update(MusikState.java:108)
at org.newdawn.slick.state.StateBasedGame.update(StateBasedGame.java:278)
at org.newdawn.slick.GameContainer.updateAndRender(GameContainer.java:678)
at org.newdawn.slick.AppGameContainer.gameLoop(AppGameContainer.java:456)
at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:361)
at me.Johnny.Slick2D.Slick2D.main(Slick2D.java:40) Mon Feb 04 13:47:05 CET 2013 ERROR:Game.update() failure - check the game code.
org.newdawn.slick.SlickException: Game.update() failure - check the
game code.
at org.newdawn.slick.GameContainer.updateAndRender(GameContainer.java:684)
at org.newdawn.slick.AppGameContainer.gameLoop(AppGameContainer.java:456)
at org.newdawn.slick.AppGameContainer.start(AppGameContainer.java:361)
at me.Johnny.Slick2D.Slick2D.main(Slick2D.java:40)
I don't understand why it works in Eclipse and exported it doesn't.
The JavaDocs for the constructor of Music(String) are not entirely clear on how it interprets the String. J2SE methods that take a String typically presume it to represent the path to a File. If that is the case, that is also the reason behind the failure.
Typically those types of resources become an embedded-resource when the app. is built. An embedded resource must be accessed by URL. See the embedded resource info. page for tips on forming the URL.
Related
I am new to Apache Derby database,
When i am trying to crate new database using the following command i am getting the below problem
C:\>java org.apache.derby.tools.ij
ij version 10.10
ij> connect 'jdbc:derby:Mynewdb;create=true';
Mon Mar 03 20:17:32 IST 2014 Thread[main,5,main] java.io.FileNotFoundException: derby.log
(Access is denied)
----------------------------------------------------------------
Mon Mar 03 20:17:33 IST 2014:
Booting Derby version The Apache Software Foundation - Apache Derby - 10.10.1.1 - (1458268): instance a816c00e-0144-886a-02f2-000000b8d0b0
on database directory C:\Mynewdb with class loader sun.misc.Launcher$AppClassLoader#11b86e7
Loaded from file:/C:/db-derby-10.10.1.1-bin/db-derby-10.10.1.1-bin/lib/derby.jar
java.vendor=Sun Microsystems Inc.
java.runtime.version=1.6.0_23-b05
user.dir=C:\
os.name=Windows 7
os.arch=x86
os.version=6.1
derby.system.home=null
Database Class Loader started - derby.database.classpath=''
A file named derby.log will be created in the current working directory when you run ij (or attempt to use embedded Apache Derby in some other application). From the post, it appears you are executing this from C:\ and the user you are logged on as does not have write access to that directory: change to a directory where the user has permission to create a file and retry.
Note it is possible to suppress this log file (though I have not yet done this myself). See Getting rid of derby.log. However, suppressing the log file would just result in another failure in your case because the database will be created on the file system relative to the current directory. That is, an attempt to create the directory named Mynewdb in the current directory, C:\, would also fail for the same reason. It is possible to specify a path for the database to avoid creating in the current working directory:
ij> connect 'jdbc:derby:/tmp/test_db;create=true';
user.dir=C:\
os.name=Windows 7
Windows 7 (and up?) doesn't let you write files to the root directory in most cases. You should cd to another directory before starting ij. e.g. cd \Users\YOUR_USER_NAME and you should be good to go.
I am unable to view the JavaCore.class source code, although I am able to use the code just fine.
For example, to view the source code of the method JavaCore.create(..), I ctrl - click (or press f3) on the create in JavaCore.create(ResourceUtility.getWorkspaceRoot());. But instead of an editor with the source code, I get the following message:
**Class File Editor**
**Source Not Found**
The source attachment does not contain the source for the file JavaCore.class.
You can change the source attachment by clicking Change Attached Source below:
I listed the contents of the default source attachment, ~/.eclipse/org.eclipse.platform_4.3.0_758590624_linux_gtk_x86_64/plugins/org.eclipse.jdt.core_3.9.0.201212161923.jar, as follows:
`jar tvf ~/.eclipse/org.eclipse.platform_4.3.0_758590624_linux_gtk_x86_64/plugins/org.eclipse.jdt.core_3.9.0.201212161923.jar `
When I searched "JavaCore" in the output, I found only the following files:
618 Sun Dec 16 19:23:18 PST 2012 org/eclipse/jdt/core/JavaCore$1.class
1746 Sun Dec 16 19:23:18 PST 2012 org/eclipse/jdt/core/JavaCore$2.class
66406 Sun Dec 16 19:23:18 PST 2012 org/eclipse/jdt/core/JavaCore.class
1758 Sun Dec 16 19:23:18 PST 2012 org/eclipse/jdt/core/JavaCore.java.rej
Does this mean I do not have the source under this jar? If not, where would the source code be?
I am using Ubuntu 13.10 (Saucy Salamander) and I have Eclipse installed under ~/eclipse/ (which contains my plugins/, dropins/, etc).
I'm guessing that you need to obtain the JDT source from the SDK. If your version of Eclipse is 4.3.0 then you can grab the JDT SDK from here: http://archive.eclipse.org/eclipse/downloads/drops4/R-4.3-201306052000/download.php?dropFile=org.eclipse.jdt.source-4.3.zip .
I found this on this archive page for Eclipse 4.3.0: http://archive.eclipse.org/eclipse/downloads/drops4/R-4.3-201306052000/
EDIT: After downloading the zip, the file you want is plugins/org.eclipse.jdt.core.source_3.9.0.v20130604-1421.jar (although the date stamp on the file is different to your binary...)
I found the source code under ~/eclipse/plugins/org.eclipse.jdt.core.source_3.9.1.v20130905-0837.jar for this example. I am not sure why Eclipse was defaulting to the ~/.eclipse/ directory for the source code when there are many source code ".jars" under ~/eclipse/plugins/.
I have a javafx application, i am using netbeans as IDE. If i use the configuration stand alone the program is working without any trouble. But if i choose Run in browser i have a Runtime Error and the strack trace is pretty much empty :
Plug-in Java 10.21.2.11
Utilisation de la version JRE 1.7.0_21-b11 Java HotSpot(TM) Client VM
Répertoire d'origine de l'utilisateur = C:\Users\Julien
----------------------------------------------------
...
----------------------------------------------------
CacheEntry[file:/C:/Users/Julien/Documents/NetBeansProjects/FittsLaw/dist/lib/eclipselink-2.3.2.jar]: updateAvailable=true,lastModified=Wed May 15 11:26:16 CEST 2013,length=6770392
CacheEntry[file:/C:/Users/Julien/Documents/NetBeansProjects/FittsLaw/dist/lib/javax.persistence-2.0.3.jar]: updateAvailable=true,lastModified=Wed May 15 11:26:19 CEST 2013,length=143654
CacheEntry[file:/C:/Users/Julien/Documents/NetBeansProjects/FittsLaw/dist/FittsLaw.jar]: updateAvailable=false,lastModified=Wed May 15 11:26:08 CEST 2013,length=166805
CacheEntry[file:/C:/Users/Julien/Documents/NetBeansProjects/FittsLaw/dist/lib/mysql-connector-java-5.1.18-bin.jar]: updateAvailable=true,lastModified=Wed May 15 11:26:22 CEST 2013,length=805863
If i try to deploy it, the JAR is working, but JNLP/HTML are leading to the same Runtime error.
I don't know where i must search because this runtime error doesn't give me a lot of information.
I have tried :
different browsers
Update/reinstall plugin/jre/jdk
I have found lot of topic about it, but most of them got Classnotfound exception where it seems my problem isn't the same because i never got it in the stacktrace.
I downloaded the examples of latest version for chapter 09 of “Mahout in Action”. I can successfully run several examples, but for three files, NewsKMeansClustering.java, ReutersToSparseVectors.java, and NewsFuzzyKMeansClusteing.java. Running these three programs gives similar error messages:
Aug 3, 2011 2:03:54 PM org.apache.hadoop.metrics.jvm.JvmMetrics init
INFO: Initializing JVM Metrics with processName=JobTracker, sessionId=
Aug 3, 2011 2:03:54 PM org.apache.hadoop.mapred.JobClient configureCommandLineOptions
WARNING: Use GenericOptionsParser for parsing the arguments. Applications should
implement Tool for the same.
Aug 3, 2011 2:03:54 PM org.apache.hadoop.mapred.JobClient configureCommandLineOptions
WARNING: No job jar file set. User classes may not be found. See JobConf(Class) or
JobConf#setJar(String).
Exception in thread "main" org.apache.hadoop.mapreduce.lib.input.InvalidInputException: Input path does not exist: file:/home/user1/workspaceMahout1/recommender/inputDir
at org.apache.hadoop.mapreduce.lib.input.FileInputFormat.listStatus(FileInputFormat.java:224)
at org.apache.hadoop.mapreduce.lib.input.SequenceFileInputFormat.listStatus(SequenceFileInputFormat.java:55)
at org.apache.hadoop.mapreduce.lib.input.FileInputFormat.getSplits(FileInputFormat.java:241)
at org.apache.hadoop.mapred.JobClient.writeNewSplits(JobClient.java:885)
at org.apache.hadoop.mapred.JobClient.submitJobInternal(JobClient.java:779)
at org.apache.hadoop.mapreduce.Job.submit(Job.java:432)
at org.apache.hadoop.mapreduce.Job.waitForCompletion(Job.java:447)
at org.apache.mahout.vectorizer.DocumentProcessor.tokenizeDocuments(DocumentProcessor.java:93)
at mia.clustering.ch09.NewsKMeansClustering.main(NewsKMeansClustering.java:54)
For the above messages, I do not quite understand what do those two warnings mean? Moreover, it looks like that “input path” should have been created, how can I create this type of input? Thanks.
You can ignore the warnings. The error is that the input directory you have specified does not exist. Does it exist? What is your command line?
I ran into a similar mismatch. The MiA files at https://github.com/tdunning/MiA have some cases where a .csv file is left in the same dir as the Java source. For example https://github.com/tdunning/MiA/tree/master/src/main/java/mia/recommender/ch02 ... however via Eclipse, loading it using DataModel model = new FileDataModel(new File("intro.csv")); ...doesn't find it.
Adding
System.out.println("CWD: "+System.getProperty("user.dir"));
...will reveal where Eclipse is looking (in my case, a couple levels up the filetree, but this might vary depending on how exactly you've set things up).
I'm attempting to use the lwjgl library and I'm starting from scratch on a new Windows 7 install.
I downloaded the latest JDK 6 from the Oracle website. After installing it, I found that commands like "java" or "javac" weren't being recognized from a windows cmd prompt. So, I edited my path variable and appended the jdk's bin folder to it.
Now the java commands work.
So, I download the latest lwjgl, extract it and read the installation instructions on their website:
Download the distribution Unpack the
archive, file contents (in sub
folders) should include (amongst other
things):
lwjgl.dll lwjglaudio.dll lwjgl.jar
lwjgl_util.jar lwjgl_test.jar
Test
LWJGL by opening a command prompt, and
navigating to the folder where the
archive was extracted. Once navigated,
issue the following command: (all in
one line, space before each -option)
java -cp .;res;jar\lwjgl.jar;jar\lwjgl_test.jar;jar\lwjgl_util.jar;jar\lwjgl_fmod3.jar;jar\lwjgl_devil.jar;jar\jinput.jar;-Djava.library.path=native\windows org.lwjgl.test.WindowCreationTest
A window should appear and you should
see the following output:
Found display modes 240, 320,
WindowCreationTest Display created
Moving to 100, 100 Window created 600,
800, Game
So, I extracted it and navigated to the extracted folder in a cmd prompt.
I then executed the test command specified above and I get the following error:
C:\Users\Nestor\Downloads\lwjgl-2.6\lwjgl-2.6>java
-cp .;res;jar\lwjgl.jar;jar\ lwjgl_test.jar;jar\lwjgl_util.jar;jar\lwjgl_fmod3.jar;jar\lwjgl_devil.jar;jar\ji
nput.jar;-Djava.library.path=native\windows
org.lwjgl.test.WindowCreationTest
The
following keys are available: ESCAPE:
Exit test ARROW Keys: Move window
when in non-fullscreen mode L:
List selectable display modes 0-8:
Selection of display modes F:
Toggle fullscreen SHIFT-F:
Toggle fullscreen with
Display.destroy()/create() cycle
Exception in thread "main"
java.lang.UnsatisfiedLinkError: no
lwjgl in java.libr ary.path
at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1734)
at java.lang.Runtime.loadLibrary0(Runtime.java:823)
at java.lang.System.loadLibrary(System.java:1028)
at org.lwjgl.Sys$1.run(Sys.java:73)
at java.security.AccessController.doPrivileged(Native
Method)
at org.lwjgl.Sys.doLoadLibrary(Sys.java:66)
at org.lwjgl.Sys.loadLibrary(Sys.java:82)
at org.lwjgl.Sys.(Sys.java:99)
at org.lwjgl.opengl.Display.(Display.java:130)
at org.lwjgl.test.WindowCreationTest.initialize(WindowCreationTest.java:
82)
at org.lwjgl.test.WindowCreationTest.main(WindowCreationTest.java:286)
C:\Users\Nestor\Downloads\lwjgl-2.6\lwjgl-2.6>
Why am I getting that error? I don't understand why there should be linking errors. In the command that I attempted to execute it clearly spells out the path to those native dll's it needs:
C:\Users\Nestor\Downloads\lwjgl-2.6\lwjgl-2.6>java
-cp .;res;jar\lwjgl.jar;jar\ lwjgl_test.jar;jar\lwjgl_util.jar;jar\lwjgl_fmod3.jar;jar\lwjgl_devil.jar;jar\ji
nput.jar;-Djava.library.path=native\windows
org.lwjgl.test.WindowCreationTest
I've confirmed that the relative path "native\windows" contains those dependencies:
C:\Users\Nestor\Downloads\lwjgl-2.6\lwjgl-2.6\native\windows>dir
Volume in drive C has no label.
Volume Serial Number is 2061-75F6
Directory of C:\Users\Nestor\Downloads\lwjgl-2.6\lwjgl-2.6\native\windows
11/24/2010 12:35 AM .
11/24/2010 12:35 AM ..
10/18/2010 08:44 PM 31,232 jinput-dx8.dll
10/18/2010 08:44 PM 65,024 jinput-dx8_64.dll
10/18/2010 08:44 PM 29,696 jinput-raw.dll
10/18/2010 08:44 PM 62,464 jinput-raw_64.dll
10/18/2010 08:44 PM 197,120 lwjgl.dll
10/18/2010 08:44 PM 305,664 lwjgl64.dll
10/18/2010 08:44 PM 56,832 OpenAL32.dll
10/18/2010 08:44 PM 157,184 OpenAL64.dll
8 File(s) 905,216 bytes
2 Dir(s) 155,163,058,176 bytes free
Can anyone help point out what I'm doing wrong? Can anyone reproduce this by downloading the LWJGL library and attempting to run the test command given in the installation instructions?
It seems that you do not have a space between your classpath argument (-cp jar1.jar;jar2.jar) and your system property setting (-D..).
E.g. your classpath looks like this-cp .;res;jar\lwjgl.jar;jar\lwjgl_test.jar;jar\lwr...;-Djava.library.path=native\windows. This way java will interpret your property setting of native library path argument like a classpath!
Just add a space between those arguments and you should be up and running, this is the corrected command (also tested on Windows 7):
java -cp jar\lwjgl.jar;jar\lwjgl_test.jar;jar\lwjgl_util.jar -Djava.library.path=native\windows org.lwjgl.test.WindowCreationTest
Note that I removed the unused jars from the classpath since you only want to run the WindowCreationTest example.
Check again that directory
C:\Users\Nestor\Downloads\lwjgl-2.6\lwjgl-2.6\native\windows
exists and contains lwjgl.dll and lwjglaudio.dll
I believe that something is wrong with your installation, i.e. the directory does not exist or files are not there.
Just throwing this out there, because Ive had some issues related to this. Go to your Java/JRE/BIN folder. Right click on Java, and go to properties. Under Privilege Level, check the box by run as an administrator.