Hello Guest

[solved] Windows\lwjgl-2.6 sample lesson1 is not working

  • 27 Replies
  • 24724 Views
Re: Windows\lwjgl-2.6 sample lession1 is not working
« Reply #15 on: December 11, 2010, 09:40:52 »
I want to try it with linux/debian (Knoppix). And I don't understand why java doesn't find lwjgl in java.library.path.

Code: [Select]
root@Microknoppix:/media/sda2/java/lwjgl# 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=jar 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.library.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.<clinit>(Sys.java:99)
at org.lwjgl.opengl.Display.<clinit>(Display.java:130)
at org.lwjgl.test.WindowCreationTest.initialize(WindowCreationTest.java:82)
at org.lwjgl.test.WindowCreationTest.main(WindowCreationTest.java:286)
root@Microknoppix:/media/sda2/java/lwjgl# ls -l jar
insgesamt 2305
-rwxr-xr-x 1 root root   4189 18. Okt 21:44 AppleJavaExtensions.jar
-rwxr-xr-x 1 root root 214859 18. Okt 21:44 jinput.jar
-rwxr-xr-x 1 root root 880824 18. Okt 21:44 lwjgl-debug.jar
-rwxr-xr-x 1 root root 867028 18. Okt 21:44 lwjgl.jar
-rwxr-xr-x 1 root root 206493 18. Okt 21:44 lwjgl_test.jar
-rwxr-xr-x 1 root root  31423 18. Okt 21:44 lwjgl_util_applet.jar
-rwxr-xr-x 1 root root 127598 18. Okt 21:44 lwjgl_util.jar
-rwxr-xr-x 1 root root   5762 18. Okt 21:44 lzma.jar
root@Microknoppix:/media/sda2/java/lwjgl#

As you can see it is in. What please is the problem?
Regards. Cottonwood.

Re: Windows\lwjgl-2.6 sample lession1 is not working
« Reply #16 on: December 11, 2010, 10:12:28 »
Wow, it definitely seems like your computer is in tip-top shape.  I wonder if it could be some type of Unicode problem since you're using another language, but that wouldn't make sense.  I really wish that I could recreate the error; this is definitely crazy.   :-\


As for Linux, (1) you're using old files and the old way to test and (2) your java.library.path should be "native/linux" or "./native/linux".  Please read "Testing LWJGL" at the bottom here:
http://lwjgl.org/wiki/index.php?title=Downloading_and_Setting_Up_LWJGL
cool story, bro

Re: Windows\lwjgl-2.6 sample lession1 is not working
« Reply #17 on: December 11, 2010, 10:54:48 »
Thank you. Just a joke in between: The test program org.lwjgl.test.WindowCreationTest is working and as I switched to full screen mode my linux window within the sun virtual box became the size of the WindowCreationTest window. Should be the other way around. :-* :'( ::) ??? ;D ;D ;D ;D ;D ;D ;D (upper picture)

No problem. I reboot from linux cd image and renew the linux hdd installation. So I thought. But it remains that small linux window.

No problem. I have a working XP image. That will help always.

Edit: Now again it is as it should be. (lower picture)
« Last Edit: December 11, 2010, 12:47:11 by Cottonwood »
Regards. Cottonwood.

Re: Windows\lwjgl-2.6 sample lession1 is not working
« Reply #18 on: December 11, 2010, 13:42:22 »
Meanwhile I could test Lesson1 under linux/debian (Knoppix). It works fine:

Code: [Select]
root@Microknoppix:/media/sda2/java/lwjgl# 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/linux Lesson1
OpenAL Tutorial 1 - Single Static Source
[Menu]
p - Play the sample.
s - Stop the sample.
h - Pause the sample.
q - Quit the program.
Input: p
Input: q
root@Microknoppix:/media/sda2/java/lwjgl#

As you can see here, there is only one "Input: " prompt between p and q.
When I tried it under Windows there were more prompts and I had to enter the q twice.
Can that stick together with the termination error?
Regards. Cottonwood.

Re: Windows\lwjgl-2.6 sample lession1 is not working
« Reply #19 on: December 11, 2010, 14:00:41 »
As you can see here, there is only one "Input: " prompt between p and q.
When I tried it under Windows there were more prompts and I had to enter the q twice.
Can that stick together with the termination error?

I noticed that problem on my Windows machine, so I fixed it (very) recently on the tutorial, so I don't think that's the problem, but could have been.  The other way I was doing input shouldn't have caused that crash, as it didn't on my machine.

