AJMansfield AJMansfield - 1 year ago 94
Java Question

How to get my program to run outside of eclipse

I have a project in eclipse. It does everything I want it to do when I click on the green circle play button in the IDE - opens the window, plays the stuff, everything. But, try as I might, I cannot figure out how to get it to do that outside of eclipse.

My project uses the processing.core library to do some of its stuff, but I am unable to get the project to function in the Processing IDE, because of some stupid stuff about one of my classes not being a valid substitute for the type parameter for

. If anyone knows how I can get it to export from the Processing IDE, that would be excellent.

I need to be able to email/upload to the internet/otherwise transmit some kind of file/folder/webpage that allows the recipient to, without much technical knowledge or work on their part, view a window or something that allows them to view and interact with the program in the same way I am able to interact with the window that Eclipse launches when I press the play button at the top.

I have tried several different ways of accomplishing this, but none of them have worked. I tried exporting a runnable
, but it wouldn't let me include the referenced libraries. I tried a regular
, but I don't know how to package that up with whatever is needed to be able to view it. I've even tried using the fat jar eclipse plugin for it, too, but I ran afoul of something about being unable to find the main
class for the project.

If anybody knows how to get what I want to happen, or knows of a good tutorial on how to do what I want, I would greatly appreciate any sort of assistance or guidance or anything.

Google has been unhelpful in turning up solutions to this problem, because most of the results I have found were just other people asking the same or a similar question, and then either no answer, or something I had already tried, with no indication of exactly what sort of options or settings I needed to give it in order to accomplish the task.

I am using the
from version 2.0b7, but I don't think that would make a difference, although I plan to try it with different versions if I can't figure out anything else.

A copy of my project folder can be found at https://www.dropbox.com/sh/1n4curhxbgi8fye/A5F6_l7xQu

All the data I have is stuff I've concatenated together from successive versions of the file at http://earthquake.usgs.gov/earthquakes/catalogs/eqs7day-M1.txt

Answer Source

I've done a quick test on OSX and had to tweak your eclipse project a bit:

  1. You are linking to .jar libraries using absolute path. I recommend using keeping libraries relative to the project
  2. I ran into some memory issues and had to add a couple of compiler flags
  3. Added a main method in Earthquaker.java to initialize as an application.

main looks like this:

public static void main(String[] args) {

In eclipse you can export a runnable jar via File > Export > Java > Runnable JAR file. Here are a couple of screenshots:

eclipse jar export 1

eclipse jar export 2

Personally I prefer using the "Copy required libraries into a sub-folder..." option in case I need to update some dependent .jar independent of the main application .jar.

For reference I've uploaded the modified eclipse project here(Java SDK will need to be changed). The exported runnable jar with a bash script is available here.

And here is the bash script itself which should run on Linux as well:

java -Xms128M -Xmx1024M -jar Processing-DataVisualization.jar

Pretty cool project btw.

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download