Compile error

Started by dom, November 11, 2004, 15:03:22

Previous topic - Next topic

dom

i'm sure someone has seen this before


>javac -source 1.5 BasicGame.java
BasicGame.java:11: package org.lwjgl does not exist
import org.lwjgl.*;
^
BasicGame.java:12: package org.lwjgl.input does not exist
import org.lwjgl.input.*;
^
BasicGame.java:13: package org.lwjgl.opengl does not exist
import org.lwjgl.opengl.*;
^
BasicGame.java:20: package org.lwjgl.opengl does not exist
import static org.lwjgl.opengl.GL11.*;
                               ^
BasicGame.java:21: package org.lwjgl.opengl.glu does not exist
import static org.lwjgl.opengl.glu.GLU.*;
                                   ^
BasicGame.java:45: cannot find symbol
symbol  : class DisplayMode
location: class BasicGame
                        DisplayMode modes[] = Display.getAvailableDisplayModes()
;
                        ^
BasicGame.java:45: cannot find symbol
symbol  : variable Display
location: class BasicGame
                        DisplayMode modes[] = Display.getAvailableDisplayModes()
;
                                              ^
BasicGame.java:61: cannot find symbol
symbol  : variable Display
location: class BasicGame
                                Display.setDisplayMode(modes[mode]);
                                ^
BasicGame.java:71: cannot find symbol
symbol  : variable Window
location: class BasicGame
                        Window.create("Basic Game Example", 16, 0, 0,0, 0);
                        ^
BasicGame.java:93: cannot find symbol
symbol  : variable Window
location: class BasicGame
                                if(Window.isCloseRequested())
                                   ^
BasicGame.java:98: cannot find symbol
symbol  : variable Window
location: class BasicGame
                                Window.update();
                                ^
BasicGame.java:119: cannot find symbol
symbol  : variable Keyboard
location: class BasicGame
                Keyboard.enableBuffer();
                ^
BasicGame.java:122: cannot find symbol
symbol  : variable GL_PROJECTION
location: class BasicGame
                glMatrixMode(GL_PROJECTION);
                             ^
BasicGame.java:123: cannot find symbol
symbol  : method glLoadIdentity()
location: class BasicGame
                glLoadIdentity();
                ^
BasicGame.java:124: cannot find symbol
symbol  : variable Display
location: class BasicGame
                gluPerspective(45.0f, (float)Display.getWidth() / (float)Display.getHeight(), 1.0f, 200.0f);
                                             ^
BasicGame.java:124: cannot find symbol
symbol  : variable Display
location: class BasicGame
                gluPerspective(45.0f, (float)Display.getWidth() / (float)Display.getHeight(), 1.0f, 200.0f);
                                                                         ^
BasicGame.java:124: cannot find symbol
symbol  : method gluPerspective(float,float,float,float)
location: class BasicGame
                gluPerspective(45.0f, (float)Display.getWidth() / (float)Display.getHeight(), 1.0f, 200.0f);
                ^
BasicGame.java:125: cannot find symbol
symbol  : variable GL_MODELVIEW
location: class BasicGame
                glMatrixMode(GL_MODELVIEW);
                             ^
BasicGame.java:126: cannot find symbol
symbol  : method glLoadIdentity()
location: class BasicGame
                glLoadIdentity();
                ^
BasicGame.java:136: cannot find symbol
symbol  : variable GL_COLOR_BUFFER_BIT
location: class BasicGame
                glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
                        ^
BasicGame.java:136: cannot find symbol
symbol  : variable GL_DEPTH_BUFFER_BIT
location: class BasicGame
                glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
                                              ^
BasicGame.java:136: cannot find symbol
symbol  : method glClear(boolean)
location: class BasicGame
                glClear(GL_COLOR_BUFFER_BIT | GL_DEPTH_BUFFER_BIT);
                ^
BasicGame.java:137: cannot find symbol
symbol  : method glLoadIdentity()
location: class BasicGame
                glLoadIdentity();
                ^
BasicGame.java:149: cannot find symbol
symbol  : variable Keyboard
location: class BasicGame
                for(int i = 0; i < Keyboard.getNumKeyboardEvents(); i++)
                                   ^
BasicGame.java:151: cannot find symbol
symbol  : variable Keyboard
location: class BasicGame
                        Keyboard.next();
                        ^
BasicGame.java:153: cannot find symbol
symbol  : variable Keyboard
location: class BasicGame
                        if(Keyboard.getEventKey() == Keyboard.KEY_ESCAPE && Keyboard.getEventKeyState())
                           ^
BasicGame.java:153: cannot find symbol
symbol  : variable Keyboard
location: class BasicGame
                        if(Keyboard.getEventKey() == Keyboard.KEY_ESCAPE && Keyboard.getEventKeyState())
                                                     ^
