RedJax
RedJax

Reputation: 123

Eclipse: Is there a way to quickly export JARs

So this may seem a bit vague, how quick is "quick" etc.

Well I'm just wondering if there is a way of exporting a JAR file in a quicker way than:

File -> Export -> JAR File etc etc.

Like can I Ctrl + Drag to explorer and it export with the project title and .jar?

Upvotes: 6

Views: 4949

Answers (2)

Menelaos
Menelaos

Reputation: 26004

How to add custom shortcuts

To add or change shortcuts open: Windows->Preferences->General->Keys. Here you can find all the Eclipse commands and their associated shortcut keys.

Reference

You can add a custom binding in eclipse to export your jar using a keyboard shortcut.

Example

I added bindings both for Runnable and non-runnable jar:

  • Export Jar: CTRL+SHIFT+J
  • Export Runnable Jar: CTRL+SHIFT+R

enter image description here

How to do with Ant File

If you want the JAR to be generated automatically you can look at the following question:

How to do with Batch file run from Button

You can use the combination of the following two answers:

Basically create a batch file that makes the JAR... add a button that executes it.

Upvotes: 8

ABC123
ABC123

Reputation: 1065

If using Maven a long term option would be to set up your build to 'package' your jar. Then just run the mvn package command from the command line or using the Eclipse Maven plugin. This method requires some upfront work, but it buys you a consistent and easy jar export.

Upvotes: 2

Related Questions