Exporting a Runnable Jar from Eclipse

You can create a runnable jar file from an Eclipse project that contains all files necessary to run an application.

  • Select File / Export…
  • Select Java / Runnable JAR file

The export wizard opens:

export-runnable-jar

  • Select the launch configuration that you want to export. Such a launch configuration is created automatically if you have built the project with Reactive Blocks.
  • Select the name of the jar file that should be created. Make sure it ends with *.jar.
  • Select the first option for library handling.
  • Click Finish.
  • Ignore possible warnings during the export.

Tips:

  • It’s easy to select the wrong launch configuration, since you may have several runnable applications in your workspace.
  • Whenever you export a new version of an application, change the file name of the jar file. You can, for instance, append a number that you increase with each version. When different versions of a jar file have the same name it is very easy to mess up things and to accidentally run an outdated version. So, never produce a jar file with the exact same name!

Running Java

It is easiest to pack a Java program as an runnable jar file, copy that jar file to the Pi, and then run it. To start the Java program, use the java command:

sudo java -jar .jar

We added sudo to run it as super user. This is necessary for some programs, especially those that access the GPIO pins.

Terminating a Java Program

To terminate a running Java program from within the same terminal where you started it, press the buttons Ctrl and c at the same time. This should stops the currently executing program. If that does not work, try Ctrl and z.

You can also open another terminal, and then run the following command:

ps -ef | grep java

You will see a list of processes that have java in their name. Find the proper process, and copy its process number.

sudo kill <process-number>

You can also use

sudo killall java

77 thoughts on “Running a Java file on the Raspberry Pi

  1. Pingback: writeaessay
  2. Pingback: Viagra 20 mg
  3. Pingback: Online viagra
  4. Pingback: Buy cialis online
  5. Pingback: Cialis uk
  6. Pingback: Viagra 5 mg
  7. Pingback: Cialis daily
  8. Pingback: visit the page
  9. Pingback: Cialis generic
  10. Pingback: read an article
  11. Pingback: link to the page
  12. Pingback: click here
  13. Pingback: click to go
  14. Pingback: here
  15. Pingback: Bangalore Escorts
  16. Pingback: taken from here
  17. Pingback: Kolkata Escorts
  18. Pingback: Goa Escorts
  19. Pingback: Cialis 5 mg
  20. Pingback: Cialis 5 mg
  21. Pingback: Buy cialis
  22. Pingback: Cialis coupon
  23. Pingback: notehub.org
  24. Pingback: notehub.org page
  25. Pingback: notehub.org source
  26. Pingback: read further
  27. Pingback: notehub.org
  28. Pingback: go to the source
  29. Pingback: click
  30. Pingback: notehub.org

Leave a Reply