Cannot Find getWindow(Applet) in netscape.javascript.JSObject - java

I am trying to call JavaScript functions from a JApplet. I've searched through tutorials and they say that I need to import and use netscape.javascript.* from my \jre\lib\plugin.jar
I did import netscape.javascript.* and I'm using DrJava, and it kept saying it cannot find the getWindow method.
This is the error it gives me:
(MinesweeperApplet extends JApplet)
Error: cannot find symbol
symbol: method getWindow(MinesweeperApplet)
location: class netscape.javascript.JSObject
This is the piece of code inside the MinesweeperApplet class where I am trying to get the JSObject:
public void start(){
// add stuff
JSObject window = JSObject.getWindow(this);
Container cp = getContentPane();
...
I appreciate any help. Thanks!

I have found the "solution."
Previously I was using JDK 7. Then I downloaded and tried JDK 6 (update 45) and it could compile fine. And from that point on, the Java-to-Javascript communication works.

Related

java.lang.NoClassDefFoundError ... (wrong name: ....)

I know there are already several posts about this but I couldn't make any sense of them.
I have build a custom DateSpinner with a MVC pattern:
package my.app.myDateSpinner // public class MyDateSpinner
package my.app.myDateSpinner.controller // public class MyDateSpinnerController
package my.app.myDateSpinner.model // public class MyDateSpinnerModel
package my.app.myDateSpinner.view // public class MyDateSpinnerView
The code is located in:
c:\My Code\src\my\app\myDateSpinner
I'm using Dr.Java and I have added to the classpath:
C:\My Code\src
Now I am trying to use it on another project. In order to do that I use:
import my.app.myDateSpinner.*;
It compiles without any problem but I get the following error during runtime:
java.lang.NoClassDefFoundError: my/app/myDateSpinner/view/MyDateSpinnerView (wrong name: MyDateSpinnerView)
I don't understand why I am getting this error from MyDateSpinnerView and not from MyDateSpinnerModel or MyDateSpinnerController and I don't know how to solve it.
I've found the problem. It was the IDE (Dr. Java).
I am not sure what happend but today when I opened it, it crashed. Then, I opened it again and all the settings were set to default. I had to set all the preferences again and everything worked just fine.

IBM Watson Visual Recognition in Java training classifier error

So I want to make a java application in eclipse which the user i will be able to import .zip files. Each .zip file will represent a cat breed. I will click on a "train" button and my program will contact IBM Watson services and create a classifier. Then from a different window, i will import random cat images and the program will show what cat breed is in the image. Everything with the SDKs is fine since I ran some examples from the official Watson site and everything ran smoothly. Problem comes when I try to create my own classifiers. The code you are about to see is also from their site. For some reason the createClassifier method won't take the CreateClassifierOptions object as an argument.
import java.io.File;
import com.ibm.watson.developer_cloud.http.ServiceCall;
import com.ibm.watson.developer_cloud.speech_to_text.v1.model.RecognitionCallback;
import com.ibm.watson.developer_cloud.visual_recognition.v3.*;
import com.ibm.watson.developer_cloud.visual_recognition.v3.model.*;
public class TrainningClassifier{
public static void main(String[] args) {
VisualRecognition service = new VisualRecognition(
VisualRecognition.VERSION_DATE_2016_05_20
);
service.setApiKey("aca4433597018de62edafdeebceb2bdc1482496a");
CreateClassifierOptions createClassifierOptions = new CreateClassifierOptions.Builder()
.name("dogs")
.addClass("beagle", new File("./beagle.zip"))
.addClass("goldenretriever",new File("./golden-retriever.zip"))
.addClass("husky", new File("./husky.zip"))
.negativeExamples(new File("./cats.zip"))
.build();
Classifier dogs = service.createClassifier(createClassifierOptions).execute();
System.out.println(dogs); /*error is in the above line.
the createClassifier method.*/
}
}
Error: Exception in thread "main" java.lang.Error: Unresolved
compilation problem: The method createClassifier(ClassifierOptions)
in the type VisualRecognition is not applicable for the arguments
(CreateClassifierOptions)
at testVisualRec.ForAssignment.main(ForAssignment.java:31)
Any ideas?
Found the solution. For some reason eclipse wouldn't recommend this solution I had to experiment. I just added throws IOException in main method. I also put inside the main method System.out.println(new File(".").getAbsoluteFile()); to make sure the path was correct, and it was. (SDK used for this project is 4.0.0, not the newest one. SDK found here: https://github.com/watson-developer-cloud/java-sdk/releases)

Using FileFilter in Netbeans

I'm using this tutorial to add a File Chooser in a Netbeans project:
https://netbeans.org/kb/docs/java/gui-filechooser.html
I'm not using the project that they set up, but have followed the File Chooser part of the tutorial exactly as written.
I just can't get the FileFilter to work though. I get the following error on this line in initComponents() :
FileChooser.setFileFilter(MyCustomFilter());
It throws the error:
error: cannot find symbol
FileChooser.setFileFilter(MyCustomFilter()); symbol: method MyCustomFilter() location: class frmMain
I have tried placing the code for the MyCustomFilter class under the imports at the top (as suggested in the tutorial) and at various other points in the code, but with no success.
Where exactly should this code go? Any other reasons why I am getting this error? To reiterate, I am following the tutorial from the "Adding the File Chooser" section downwards and copying and pasting the code.
Call the constructor using the new keyword
fileChooser.setFileFilter(new MyCustomFilter());

Can't use jar library in my java file

Sorry for this noobie question, I'm new to Java, and instead of using IDE, i want to using command line to learn what's running under the hood
I'm following the Getting Started guild on MigLayout
#MigWindow.java
public class MigWindow {
public static void main(){
javax.swing.JPanel panel = new javax.swing.JPanel(new MigLayout());// a simple line to make sure the library jar import correctly
}
}
and compile with these command:
javac -cp ./MigLayout.jar MigWindow.java
and I got a error:
MigWindow.java:3: cannot find symbol
symbol : class MigLayout
location: class MigWindow
javax.swing.JPanel panel = new javax.swing.JPanel(new MigLayout());
^
1 error
It seems the jar library doesn't import correctly, any idea?
~
Make sure you add the import for MigLayout
import net.miginfocom.swing.MigLayout;
It may sound obvious, but make sure MigLayout.jar the current directory when calling javac here and that your JAR file has not been corrupted.
Update:
To check that your JAR file does contain the class you can do:
jar tvf MigLayout.jar
and check for the MigLayout class. Failing to find the class you can download the correct one from here.
You are missing an import statement in your Source File. The compiler does not know where 'MigLayout' is coming from.
Add at the top of your file, but below of your package statement (if any) an import, e.g.
import package.MigLayout;
This tells the compiler what to import from the given class path. You will need to replace package with the correct package.

How to get JOGL on Ubuntu 11.10 to work

any help greatly appreciated.
Problem: Ubuntu 11.10 not playing nice with Java's JOGL
Summary of what has been established:
JDK ok
Environment variables ok
JOGL Jars and lib ok
Test file used ok
Very unlikely to be EBKAC
file permissions ok
Problem caused by Ubuntu 11.10, (can has help?)
Potential solution - how do you install libjogl-java_1.1.1+dak1.orig.tar.gz ?
Details of what has been established:
JOGL was working fine with Ubuntu 11.04. Test file "T1.java" displayed a wireframe cube correctly.
After updating Ubuntu to 11.10, when run in Eclipse the JOGL frame always froze not showing any JOGL goodness.
I tried running a Java applet to check if java was broken, it worked fine. Java not broken.
Checked my jogl user library in Eclipse, looks fine. Native library set correctly for all jars.
I tried running the file in a terminal
cd ~/workspace/projectname/src/packagename/
javac T1.java
and got 32 errors complaining that the packages could not be found. At this point I realised this is NOT an eclipse problem.
I changed environment variables at /etc/environment and /etc/profile, such that running:
echo $PATH
echo $CLASSPATH
and
echo $JAVA_HOME
all display ~/librambo/jar and ~/librambo/lib as they should (plus the JDK correctly appeared in PATH)
(~/librambo is /home/rambo/librambo , rambo = username)
I tried putting the simple "T1.java" inside ~/librambo/jar and javac 'ing it from there, same problem. Then I tried:
javac -classpath jogl.all.jar T1.java
to determine if it would reduce the number of errors, and it claimed "error reading jogl.all.jar; error in opening zip file"
After extracting the jar file, it compiled but would not run. Running
ldd *.so
in the terminal, I saw it lacked "libjawt.so", as it complained "not found".
After finding that library file and copying it into the ~/librambo/jar folder, it (ldd *.so) then complained about several other library packages, such as libmawt.so, libjvm.so etc. After they also joined the horrendous pool of files congregating in ~/librambo/jar, upon ldd'ing again it complained it could now not find libjawt.so - but I just 'fixed' that problem...
I also "gksu nautilus" 'd my way over to them jar files, and set their permissions to read/write for all users, and allowed them to be ran as executables.
I had been using sun-java-6, so in paranoia I decided to remove the other java SDKs in /usr/lib/jvm to prevent interference from there being too many jar files confusing it. Same problem. Installed JDK1.7.0, cleared out ~/librambo/jar leaving only the 4 jars (and T1.java), wouldn't compile - same 32 errors again. (I used "sudo update-alternatives --config java" to set the java version, I used java -version to check what version I'm using so thats not the problem =p)
THis time downloaded jogl-linux-amd64.7z fresh, within it opened java-jogl-src.zip and copied the contents to /~librambo/jar again to see if I could just get it to work in this folder, 100 errors because the directory structure didn't match.
I have trawled much internets looking for answers for days, and I think I may finally have found it:
https://launchpad.net/ubuntu/oneiric/+source/libjogl-java/1.1.1+dak1-10
it says in the change log "Update the patch to set java.library.path" which is in keeping with an error I encountered (at some point). Unfortunately, when I download libjogl-java_1.1.1+dak1.orig.tar.gz and opened it, I realised I have no idea what I'm supposed to be doing with the contents. Could anyone tell me what to do to 'install' them?
Alternatively, here is the appendix, which contains the file hierarchy, /etc/environment setup, the 32 errors output, and a list of references which I have checked already.
////////////////////////////////////////
APPENDIX
////////////////////////////////////////
FILE HIERARCHY
/home/rambo/librambo/jar/ gluegen-rt.jar
/home/rambo/librambo/jar/ jogl.all.jar
/home/rambo/librambo/jar/ jogl-all-natives-linux-amd64.jar
/home/rambo/librambo/jar/ newt.event.jar
/home/rambo/librambo/jar/ T1.java #and a host of other files, have since been removed, thus the 32 errors came back.
/home/rambo/librambo/lib/ libgluegen-rt.so
/home/rambo/librambo/lib/ libjogl_desktop.so
/home/rambo/librambo/lib/ libjogl_mobile.so
/home/rambo/librambo/lib/ libnativewindow_awt.so
/home/rambo/librambo/lib/ libnativewindow_x11.so
/home/rambo/librambo/lib/ libnewt.so
ENVIRONMENT VARIABLES
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:~/.rvm/bin:/home/rambo/librambo/jar:/home/rambo/librambo/lib:/usr/lib/jvm/jdk1.7.0/bin:/usr/lib/jvm/jdk1.7.0/lib:/usr/lib/jvm/jdk1.7.0/jre/lib/amd64"
JAVA_HOME="/usr/lib/jvm/jdk1.7.0/bin:/usr/lib/jvm/jdk1.7.0/lib:/usr/lib/jvm/jdk1.7.0/jre/lib/amd64:/home/rambo/librambo/jar:/home/rambo/librambo/lib"
CLASSPATH="/usr/lib/jvm/jdk1.7.0/bin:/usr/lib/jvm/jdk1.7.0/lib:/usr/lib/jvm/jdk1.7.0/jre/lib/amd64:/home/rambo/librambo/jar:/home/rambo/librambo/lib"
32 ERRORS
rambo#rambo-ThinkPad-SL510:~/librambo/jar$ javac T1.java
T1.java:3: package javax.media.opengl does not exist
import javax.media.opengl.*;
^
T1.java:4: package javax.media.opengl.awt does not exist
import javax.media.opengl.awt.GLCanvas;
^
T1.java:5: package com.jogamp.opengl.util does not exist
import com.jogamp.opengl.util.*;
^
T1.java:6: package javax.media.opengl.glu does not exist
import javax.media.opengl.glu.GLU;
^
T1.java:7: package com.jogamp.opengl.util.gl2 does not exist
import com.jogamp.opengl.util.gl2.GLUT;
^
T1.java:9: cannot find symbol
symbol: class GLEventListener
public class T1 extends Frame implements GLEventListener, ActionListener {
^
T1.java:17: cannot find symbol
symbol : class GLCanvas
location: class T1
private GLCanvas canvas;
^
T1.java:75: cannot find symbol
symbol : class GLAutoDrawable
location: class T1
public void display(GLAutoDrawable drawable) {
^
T1.java:81: cannot find symbol
symbol : class GLAutoDrawable
location: class T1
public void dispose(GLAutoDrawable drawable) {
^
T1.java:85: cannot find symbol
symbol : class GLAutoDrawable
location: class T1
public void init (GLAutoDrawable drawable) {
^
T1.java:92: cannot find symbol
symbol : class GLAutoDrawable
location: class T1
public void reshape (GLAutoDrawable drawable, int x, int y, int width, int height) {
^
T1.java:115: cannot find symbol
symbol : class GLU
location: class Scene
private GLU glu = new GLU();
^
T1.java:116: cannot find symbol
symbol : class GLUT
location: class Scene
private GLUT glut = new GLUT();
^
T1.java:133: cannot find symbol
symbol : class GL2
location: class Scene
public void render(GL2 gl) {
^
T1.java:145: cannot find symbol
symbol : class GL2
location: class Scene
private void drawAxes(GL2 gl) {
^
T1.java:20: cannot find symbol
symbol : variable GLProfile
location: class T1
GLProfile.initSingleton(true);
^
T1.java:29: cannot find symbol
symbol : class GLProfile
location: class T1
GLProfile glp = GLProfile.getDefault();
^
T1.java:29: cannot find symbol
symbol : variable GLProfile
location: class T1
GLProfile glp = GLProfile.getDefault();
^
T1.java:30: cannot find symbol
symbol : class GLCapabilities
location: class T1
GLCapabilities caps = new GLCapabilities(glp);
^
T1.java:30: cannot find symbol
symbol : class GLCapabilities
location: class T1
GLCapabilities caps = new GLCapabilities(glp);
^
T1.java:31: cannot find symbol
symbol : class GLCanvas
location: class T1
canvas = new GLCanvas(caps);
^
T1.java:56: cannot find symbol
symbol : class FPSAnimator
location: class T1
FPSAnimator animator = new FPSAnimator(canvas, 60);
^
T1.java:56: cannot find symbol
symbol : class FPSAnimator
location: class T1
FPSAnimator animator = new FPSAnimator(canvas, 60);
^
T1.java:76: cannot find symbol
symbol : class GL2
location: class T1
GL2 gl = drawable.getGL().getGL2();
^
T1.java:86: cannot find symbol
symbol : class GL2
location: class T1
GL2 gl = drawable.getGL().getGL2();
^
T1.java:93: cannot find symbol
symbol : class GL2
location: class T1
GL2 gl = drawable.getGL().getGL2();
^
T1.java:99: cannot find symbol
symbol : variable GL2
location: class T1
gl.glMatrixMode(GL2.GL_PROJECTION);
^
T1.java:108: cannot find symbol
symbol : variable GL2
location: class T1
gl.glMatrixMode(GL2.GL_MODELVIEW);
^
T1.java:115: cannot find symbol
symbol : class GLU
location: class Scene
private GLU glu = new GLU();
^
T1.java:116: cannot find symbol
symbol : class GLUT
location: class Scene
private GLUT glut = new GLUT();
^
T1.java:134: cannot find symbol
symbol : variable GL2
location: class Scene
gl.glClear(GL2.GL_COLOR_BUFFER_BIT);
^
T1.java:148: cannot find symbol
symbol : variable GL2
location: class Scene
gl.glBegin(GL2.GL_LINES);
^
32 errors
REFERENCES
(Truncated list)
http://www.leolol.com/drupal/game-programming
Ant build classpath jar generates "error in opening zip file"
http://forum.worldwindcentral.com/archive/index.php?t-10146.html
(Jogamp wiki pages, for installing Jogamp on Ubuntu 64bit)
JOGL does not work after reinstalling ubuntu
A graphics lecturer at my University
T** C*******, (anonymous) Vi wielding TDDaholic
http://www.google.com
////////////////////////////////////////
UPDATES
////////////////////////////////////////
DAY 5 of java jogl headache update
PROGRESS!! =D
Now only 20 errors related to... Android? =S
So I started a new folder /home/rambo/libme
I downloaded:
jogl-linux-amd64.7z 16-Sep-2011 13:50 7.0M
gluegen-linux-amd64.7z 16-Sep-2011 04:53 735K
from:
http://jogamp.org/deployment/jogamp-current/archive/jogamp-linux-amd64/
This time, i unpacked the 7zip files and saw a src zip folder in each. I copied the contents of both into libme, there were no overwrites - they share a similar folder structure though.
Then I changed the environment variables to point at libme. Then I moved T1.java into libme. Javac of T1 within libme gave the following complaint:
rambo#rambo-ThinkPad-SL510:~/libme$ javac T1.java
/home/rambo/libme/jogamp/common/os/android/PackageInfoUtil.java:30: package android.content does not exist
import android.content.*;
^
/home/rambo/libme/jogamp/common/os/android/PackageInfoUtil.java:31: package android.content.pm does not exist
import android.content.pm.*;
^
/home/rambo/libme/jogamp/common/os/android/PackageInfoUtil.java:32: package android.util does not exist
import android.util.Log;
^
/home/rambo/libme/jogamp/common/os/android/PackageInfoUtil.java:37: cannot find symbol
symbol : class PackageInfo
location: class jogamp.common.os.android.PackageInfoUtil
public static final PackageInfo getPackageInfo(String packageName) {
^
/home/rambo/libme/jogamp/common/os/android/PackageInfoUtil.java:41: cannot find symbol
symbol : class Context
location: class jogamp.common.os.android.PackageInfoUtil
public static final PackageInfo getPackageInfo(Context ctx, String packageName) {
^
/home/rambo/libme/jogamp/common/os/android/PackageInfoUtil.java:41: cannot find symbol
symbol : class PackageInfo
location: class jogamp.common.os.android.PackageInfoUtil
public static final PackageInfo getPackageInfo(Context ctx, String packageName) {
^
/home/rambo/libme/jogamp/common/os/android/StaticContext.java:30: package android.content does not exist
import android.content.*;
^
/home/rambo/libme/jogamp/common/os/android/StaticContext.java:31: package android.util does not exist
import android.util.Log;
^
/home/rambo/libme/jogamp/common/os/android/StaticContext.java:34: cannot find symbol
symbol : class Context
location: class jogamp.common.os.android.StaticContext
private static Context context = null;
^
/home/rambo/libme/jogamp/common/os/android/StaticContext.java:37: cannot find symbol
symbol : class Context
location: class jogamp.common.os.android.StaticContext
public static final synchronized void setContext(Context ctx) {
^
/home/rambo/libme/jogamp/common/os/android/StaticContext.java:41: cannot find symbol
symbol : class Context
location: class jogamp.common.os.android.StaticContext
public static final synchronized Context getContext() {
^
/home/rambo/libme/jogamp/common/os/android/PackageInfoUtil.java:44: cannot find symbol
symbol : class PackageInfo
location: class jogamp.common.os.android.PackageInfoUtil
final PackageInfo pi = ctx.getPackageManager().getPackageInfo(packageName, PackageManager.GET_META_DATA);
^
/home/rambo/libme/jogamp/common/os/android/PackageInfoUtil.java:44: cannot find symbol
symbol : variable PackageManager
location: class jogamp.common.os.android.PackageInfoUtil
final PackageInfo pi = ctx.getPackageManager().getPackageInfo(packageName, PackageManager.GET_META_DATA);
^
/home/rambo/libme/jogamp/common/os/android/PackageInfoUtil.java:45: cannot find symbol
symbol : variable Log
location: class jogamp.common.os.android.PackageInfoUtil
if(DEBUG) Log.d(MD.TAG, "getPackageInfo("+packageName+"): "+pi);
^
/home/rambo/libme/jogamp/common/os/android/PackageInfoUtil.java:47: cannot find symbol
symbol : variable Log
location: class jogamp.common.os.android.PackageInfoUtil
} catch (Exception e) { if(DEBUG) { Log.d(MD.TAG, "getPackageInfo("+packageName+")", e); } }
^
/home/rambo/libme/jogamp/common/os/android/PackageInfoUtil.java:49: cannot find symbol
symbol : variable Log
location: class jogamp.common.os.android.PackageInfoUtil
if(DEBUG) Log.d(MD.TAG, "getPackageInfo("+packageName+"): NULL");
^
/home/rambo/libme/jogamp/common/os/android/PackageInfoUtil.java:54: cannot find symbol
symbol : class PackageInfo
location: class jogamp.common.os.android.PackageInfoUtil
final PackageInfo pInfo = getPackageInfo(packageName);
^
/home/rambo/libme/jogamp/common/os/android/PackageInfoUtil.java:58: cannot find symbol
symbol : class PackageInfo
location: class jogamp.common.os.android.PackageInfoUtil
final PackageInfo pInfo = getPackageInfo(packageName);
^
/home/rambo/libme/jogamp/common/os/android/PackageInfoUtil.java:60: cannot find symbol
symbol : variable Log
location: class jogamp.common.os.android.PackageInfoUtil
if(DEBUG) Log.d(MD.TAG, "getPackageInfoVersionName("+packageName+"): "+s);
^
/home/rambo/libme/jogamp/common/os/android/StaticContext.java:38: cannot find symbol
symbol : variable Log
location: class jogamp.common.os.android.StaticContext
if(DEBUG) Log.d(MD.TAG, "setContext("+ctx+")");
^
Note: /home/rambo/libme/javax/media/opengl/awt/GLCanvas.java uses or overrides a deprecated API.
Note: Recompile with -Xlint:deprecation for details.
Note: Some input files use unchecked or unsafe operations.
Note: Recompile with -Xlint:unchecked for details.
20 errors
Deleting the android folder didn't help.
(If i use just the jogl src and not the gluegen, it gives 100 errors. Adding the source from joal does nothing either)
openGL test
rambo#rambo-ThinkPad-SL510:~$ /usr/lib/nux/unity_support_test -p
OpenGL vendor string: ATI Technologies Inc.
OpenGL renderer string: ATI Mobility Radeon HD 4500 Series
OpenGL version string: 3.3.11005 Compatibility Profile Context
Not software rendered: yes
Not blacklisted: yes
GLX fbconfig: yes
GLX texture from pixmap: yes
GL npot or rect textures: yes
GL vertex program: yes
GL fragment program: yes
GL vertex buffer object: yes
GL framebuffer object: yes
GL version is 1.4+: yes
Unity 3D supported: yes
I fixed it! =D
Are YOU suffering the same problem?
Symptoms
Have followed an excellent guide similar to: https://sites.google.com/site/justinscsstuff/jogl-tutorial-1 or http://www.leolol.com/drupal/game-programming
Eclipse opens a window but displays no openGL and the window hangs
The CLASSPATH and JAVA_HOME and PATH variables are all ok
It makes no sense, it should work
Cure
Hold onto your pantaloons, you're in for one wild night.
#_# "A thousand libraries, of the JOGL empire, descend upon you. Our JUnit tests, will blot out the sun"
¬_¬ "Then we will code in the shade"
Enter the following into a Terminal
sudo apt-get install gcc libgl1-mesa-dev libglu1-mesa-dev xorg-dev libice-dev libsm-dev libx11-dev libxext-dev libxxf86vm-dev libxinerama-dev libxrandr-dev libxrender-dev
sudo add-apt-repository ppa:eclipse-team/debian-package
sudo apt-get update
sudo apt-get install ant
It is assumed you use "git", if not then get it (google search, install). This guide was written for Java 1.7 (UPDATE: and Java 1.6), you can check your java version by typing
java -version
into the terminal. To change your default java version, type
sudo update-alternatives --config java
into the terminal - it displays the java versions you have installed, to choose from. Handy guides:
http://www.cyberciti.biz/faq/howto-ubuntu-linux-install-configure-jdk-jre/
https://help.ubuntu.com/community/Java
Now its Jogl time. Make a folder to put the source code to jogl onto your computer 0_0. For no particular reason, I will name the folder "hera" and put it into my home directory.
cd ~
mkdir hera
cd hera/
git clone git://jogamp.org/srv/scm/gluegen.git gluegen
git clone git://jogamp.org/srv/scm/jogl.git jogl
then goto ~/hera/jogl/doc/HowToBuild.html and it will tell you the next steps, though read these "how to build notes":
how to build notes
These are guide notes to the guide notes for JOGL, which you just GIT cloned into your computer at ~/hera/jogl/doc/HowToBuild.html
Advanced Users: It is important to note that "source /etc/environment" in insufficient when changing the environment variables in this case; in simples that means you need to do the next command to change your PATH (and other variables), LOG OUT and then LOG IN again to your Ubuntu.
gksu gedit /etc/environment
That command opens up your environment variables. Time for exterminatus. Remove all traces of ANYTHING java-like, including paths to SDKs. CLASSPATH and JAVA_HOME need to be deleted (copy them somewhere else so you can put them back later). You should have something like:
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:~/.rvm/bin
Notice the no java there. Save and close. Log out, log in. Then check it worked with:
echo $PATH
If you see any java goodness despite the log out -> in, then "gksu gedit /etc/profile" and see if you have any "export" statements lingering in there which refer to PATH or CLASSPATH or JAVA_HOME. If nothing there... check ".bashrc" in home?
Advanced Users: The next paragraph goes through the building of Jogl. The Java version you use to do the building of Jogl is significant; it is the Java version your code will have to be to use it. If you want to develop projects (which use Jogl) in Java 1.6 and Java 1.7, then you'll need separate folders with separate builds of Jogl - for example "~/hera/" built with Java 1.7, "~/zeus/" built with Java 1.6.
Assuming everything is okay and there are no java paths showing, continue with the HowToBuild.html. I didn't change the optional build properties. Do the "ant" build thing the guide refers to. If you do the JUnit testing, it takes about 30mins, and appears to freeze a few times and not use any CPU. This is ok, just leave it for a while.
If the test doesn't work, it could potentially be because your unfortunate timing meant you've pulled a broken build. You can wait and git pull (from hera), or SHA1 your way back a few PUSHes.
Finally
Assuming you're using eclipse. Delete your old jogl user library that you made (if you made one). I also recommend starting a fresh project. Follow the guide (e.g. https://sites.google.com/site/justinscsstuff/jogl-tutorial-1 or http://www.leolol.com/drupal/game-programming) as normal, the following jars can be found in ~/hera/jogl/build/jar/ (If you're using Java 1.6, you'll have to ratch in ~/hera/jogl/builf/jar/atomic)
jogl.all.jar
jogl-all-natives-amd64.jar
newt.event.jar
their Native Library Location is in "~/hera/jogl/build/lib" . Then "gluegen-rt.jar" is found in "~/hera/gluegen/build" , I set the library to be the same one as for the other 3 jars... I suspect the presence of "libgluegen-rt.so" might have been fouling things up, one doesn't seem to need it...
Now your program should run!
At this point, you can put the PATH, CLASSPATH and JAVA_HOME variables back into /etc/environment (which were removed for the ant thing).
Wow, you could save yourself a world of pain by using maven to handle your projects dependencies. See here:
How to make jogl work with intellij idea

Categories

Resources