BasicGame.java:153: cannot find symbol
symbol  : variable Keyboard
location: class BasicGame
                        if(Keyboard.getEventKey() == Keyboard.KEY_ESCAPE && Keyb
oard.getEventKeyState())
                                                                            ^
BasicGame.java:165: cannot find symbol
symbol  : variable Keyboard
location: class BasicGame
                Keyboard.destroy();
                ^
BasicGame.java:166: cannot find symbol
symbol  : variable Window
location: class BasicGame
                Window.destroy();
                ^
BasicGame.java:170: cannot find symbol
symbol  : variable Display
location: class BasicGame
                        Display.resetDisplayMode();
                        ^
31 errors



help?

princec

The lwjgl.jar does not appear to be in your compiler's classpath.

I advise getting an IDE to do this rather than the commandline. Try Eclipse (www.eclipse.org)

Cas :)

dom

where, exactly, is the classpath?  i read the FAQ and it said to put the jar in the lib\ext folder, but jdk 1.5 doesn't have that folder.  so i just put the jar in the lib folder, but to no avail

dom

i also tried creating the ext folder, still no luck.

about eclipse: i've used it before... it's big and unimpressive.  right now i'm just evaluating lwjgl and the whole concept of java+opengl.  until i decide i really want to use this so far impressive library, the commandline is my ide

dom

that problem has now been resolved, i missed the jre folder.   :oops:

anyways, problems still exist.  here's what i get now
>javac -source 1.5 BasicGame.java
BasicGame.java:49: width has private access in org.lwjgl.opengl.DisplayMode
                                if(modes[i].width == 800
                                        ^
BasicGame.java:50: height has private access in org.lwjgl.opengl.DisplayMode
                                   && modes[i].height == 600
                                           ^
BasicGame.java:51: bpp has private access in org.lwjgl.opengl.DisplayMode
                                   && modes[i].bpp >= 16)
                                           ^
BasicGame.java:71: cannot find symbol
symbol  : variable Window
location: class BasicGame
                        Window.create("Basic Game Example", 16, 0, 0,0, 0);
                        ^
BasicGame.java:93: cannot find symbol
symbol  : variable Window
location: class BasicGame
                                if(Window.isCloseRequested())
                                   ^
BasicGame.java:98: cannot find symbol
symbol  : variable Window
location: class BasicGame
                                Window.update();
                                ^
BasicGame.java:124: cannot find symbol
symbol  : method getWidth()
location: class org.lwjgl.opengl.Display
                gluPerspective(45.0f, (float)Display.getWidth() / (float)Display.getHeight(), 1.0f, 200.0f);
                                                    ^
BasicGame.java:124: cannot find symbol
symbol  : method getHeight()
location: class org.lwjgl.opengl.Display
                gluPerspective(45.0f, (float)Display.getWidth() / (float)Display.getHeight(), 1.0f, 200.0f);

^
BasicGame.java:166: cannot find symbol
symbol  : variable Window
location: class BasicGame
                Window.destroy();
                ^
BasicGame.java:170: resetDisplayMode() has private access in org.lwjgl.opengl.Display
                        Display.resetDisplayMode();
                               ^
10 errors

help again?

Gom Jabbar

It looks like you're using some old tutorial code with a recent version of LWJGL. The Window class for example isn't available anymore.

You might want to check one of the following links to find code that actually works with recent LWJGL releases:

- http://lwjgl.org/wiki/tiki-index.php?page=Basic+Game+Framework
- http://members.rogers.com/mark.bernard/

dom

the first link is just returning errors

as for the second - i downloaded the NeHe tutorials, unzipped tut 1

the jar didn't run by itself, so i extracted it.  i noticed there was a batch file, so i edited it to reflect my configuration....still not getting it.

__________________________________________
although you guys don't have a HUGE community, i'm still disappointed in how long it's taking me to get this running.  i'm not blaming my lack of knowledge in this area on the lwjgl team, i'm blaming my lack of success of compiling and running a simple application on the lack of resources here.  just when i thought i found the correct method, i'm informed that it's old.

how about an up to date readme?  something in the format of ->

install the dll's in *this* folder and the jar in *this* folder to play games

install the dll's in *this* folder and the jar in *this* folder to make games

use *this* command string format to compile programs

use *this* command string format to run programs
__________________________________________________
chances are, such a readme already exists... i just can't find it among older how-tos and incomplete FAQ's.

I'd really like to become a part of the community - i think you guys have a great thing going.

can someone point me in the right direction?

CaptainJester

