Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 13 of 13

Thread: Porting from Processing IDE to Eclipse

  1. #1
    Junior Member
    Join Date
    Jun 2011
    Posts
    14
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Porting from Processing IDE to Eclipse

    Hi all,

    I am porting a little project I did in Processing PDE (Processing.org) into Eclipse because I want to use full Java functionalities. For those who dont know Processing is a Java based language...pratically speaking it consists of libraries to build 2D/3D interactive graphics and animations.

    The processing.core package contains all processing classes, and I 've imported and built it within my Eclipse project. The PApplet class is the one that contains most of functionalities of Processing. Here is a link with documentation Generated Documentation (Untitled) .

    Now in the Processing PDE when I create multiple classes, they are all treated as "inner classes," meaning they are not individual entities unto themselves, but rather are classes inside of the larger PApplet. This is causing lot of confusion for me now and I don't know how to treat and link all classes together.

    It would br great if someone could have a look and explain me how to correct all errors I get. This is the project file with all classes and libraries http://www.designedbyenergy.com/site/myproject.zip

    In addition, one thing that is not clear to me is to make a global variable accessible to all classes within the Project. Where do I declare global variables? How can I access them from all classes?

    thanks


  2. #2
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Porting from Processing IDE to Eclipse

    a global variable accessible to all classes within the Project
    If you must have global variables, put them all in a class as static and have static methods to get them and to set them.
    To access a global: <type> valueOfVar = GlobalClass.getGlobalVar1();
    where <type> is the data type: int, String etc
    To set: GlobalClass.setGlobalVar1(valueToSave);

    Java has inner classes. Can you explain your problem with a small simple example.

  3. The Following User Says Thank You to Norm For This Useful Post:

    kafka82 (June 3rd, 2011)

  4. #3
    Junior Member
    Join Date
    Jun 2011
    Posts
    14
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: Porting from Processing IDE to Eclipse

    Thanks for the insight about global variables.
    As for the problems Im having now with Eclipse is very simple...lots and lots of unexplicable errors..such as
    Clearly I am mistaking how my classes access method from Processing libraries..I guess...

    Exception in thread "Animation Thread" java.lang.NoClassDefFoundError: javax/media/opengl/glu/GLUtessellatorCallback
    at java.lang.Class.getDeclaredConstructors0(Native Method)
    at java.lang.Class.privateGetDeclaredConstructors(Unk nown Source)
    at java.lang.Class.getConstructor0(Unknown Source)
    at java.lang.Class.getConstructor(Unknown Source)
    at processing.core.PApplet.makeGraphics(Unknown Source)
    at processing.core.PApplet.size(Unknown Source)
    at processing.core.PApplet.size(Unknown Source)
    at Main.setup(Main.java:60)
    at processing.core.PApplet.handleDraw(Unknown Source)
    at processing.core.PApplet.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)
    Caused by: java.lang.ClassNotFoundException: javax.media.opengl.glu.GLUtessellatorCallback
    at java.net.URLClassLoader$1.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.net.URLClassLoader.findClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    ... 11 more

  5. #4
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Porting from Processing IDE to Eclipse

    NoClassDefFoundError: javax/media/opengl/glu/GLUtessellatorCallback
    The JVM can not find the named class.
    Where is the above class's class file? Are you missing a jar file on the classpath?

  6. The Following User Says Thank You to Norm For This Useful Post:

    kafka82 (June 3rd, 2011)

  7. #5
    Junior Member
    Join Date
    Jun 2011
    Posts
    14
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: Porting from Processing IDE to Eclipse

    I see...probably I need to import more jar files..but then how do I know I loaded all needed libraries in my code? is there a way to import them all without typing one by one?

  8. #6
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Porting from Processing IDE to Eclipse

    If the classes are all in the same folder you can use a wildcard: the *
    import java.awt.*;
    This won't get classes from java.awt.event
    You'll need an import for that:
    import java.awt.event.*;

  9. #7
    Junior Member
    Join Date
    Jun 2011
    Posts
    14
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: Porting from Processing IDE to Eclipse

    Mhhhh it s going to be full headaches..

    imported now in the project all opengl related jar files (dont what processing actually uses but I found them inside the processing opegl library folder). The selected files you see in the attached image are jar files .
    They are all in the same folder...but how call them to import in my code?

    import XXXX?

    sorry for crap questions
    Attached Images Attached Images

  10. #8
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Porting from Processing IDE to Eclipse

    how call them to import
    Two places to put references to class files:
    One: put all jar files on the classpath for the javac and java commands
    Two: add import statements to the source for the javac command to use when searching the jar files for classes.

    You can use a zip utility to open a jar file and see its contents.

  11. #9
    Junior Member
    Join Date
    Jun 2011
    Posts
    14
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: Porting from Processing IDE to Eclipse

    I am not sure I got what you mean
    I added these line in my source code
    import javax.media.opengl.*;
    import javax.media.opengl.glu.*;

    but still have many errors...at least I found the missing class GLUtessellatorCallback


    Exception in thread "Animation Thread" java.lang.UnsatisfiedLinkError: no jogl in java.library.path
    at java.lang.ClassLoader.loadLibrary(Unknown Source)
    at java.lang.Runtime.loadLibrary0(Unknown Source)
    at java.lang.System.loadLibrary(Unknown Source)
    at com.sun.opengl.impl.NativeLibLoader.loadLibraryInt ernal(NativeLibLoader.java:189)
    at com.sun.opengl.impl.NativeLibLoader.access$000(Nat iveLibLoader.java:49)
    at com.sun.opengl.impl.NativeLibLoader$DefaultAction. loadLibrary(NativeLibLoader.java:80)
    at com.sun.opengl.impl.NativeLibLoader.loadLibrary(Na tiveLibLoader.java:103)
    at com.sun.opengl.impl.NativeLibLoader.access$200(Nat iveLibLoader.java:49)
    at com.sun.opengl.impl.NativeLibLoader$1.run(NativeLi bLoader.java:111)
    at java.security.AccessController.doPrivileged(Native Method)
    at com.sun.opengl.impl.NativeLibLoader.loadCore(Nativ eLibLoader.java:109)
    at com.sun.opengl.impl.windows.WindowsGLDrawableFacto ry.<clinit>(WindowsGLDrawableFactory.java:60)
    at java.lang.Class.forName0(Native Method)
    at java.lang.Class.forName(Unknown Source)
    at javax.media.opengl.GLDrawableFactory.getFactory(GL DrawableFactory.java:106)
    at processing.opengl.PGraphicsOpenGL.allocate(Unknown Source)
    at processing.core.PGraphics3D.setSize(Unknown Source)
    at processing.core.PApplet.makeGraphics(Unknown Source)
    at processing.core.PApplet.size(Unknown Source)
    at processing.core.PApplet.size(Unknown Source)
    at Main.setup(Main.java:63)
    at processing.core.PApplet.handleDraw(Unknown Source)
    at processing.core.PApplet.run(Unknown Source)
    at java.lang.Thread.run(Unknown Source)

  12. #10
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Porting from Processing IDE to Eclipse

    You need to put the jar files on the classpath for both the javac command when you compile the code and for the java command when you execute the code.

  13. #11
    Junior Member
    Join Date
    Jun 2011
    Posts
    14
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Default Re: Porting from Processing IDE to Eclipse

    Thanks for your patience.

    so adding jar files for my libraries and importing them in my code is not enough? How do I check I have both classpath for javac command and java command?

  14. #12
    Super Moderator Norm's Avatar
    Join Date
    May 2010
    Location
    Eastern Florida
    Posts
    25,139
    Thanks
    65
    Thanked 2,720 Times in 2,670 Posts

    Default Re: Porting from Processing IDE to Eclipse

    Sorry, I do NOT know how to use your IDE.
    My IDE uses command lines that I configure for compiles and executions.
    I manually add the -classpath jar1.jar;jar2.jar;... etc to the commandline.

  15. #13
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,318
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: Porting from Processing IDE to Eclipse

    To place the jar on your classpath in eclipse right click the project and go to properties. Select 'java build path' -> libraries -> Add External Jar. Within Eclipse you should then be able to compile and run the code.

Similar Threads

  1. Replies: 24
    Last Post: August 4th, 2014, 12:49 PM
  2. Natural language processing in java
    By nikki. in forum Java Theory & Questions
    Replies: 5
    Last Post: March 19th, 2012, 11:34 PM
  3. Signal processing API.
    By ivanloes in forum Java Theory & Questions
    Replies: 4
    Last Post: December 18th, 2010, 05:56 PM
  4. token-based processing
    By amandat in forum What's Wrong With My Code?
    Replies: 0
    Last Post: October 21st, 2010, 12:05 AM
  5. ERROR WHILE PROCESSING JSF FILE
    By Pankaj in forum JavaServer Pages: JSP & JSTL
    Replies: 3
    Last Post: July 10th, 2010, 12:42 AM