Java-Gaming.org    
Featured games (81)
games approved by the League of Dukes
Games in Showcase (489)
Games in Android Showcase (112)
games submitted by our members
Games in WIP (553)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  a noob question about imports  (Read 1770 times)
0 Members and 1 Guest are viewing this topic.
Offline Lunpa

Junior Newbie





« Posted 2009-06-02 04:19:37 »

Hello everyone;


I'm a Debian/Linux user with a moderate prior exposure to Java;  much much earlier today I thought it would be fun to pick up the language again, and what better way to do that than to use a familiar library like opengl, right?

So, I installed java and the jogl stuff from apt (JSR-231, version 1.1.1-1).


These demos run fine on my system:
https://jogl-demos.dev.java.net/

But god forbid they share the source code!  How completely worthless!



So, I've spent the last 3 hours trying to figure out how to import the bloody libs.


Here are some things I've tried:

1  
import net.java.games.jogl.*;


This is met with "error: The import net cannot be resolved".



Oh right.  Fine, lets try this:

1  
import javax.media.opengl.GL;


This is met with "error: The import javax.media cannot be resolved".



and just for good measure (in the console)
1  
locate jogl.jar


which returns: /usr/share/java/jogl.jar


Also, one of the stickies recommends this to verify that things *should* work:
1  
System.loadLibrary("jogl");


Well, that one ran ok!






What am I doing wrong?  This is driving me crazy!
Offline gouessej
« Reply #1 - Posted 2009-06-02 05:39:09 »

Hi!

The JARs and the native libraries have to be in the PATH to allow the JVM to find them to use JOGL properly. I have used JOGL under Debian Linux and I'm currently under Mandriva Linux 2007, it works.

Offline zoto

Senior Member


Medals: 4



« Reply #2 - Posted 2009-06-02 06:55:24 »

Quote
But god forbid they share the source code!  How completely worthless!
From the page you linked:
Quote
The source code for these demonstrations is available via CVS.
The direct link: https://jogl-demos.dev.java.net/source/browse/jogl-demos/trunk/src/demos/
Hope that helps.
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline Lunpa

Junior Newbie





« Reply #3 - Posted 2009-06-02 16:12:47 »

Alright, I got downloaded the demo's from svn;  I also updated my path variable to include the directory which jogl.jar resides.

Attempting to compile the "gears" demo results as so:
"The import javax.media cannot be resolved" etc.

So no dice still.

Random thought:
Do I have to pass some kind of command line switch to javac like I do for c/++ to inform it that I'm using an external library?

What am I doing wrong?  This is driving me nuts.
Offline SimonH
« Reply #4 - Posted 2009-06-02 16:30:25 »

'javax.media' is part of the JMF. Get the latest version from here.

People make games and games make people
Offline Lunpa

Junior Newbie





« Reply #5 - Posted 2009-06-02 16:42:46 »

1  
export CLASSPATH=/usr/share/java/jogl.jar



Adding that to my .bash_rc fixed the problem with the import errors... (rather than appending to my PATH variable.)

But attempting to compile any of the demos results in a swath of other errors.

I give up  Angry

Offline SimonH
« Reply #6 - Posted 2009-06-02 17:02:38 »

Aw, don't give up! Post up the first few lines of the first error you get...