Quote from: "dom"the jar didn't run by itself, so i extracted it.  i noticed there was a batch file, so i edited it to reflect my configuration....still not getting it.
What problems are you getting?  Did you unzip if with the same directory structure? (I did the conversions for those tutorials, so I might be able to help here)
Quote from: "dom"
__________________________________________
although you guys don't have a HUGE community, i'm still disappointed in how long it's taking me to get this running.  i'm not blaming my lack of knowledge in this area on the lwjgl team, i'm blaming my lack of success of compiling and running a simple application on the lack of resources here.  just when i thought i found the correct method, i'm informed that it's old.

how about an up to date readme?  something in the format of ->

install the dll's in *this* folder and the jar in *this* folder to play games

install the dll's in *this* folder and the jar in *this* folder to make games

use *this* command string format to compile programs

use *this* command string format to run programs
__________________________________________________
chances are, such a readme already exists... i just can't find it among older how-tos and incomplete FAQ's.

I'd really like to become a part of the community - i think you guys have a great thing going.

can someone point me in the right direction?
It is on the WiKi: http://lwjgl.org/ (was just there and it is working)

Look for the link to Installing LWJGL.
The problems of this world cannot possibly be solved by skeptics or cynics whose horizons are limited by the obvious realities.  We need men and women who can dream of things that never were. - John Fitzgerald Kennedy(35th US President)
8)

dom

well i broke down and got Eclipse (3.0.1).

i can't get NeHe ports to run, or the basic game framework to run.

dll's are in
C:\Program Files\Java\jdk1.5.0\jre\bin

jar is in
C:\Program Files\Java\jdk1.5.0\jre\lib\ext

lwjgl added as an external jar in java build path

VM arguments in Eclipse
-Djava.library.path="C:\Program Files\Java\jdk1.5.0\jre\lib\ext"

still get
java.lang.Error: Unresolved compilation problems: 
	Syntax error on token "static", delete this token
	Syntax error on token "static", delete this token
	enum cannot be resolved (or is not a valid type) for the field Game.gameStates
	Syntax error, insert ";" to complete FieldDeclaration
	Syntax error on token ",", delete this token
	Syntax error, insert ";" to complete BlockStatements
	gameStates cannot be resolved (or is not a valid type) for the field Game.gameState
	gameState cannot be resolved
	gameStates cannot be resolved
	gameState cannot be resolved
	gameStates cannot be resolved
	Syntax error on token(s), misplaced construct(s)
	Syntax error on token ")", : expected
	GL_SMOOTH cannot be resolved
	The method glClearColor(float, float, float, float) is undefined for the type Game
	The method glClearDepth(double) is undefined for the type Game
	GL_PERSPECTIVE_CORRECTION_HINT cannot be resolved
	GL_NICEST cannot be resolved
	GL_POLYGON_SMOOTH_HINT cannot be resolved
	GL_NICEST cannot be resolved
	GL_FRONT cannot be resolved
	GL_CULL_FACE cannot be resolved
	gameState cannot be resolved
	gameStates cannot be resolved
	gameState cannot be resolved
	gameStates cannot be resolved
	gameState cannot be resolved
	gameStates cannot be resolved
	gameState cannot be resolved
	gameStates cannot be resolved
	GL_COLOR_BUFFER_BIT cannot be resolved
	GL_DEPTH_BUFFER_BIT cannot be resolved
	GL_PROJECTION cannot be resolved
	The method glLoadIdentity() is undefined for the type Game
	GL_MODELVIEW cannot be resolved
	The method glLoadIdentity() is undefined for the type Game

	at Game.<init>(Game.java:9)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
	at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
	at java.lang.reflect.Constructor.newInstance(Unknown Source)
	at java.lang.Class.newInstance0(Unknown Source)
	at java.lang.Class.newInstance(Unknown Source)
	at sun.applet.AppletPanel.createApplet(Unknown Source)
	at sun.applet.AppletPanel.runLoader(Unknown Source)
	at sun.applet.AppletPanel.run(Unknown Source)
	at java.lang.Thread.run(Unknown Source)

Matzon

1, get the files out of the jre! - look at instructions - they have been updated.

The issues you see is because you need to make the compiler treat it as 1.5 code.

Chman

Compile with 1.5 source code definition :

javac -source 1.5 *.java


Chman

dom

Quote from: "Matzon"1, get the files out of the jre! - look at instructions - they have been updated.

The issues you see is because you need to make the compiler treat it as 1.5 code.

I have read in at least one source that i should put  the files in the JRE; i have read none that say not too.  However, i will take your advice.

c:\lwjgl\*

Quote from: "Chman"Compile with 1.5 source code definition :
javac -source 1.5 *.java

Chman

right... and where do i put that in Eclipse?

Matzon

Project-> Properties -> Java Compiler -> Use Project Settings -> Compliance and Classfiles

I think :) - I am using 1.4 so...

dom

i have jdk and jre1.5 installed... but the only options i get in that window are 1.3 and 1.4

Matzon

right - you need eclipse 3.1 for 1.5 to (partially) work.
Or compile from command line...