How to get my program to run outside of eclipse

时光毁灭记忆、已成空白 提交于 2019-12-03 20:36:19

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) {
        PApplet.main(Earthquaker.class.getSimpleName());
    }

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

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.

Create a simple jar. Create a batch file and specify the class path. Save the batch file. Runnin the batch file will run the app

@ECHO OFF
set CLASSPATH=%CLASSPATH%;myjar1.jar;myjar2.jar;

java mypackage.MyClass
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!