One thing you could do is try and see if you can catch the exception, but it looks like you can't.  Worth a shot anyway.  Add this code:

Code: [Select]
public static void main(String[] args) {
  try {
    new Lesson1().execute();
  }
  catch(Exception ex) {
    ex.printStackTrace();
  }
}
cool story, bro

Re: Windows\lwjgl-2.6 sample lession1 is not working
« Reply #20 on: December 11, 2010, 14:57:27 »
Sorry. There is no difference.

//Edit:
I noticed that problem on my Windows machine, so I fixed it (very) recently on the tutorial, so I don't think that's the problem, but could have been.  The other way I was doing input shouldn't have caused that crash, as it didn't on my machine.
You're right. The new version didn't touch the problem.
« Last Edit: December 11, 2010, 16:08:41 by Cottonwood »
Regards. Cottonwood.

Re: Windows\lwjgl-2.6 sample lession1 is not working
« Reply #21 on: December 11, 2010, 18:56:20 »
 :-\  Sorry, there's got to be a problem with this Windows machine; it worked on Linux, right?  Search google for "javaw fehler in anwendung" or "javaw application error."  It could be your registry.
cool story, bro

Re: Windows\lwjgl-2.6 sample lession1 is not working
« Reply #22 on: December 11, 2010, 22:08:22 »
Yes, it worked on Linux. But that was what I expected. It has a totally different native code and the error happens within the native code.
I googled for "javaw application error" and found out that that doesn't match my problem.

But I found something else. Someone wrote that it could work with msjava. Are you using Oracle Java too?
Regards. Cottonwood.

Re: Windows\lwjgl-2.6 sample lession1 is not working
« Reply #23 on: December 11, 2010, 23:22:38 »
Yes, I'm using Oracle Java.

Have you tried a Nightly Build or an Older Release?  If it does not crash in 2.5 and it is in fact a native code problem, we'd at least know where to look.  You could also try running Windows in safe mode; worth a shot.  Wish I was more help  :-\
cool story, bro

Re: Windows\lwjgl-2.6 sample lession1 is not working
« Reply #24 on: December 12, 2010, 16:51:34 »
Last night I did a complete check with Kaspersky 11. No problems found.