I managed to compile the stuff using;
javac -cp lib/jogl.jar;lib/gluegen-rt.jar -d classes src/*.java

and run it with;
java -Djava.library.path=natives -cp lib/jogl.jar;lib/gluegen-rt.jar;classes; SimpleJOGL (or whatever class)

in other words you need to include the 'lib' folder with jogl & gluegen jars in the compile, and the 'natives' folder and the 'lib' folder in the run.

Well, it worked for me...

People make games and games make people
Offline Lunpa

Junior Newbie





« Reply #7 - Posted 2009-06-02 20:37:43 »

Ah, well... I tried out another java opengl library, and got it working.  I just need an opengl interface to tinker with, I'm not too picky;  this project is just so I can re-familiarize myself with java.

Sorry folks Sad
Offline gouessej
« Reply #8 - Posted 2009-06-03 19:53:26 »

In the worst case, use the dirty way. Copy the JARs of JOGL (jogl.jar and gluegen-rt.jar) in jre/lib/ext and the .so files in jre/lib/i386. Then it will work.

Offline cylab

JGO Ninja


Medals: 43



« Reply #9 - Posted 2009-06-03 20:08:35 »

Or just use Netbeans 6.5.1, the Netbeans OpenGL Pack and one of the provided template projects.... and _don't_ copy anything to your jre unless you _really_ know what you are doing (no offence Lunpa, but in respect to java, I think you aren't there yet Wink)

Mathias - I Know What [you] Did Last Summer!
Games published by our own members! Check 'em out!
Legends of Yore - The Casual Retro Roguelike
Offline bienator

Senior Member




OutOfCoffeeException


« Reply #10 - Posted 2009-06-03 20:49:54 »

In the worst case, use the dirty way. Copy the JARs of JOGL (jogl.jar and gluegen-rt.jar) in jre/lib/ext and the .so files in jre/lib/i386. Then it will work.
gouessej, even if it might work this way, please don't advise this to someone new to java. Putting libraries into the endorsed folders can break everything from applets to a JOGL NetBeans Form designer project and in worst case crash the vm if you start mixing native lib versions.

classpath and library path, thats everything you need to start a jogl/lwjgl app from comandline.

There are already far to many threads out there describing exactly this issue.

Offline Lunpa

Junior Newbie





« Reply #11 - Posted 2009-06-07 06:11:12 »

Or just use Netbeans 6.5.1, the Netbeans OpenGL Pack and one of the provided template projects.... and _don't_ copy anything to your jre unless you _really_ know what you are doing (no offence Lunpa, but in respect to java, I think you aren't there yet Wink)
You're right;  I am totally nowhere near "there" Cheesy

Using netbeans is probably the best solution to this;  I started using the ide with lwjgl. (But ran into a rather stupid snag with lwjgl in regards to how they like textures)

Netbeans is pretty awesome.  In general, I can't stand java, but netbeans makes my grievances very transparent.

So f*** it.  At some point in the future, I'm going to start my project over with netbeans and jogl, but for now I think I'll keep this experience under my hat.


Thank you for your help Smiley  I'm very impressed with this forum of people so far.
Offline gouessej
« Reply #12 - Posted 2009-06-07 12:09:10 »

gouessej, even if it might work this way, please don't advise this to someone new to java. Putting libraries into the endorsed folders can break everything from applets to a JOGL NetBeans Form designer project and in worst case crash the vm if you start mixing native lib versions.
It is better than giving up but you're right, it causes some problems

Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

TehJavaDev (18 views)
2014-08-28 18:26:30

CopyableCougar4 (26 views)
2014-08-22 19:31:30

atombrot (39 views)
2014-08-19 09:29:53

Tekkerue (36 views)
2014-08-16 06:45:27

Tekkerue (33 views)
2014-08-16 06:22:17

Tekkerue (22 views)
2014-08-16 06:20:21

Tekkerue (33 views)
2014-08-16 06:12:11

Rayexar (70 views)
2014-08-11 02:49:23

BurntPizza (47 views)
2014-08-09 21:09:32

BurntPizza (38 views)
2014-08-08 02:01:56
List of Learning Resources
by Longor1996
2014-08-16 10:40:00

List of Learning Resources
by SilverTiger
2014-08-05 19:33:27

Resources for WIP games
by CogWheelz
2014-08-01 16:20:17

Resources for WIP games
by CogWheelz
2014-08-01 16:19:50

List of Learning Resources
by SilverTiger
2014-07-31 16:29:50

List of Learning Resources
by SilverTiger
2014-07-31 16:26:06

List of Learning Resources
by SilverTiger
2014-07-31 11:54:12

HotSpot Options
by dleskov
2014-07-08 01:59:08
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!