We closed this forum 18 June 2010. It has served us well since 2005 as the ALPHA forum did before it from 2002 to 2005. New discussions are ongoing at the new URL http://forum.processing.org. You'll need to sign up and get a new user account. We're sorry about that inconvenience, but we think it's better in the long run. The content on this forum will remain online.
IndexProgramming Questions & HelpIntegration › [eclipse] export jar, Fat Jar, EclipseP5Exporter
Page Index Toggle Pages: 1
[eclipse] export jar, Fat Jar, EclipseP5Exporter (Read 5387 times)
[eclipse] export jar, Fat Jar, EclipseP5Exporter
Sep 12th, 2008, 9:45pm
 
hey all.  i'm having a load of trouble getting my program out to an applet/application.  it's a very simple app, basically just a bare-bones OPENGL program.  i've tried three methods, and none work, though i get some different shades of failure with the different methods.

details on my life's troubles follow.  if anyone has been down this road before and has any suggestions, i'd be VERY thankful....

cheers,
-e

[eclipse Export Jar]
exporting a jar via eclipse's built-in jar exporter, and running the jar from command line, i get:
Exception in thread "main" java.lang.NoClassDefFoundError: processing/core/PApplet

[Fat Jar]
exporting a jar with Fat Jar, the jar launches, but hangs almost immediately (before loading the program), with the error:
Error while running applet.
java.lang.RuntimeException: Before using OpenGL, first select Import Library >opengl from the Sketch menu.
i don't have 'import processing.opengl.*;' in my main class, because it tests fine from within eclipse (jogl's in my build path).  regardless, even if i add it and recompile, i still have the same error.

[EclipseP5Exporter > applet]
exporting an applet with p5Exporter and running the created jar file, i get the same error as with the built-in jar exporter:
Exception in thread "main" java.lang.NoClassDefFoundError: processing/core/PApplet

[Eclipsep5Exporter > application]
exporting an application with p5Exporter, and running the osx app from the command line, the app launches, but hangs in the same way as the Fat Jar, with no feedback in the command line.

exporting an application with p5Exporter, and running the jar file within app/Contents/Resources/Java, i get the same error as with jars created by eclipse's jar exporter and p5Exporter's applet exporter:
Exception in thread "main" java.lang.NoClassDefFoundError: processing/core/PApplet
Re: [eclipse] export jar, Fat Jar, EclipseP5Export
Reply #1 - Sep 12th, 2008, 10:52pm
 
Hi,

I can commiserate, I do all my processing in Eclipse, but rarely have to export to a jar file. When I do, it seems to be an epic struggle just to get the simplest thing working. I put it down to my advancing age and unfamiliarity with jar files and the (ill-defined) environments I work in. If anyone has a good tutorial or explanation for how to fool-proof export Processing/Jar files I'd be interested in seeing it. I usually end up beating the class path and dll paths to a mangle and eventually something works, but it's not fun.

Stephen
Re: [eclipse] export jar, Fat Jar, EclipseP5Export
Reply #2 - Sep 13th, 2008, 1:20am
 
so i had a back and forth with the author of EclipseP5Exporter, and he had a hunch it was an issue with my user library setup.  i had all my jogl stuff packed into a user lib per this thread:

http://processing.org/discourse/yabb_beta/YaBB.cgi?board=Integrate;action=display;num=1114400513;start=20#20

i really like this setup (thanks Darth!), it's portable and easy-to-update with new versions of processing, but user libs don't seem to play nice with any of the jar exporters i tried.  (tho Fat Jar says it's supposed to support user libs, i couldn't get that to happen.)

daniel suggested, as a quick workaround, that i add core.jar and the processing/opengl lib to the root of my project; i found a slightly-less messy solution:

i added all the jars in processing/libraries/opengl/library as External Jars to my Java Build Path in Project>Properties, then copied the rest of the files from that folder into the root of my project folder.  not the prettiest either way, but when i re-ran EclipseP5Exporter, i got myself a nice cross-platform application and an applet.

so, perhaps a temporary fix, but a fix nonetheless.
Re: [eclipse] export jar, Fat Jar, EclipseP5Export
Reply #3 - Oct 8th, 2008, 1:05am
 