Today I first tried the Nightly Build as well as the 1.5. Same problem. :(

Then I wanted to try it in safe mode. And Windows began joking with me. My XP was no longer activated. Something like "3 days left for activation - since windows was first activated on this computer, the hardware on the computer has changed significantly. Due to these changes, windows must be reactivated within 3 days-"

And Eclipse coundn't find the OpenAL library:
Code: [Select]
org.lwjgl.LWJGLException: Could not locate OpenAL library.
at org.lwjgl.openal.AL.create(AL.java:153)
at org.lwjgl.openal.AL.create(AL.java:104)
at org.lwjgl.openal.AL.create(AL.java:203)
at Lesson1.execute(Lesson1.java:117)
at Lesson1.main(Lesson1.java:111)

To show you that there is no difference between safe and regular mode I repeated it with a cmd window. This was with a boot in safe mode:
Code: [Select]
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Dokumente und Einstellungen\Admin>d:

D:\>cd java

D:\java>cd lwjgl

D:\java\lwjgl>cd project

D:\java\lwjgl\project>cd lesson1

D:\java\lwjgl\project\lesson1>set Path=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS
\System32\Wbem;C:\Programme\ATI Technologies\ATI.ACE\Core-Static;C:\Programme\Ja
va\jdk1.6.0_22\bin;d:\java\lwjgl\jar;d:\java\lwjgl\native\windows

D:\java\lwjgl\project\lesson1>java Lesson1
org.lwjgl.LWJGLException: Could not locate OpenAL library.
        at org.lwjgl.openal.AL.create(AL.java:153)
        at org.lwjgl.openal.AL.create(AL.java:104)
        at org.lwjgl.openal.AL.create(AL.java:203)
        at Lesson1.execute(Lesson1.java:117)
        at Lesson1.main(Lesson1.java:111)

D:\java\lwjgl\project\lesson1>set
ALLUSERSPROFILE=C:\Dokumente und Einstellungen\All Users
APPDATA=C:\Dokumente und Einstellungen\Admin\Anwendungsdaten
CLASSPATH=.;.;C:\PROGRA~1\JMF21~1.1E\lib\sound.jar;C:\PROGRA~1\JMF21~1.1E\lib\jm
f.jar;C:\PROGRA~1\JMF21~1.1E\lib;D:\java\lwjgl\jar\AppleJavaExtensions.jar;D:\ja
va\lwjgl\jar\jinput.jar;D:\java\lwjgl\jar\lwjgl-debug.jar;D:\java\lwjgl\jar\lwjg
l.jar;D:\java\lwjgl\jar\lwjgl_test.jar;D:\java\lwjgl\jar\lwjgl_util.jar;D:\java\
lwjgl\jar\lwjgl_util_applet.jar;D:\java\lwjgl\jar\lzma.jar;
CLIENTNAME=Console
CommonProgramFiles=C:\Programme\Gemeinsame Dateien
COMPUTERNAME=BRYCECANYON
ComSpec=C:\WINDOWS\system32\cmd.exe
FP_NO_HOST_CHECK=NO
HOMEDRIVE=C:
HOMEPATH=\Dokumente und Einstellungen\Admin
LOGONSERVER=\\BRYCECANYON
NUMBER_OF_PROCESSORS=2
OS=Windows_NT
Path=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Programme\ATI Te
chnologies\ATI.ACE\Core-Static;C:\Programme\Java\jdk1.6.0_22\bin;d:\java\lwjgl\j
ar;d:\java\lwjgl\native\windows
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_IDENTIFIER=x86 Family 15 Model 104 Stepping 2, AuthenticAMD
PROCESSOR_LEVEL=15
PROCESSOR_REVISION=6802
ProgramFiles=C:\Programme
PROMPT=$P$G
SESSIONNAME=Console
SystemDrive=C:
SystemRoot=C:\WINDOWS
TEMP=C:\DOKUME~1\Admin\LOKALE~1\Temp
TMP=C:\DOKUME~1\Admin\LOKALE~1\Temp
USERDOMAIN=BRYCECANYON
USERNAME=Admin
USERPROFILE=C:\Dokumente und Einstellungen\Admin
VBOX_INSTALL_PATH=C:\Programme\Oracle\VirtualBox\
windir=C:\WINDOWS
ZKA_SIG_HOME=C:\Programme\REINER SCT\cyberJack

D:\java\lwjgl\project\lesson1>
And here with regular boot:
Code: [Select]
Microsoft Windows XP [Version 5.1.2600]
(C) Copyright 1985-2001 Microsoft Corp.

C:\Dokumente und Einstellungen\Admin>D:

D:\>cd \java\lwjgl\project\lesson1

D:\java\lwjgl\project\lesson1>set Path=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS
\System32\Wbem;C:\Programme\ATI Technologies\ATI.ACE\Core-Static;C:\Programme\Ja
va\jdk1.6.0_22\bin;d:\java\lwjgl\jar;d:\java\lwjgl\native\windows

D:\java\lwjgl\project\lesson1>
D:\java\lwjgl\project\lesson1>java Lesson1
OpenAL Tutorial 1 - Single Static Source
[Menu]
p - Play the sample.
s - Stop the sample.
h - Pause the sample.
q - Quit the program.
Input: q   <=== at this moment the window with the error message appeared.

D:\java\lwjgl\project\lesson1>set
ALLUSERSPROFILE=C:\Dokumente und Einstellungen\All Users
APPDATA=C:\Dokumente und Einstellungen\Admin\Anwendungsdaten
CLASSPATH=.;.;C:\PROGRA~1\JMF21~1.1E\lib\sound.jar;C:\PROGRA~1\JMF21~1.1E\lib\jm
f.jar;C:\PROGRA~1\JMF21~1.1E\lib;D:\java\lwjgl\jar\AppleJavaExtensions.jar;D:\ja
va\lwjgl\jar\jinput.jar;D:\java\lwjgl\jar\lwjgl-debug.jar;D:\java\lwjgl\jar\lwjg
l.jar;D:\java\lwjgl\jar\lwjgl_test.jar;D:\java\lwjgl\jar\lwjgl_util.jar;D:\java\
lwjgl\jar\lwjgl_util_applet.jar;D:\java\lwjgl\jar\lzma.jar;
CLIENTNAME=Console
CommonProgramFiles=C:\Programme\Gemeinsame Dateien
COMPUTERNAME=BRYCECANYON
ComSpec=C:\WINDOWS\system32\cmd.exe
FP_NO_HOST_CHECK=NO
HOMEDRIVE=C:
HOMEPATH=\Dokumente und Einstellungen\Admin
LOGONSERVER=\\BRYCECANYON
NUMBER_OF_PROCESSORS=2
OS=Windows_NT
Path=C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\Programme\ATI Te
chnologies\ATI.ACE\Core-Static;C:\Programme\Java\jdk1.6.0_22\bin;d:\java\lwjgl\j
ar;d:\java\lwjgl\native\windows
PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH
PROCESSOR_ARCHITECTURE=x86
PROCESSOR_IDENTIFIER=x86 Family 15 Model 104 Stepping 2, AuthenticAMD
PROCESSOR_LEVEL=15
PROCESSOR_REVISION=6802
ProgramFiles=C:\Programme
PROMPT=$P$G
SESSIONNAME=Console
SystemDrive=C:
SystemRoot=C:\WINDOWS
TEMP=C:\DOKUME~1\Admin\LOKALE~1\Temp
TMP=C:\DOKUME~1\Admin\LOKALE~1\Temp
USERDOMAIN=BRYCECANYON
USERNAME=Admin
USERPROFILE=C:\Dokumente und Einstellungen\Admin
VBOX_INSTALL_PATH=C:\Programme\Oracle\VirtualBox\
windir=C:\WINDOWS
ZKA_SIG_HOME=C:\Programme\REINER SCT\cyberJack

D:\java\lwjgl\project\lesson1>

There is absolutely no difference in the result of the set commands.

Do you have an idea what's to do to run it in safe boot mode?
Regards. Cottonwood.

Re: Windows\lwjgl-2.6 sample lesson1 is not working
« Reply #25 on: December 13, 2010, 17:31:38 »
Now I reduced the code to these statements:
Code: [Select]
import org.lwjgl.LWJGLException;
import org.lwjgl.openal.AL;
 
public class Lesson2 {
    public static void main(String[] args) {
        // Initialize OpenAL
        try{
            AL.create();
        } catch (LWJGLException le) {
            le.printStackTrace();
            return;
        }
    System.out.println("Program terminates.");
    }
}
Even now the error happens. Any idea?
Regards. Cottonwood.

Re: Windows\lwjgl-2.6 sample lesson1 is not working
« Reply #26 on: December 13, 2010, 18:21:18 »
I inserted one more statement at the end of the code: "    AL.destroy();". Now it works.
I found it here: http://lwjgl.org/javadoc/org/lwjgl/openal/AL.html

Can anybody change the sample within the tutorial? Here's the working code:
Code: [Select]
import java.io.FileNotFoundException;
import java.nio.FloatBuffer;
import java.nio.IntBuffer;
import java.util.Scanner;
 
import org.lwjgl.BufferUtils;
import org.lwjgl.LWJGLException;
import org.lwjgl.openal.AL;
import org.lwjgl.openal.AL10;
import org.lwjgl.util.WaveData;
 
public class Lesson1 {
  /** Buffers hold sound data. */
  IntBuffer buffer = BufferUtils.createIntBuffer(1);
 
  /** Sources are points emitting sound. */
  IntBuffer source = BufferUtils.createIntBuffer(1);
 
  /** Position of the source sound. */
  FloatBuffer sourcePos = (FloatBuffer)BufferUtils.createFloatBuffer(3).put(new float[] { 0.0f, 0.0f, 0.0f }).rewind();
 
  /** Velocity of the source sound. */
  FloatBuffer sourceVel = (FloatBuffer)BufferUtils.createFloatBuffer(3).put(new float[] { 0.0f, 0.0f, 0.0f }).rewind();
 
  /** Position of the listener. */
  FloatBuffer listenerPos = (FloatBuffer)BufferUtils.createFloatBuffer(3).put(new float[] { 0.0f, 0.0f, 0.0f }).rewind();
 
  /** Velocity of the listener. */
  FloatBuffer listenerVel = (FloatBuffer)BufferUtils.createFloatBuffer(3).put(new float[] { 0.0f, 0.0f, 0.0f }).rewind();
 
  /** Orientation of the listener. (first 3 elements are "at", second 3 are "up") */
  FloatBuffer listenerOri = (FloatBuffer)BufferUtils.createFloatBuffer(6).put(new float[] { 0.0f, 0.0f, -1.0f,  0.0f, 1.0f, 0.0f }).rewind();
 
  /**
  * boolean LoadALData()
  *
  *  This function will load our sample data from the disk using the Alut
  *  utility and send the data into OpenAL as a buffer. A source is then
  *  also created to play that buffer.
  */
  int loadALData() {
    // Load wav data into a buffer.
    AL10.alGenBuffers(buffer);
 
    if(AL10.alGetError() != AL10.AL_NO_ERROR)
      return AL10.AL_FALSE;
 
    //Loads the wave file from your file system
    /*java.io.FileInputStream fin = null;
    try {
      fin = new java.io.FileInputStream("FancyPants.wav");
    } catch (java.io.FileNotFoundException ex) {
      ex.printStackTrace();
      return AL10.AL_FALSE;
    }
    WaveData waveFile = WaveData.create(fin);
    try {
      fin.close();
    } catch (java.io.IOException ex) {
    }*/
 
    //Loads the wave file from this class's package in your classpath
    WaveData waveFile = WaveData.create("FancyPants.wav");
 
    AL10.alBufferData(buffer.get(0), waveFile.format, waveFile.data, waveFile.samplerate);
    waveFile.dispose();
 
    // Bind the buffer with the source.
    AL10.alGenSources(source);
 
    if (AL10.alGetError() != AL10.AL_NO_ERROR)
      return AL10.AL_FALSE;
 
    AL10.alSourcei(source.get(0), AL10.AL_BUFFER,   buffer.get(0) );
    AL10.alSourcef(source.get(0), AL10.AL_PITCH,    1.0f          );
    AL10.alSourcef(source.get(0), AL10.AL_GAIN,     1.0f          );
    AL10.alSource (source.get(0), AL10.AL_POSITION, sourcePos     );
    AL10.alSource (source.get(0), AL10.AL_VELOCITY, sourceVel     );
 
    // Do another error check and return.
    if (AL10.alGetError() == AL10.AL_NO_ERROR)
      return AL10.AL_TRUE;
 
    return AL10.AL_FALSE;
  }
 
  /**
   * void setListenerValues()
   *
   *  We already defined certain values for the Listener, but we need
   *  to tell OpenAL to use that data. This function does just that.
   */
  void setListenerValues() {
    AL10.alListener(AL10.AL_POSITION,    listenerPos);
    AL10.alListener(AL10.AL_VELOCITY,    listenerVel);
    AL10.alListener(AL10.AL_ORIENTATION, listenerOri);
  }
 
  /**
   * void killALData()
   *
   *  We have allocated memory for our buffers and sources which needs
   *  to be returned to the system. This function frees that memory.
   */
  void killALData() {
    AL10.alDeleteSources(source);
    AL10.alDeleteBuffers(buffer);
  }
 
  public static void main(String[] args) {
    new Lesson1().execute();
  }
 
  public void execute() {
    // Initialize OpenAL and clear the error bit.
    try{
      AL.create();
    } catch (LWJGLException le) {
      le.printStackTrace();
      return;
    }
    AL10.alGetError();
 
    // Load the wav data.
    if(loadALData() == AL10.AL_FALSE) {
      System.out.println("Error loading data.");
      return;
    }
 
    setListenerValues();
 
    // Loop.
    System.out.println("OpenAL Tutorial 1 - Single Static Source");
    System.out.println("[Menu]");
    System.out.println("p - Play the sample.");
    System.out.println("s - Stop the sample.");
    System.out.println("h - Pause the sample.");
    System.out.println("q - Quit the program.");
    char c = ' ';
    Scanner stdin = new Scanner(System.in);
    while(c != 'q') {
      try {
        System.out.print("Input: ");
        c = (char)stdin.nextLine().charAt(0);
      } catch (Exception ex) {
        c = 'q';
      }
 
      switch(c) {
        // Pressing 'p' will begin playing the sample.
        case 'p': AL10.alSourcePlay(source.get(0)); break;
 
        // Pressing 's' will stop the sample from playing.
        case's': AL10.alSourceStop(source.get(0)); break;
 
        // Pressing 'h' will pause the sample.
        case 'h': AL10.alSourcePause(source.get(0)); break;
      };
    }
    killALData();
    AL.destroy();
  }
}

Many thanks to jediTofu.
Regards. Cottonwood.

Re: [solved] Windows\lwjgl-2.6 sample lesson1 is not working
« Reply #27 on: December 13, 2010, 19:57:00 »
Wow, duh, I feel dumb.  I updated the source code on the 1st tutorial.  At least that one is good now.

It's still odd that it happened on your systems and not mine.
cool story, bro