damnit. there must be a way. the eclipsep5exporter seemed like a deliverance- so simple. but it just doesn't work. some applets are not shown in the menu and can't be choosen. i have no idea why. their are have almost in it, and sometimes they are shown and sometimes not. so the program and applets are exported, but they just dont start. at least- the browser shows  a grey box in the right size.
Re: [eclipse] export jar, Fat Jar, EclipseP5Export
Reply #4 - Oct 9th, 2008, 5:33pm
 
for myself i got to a solution to get an p5applet extended calss embedded in a JFrame Object. it can be done in a way like this.
Code:

public class Frame extends JFrame{



PFrame pFrame;




public Frame() {



this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);



this.setSize(800,600);



JPanel content = new JPanel();



this.setVisible(true);



this.setResizable(false);



try {




Thread.sleep(1000);



} catch (InterruptedException e) {}



int width = this.getLayeredPane().getWidth();



int height = this.getLayeredPane().getHeight();



pFrame = new PFrame(width, height, this);



content.add(pFrame);



this.getContentPane().add(content,BorderLayout.CENTER);



pFrame.loop();


}



public static void main(String[] args) {


Frame f= new Frame();

}
}


and
Code:


int width, height;


Frame fr;


public PFrame(int width, int height, Frame fr) {


noLoop();


this.width = width;


this.height = height;


println(width + "," + height);


this.fr = fr;


init();


loop();

}


public void setup() {


size(width, height);

}


public void draw() {


background(0);

}

Re: [eclipse] export jar, Fat Jar, EclipseP5Export
Reply #5 - Oct 16th, 2008, 11:40pm
 
Hello,
i'm working on a projekt with Processing/OpenGL in Eclipse. My first attempts to export a jar file failed. After doubleclicking the jar, nothing happens. When  starting the file with the commad-shell,it shows me that it couldn't find some libraries. I realized this is a classPath Problem. My Solution: I've changed the Manifest-file from the jar-file.( You could open the jar with winRar and extract the META-INF/MANIFEST.MF file . It should look like:

Manifest-Version: 1.0
Main-Class: your.domain.Mainclassname
Class-Path: yourFolderName/core.jar yourFolderName/gluegen-rt.jar.........

(add every jar-file your Project depends on.)
With this solution you could put all jars in a subfolder.
After that, you have to put the Manifest-file back in the jar-file.
The Problem is: you override the Manifest with every Export,so keep the extracted Manifest-file.
When you export your Project from Eclipse, click through the export Wizard. At the last Dialog there is a option:
"Use existing manifest from workspace". now you could take your own Manifest-file.
This solution worked for me.
So i've got a Rootfolder with my exported jar-file and all the Dll-files beside and a subfolder with all the other jars
(don't know how to get a working solution with the DLL's in a Subfolder)
Hope it works for you!
Re: [eclipse] export jar, Fat Jar, EclipseP5Export
Reply #6 - Jan 27th, 2009, 8:31pm
 
just found this thread randomly on a search for something else -- daniel updated P5Exporter a couple times since the last post, and i think a lot of the troubles with libraries may have cleared up.  download the latest and try again...

http://www.rednoise.org/EclipseP5Exporter/
Re: [eclipse] export jar, Fat Jar, EclipseP5Exporter
Reply #7 - Jul 4th, 2009, 1:23am
 
Hi Everyone!

Can someone help me out here. I created a Processing app in eclipse and it runs fine in Eclipse.

I installed the EclipseP5Exporter plugin to export the app.However, when the plugin creates the applet, the index.html loads with a blank box and nothing in it. The same is the case when I export it as a Java Application.

Can somebody help ?
Re: [eclipse] export jar, Fat Jar, EclipseP5Exporter
Reply #8 - Jul 9th, 2009, 9:05am
 
Greetings,
I've recently updated the exporter for Processing v1.05. If anyone is still having issues with hangs, or 'gray' applets, please let me know. Better still, send (or link to) a full project zip that demonstrates the problem, so that I might be able to recreate it...
thanks,
-dch
(dh254 AT nyu DOT edu)
Page Index Toggle Pages: 1