Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Language IDEs » Java Development Tools (JDT) » Can't Create Executable JAR
Can't Create Executable JAR [message #655587] Mon, 21 February 2011 20:04 Go to next message
No real name is currently offline No real nameFriend
Messages: 2
Registered: February 2011
Junior Member
Hi, I'm new to Eclipse using the AspectJ plugin. I'm running the Eclipse IDE for Java Developers, build # 20100917-0705 with Helios Service Release 1.

In NetBeans 6.9.1, to create an executable I select "clean and build". Fairly straight forward. I've gone through some of the FAQ's (there are a lot) and chose to export it to a "Runnable JAR file".

Within the Workbench, the program I wrote to test everything out (Java and Aspect) works well; however, when I try to export it to a "Runnable JAR file", my program is not listed in the "Launch Configuration". So I'm obviously doing something wrong or missing some steps.

Can someone help me with making a program executable without Eclipse?

In advance - THANK YOU!

N. Harrington
Re: Can't Create Executable JAR [message #655987 is a reply to message #655587] Wed, 23 February 2011 16:33 Go to previous messageGo to next message
No real name is currently offline No real nameFriend
Messages: 2
Registered: February 2011
Junior Member
Nobody, out of all the developers who have viewed this request, knows how to create an executable file in Eclipse? Shocked

Come on folks, if you think I'm just stupid and anyone should know how to do this - fine. Tell me but then, please, tell me what I'm doing wrong or what I should be doing. Seriously, it shouldn't take that long. I'm on a deadline and have tried to create an executable JAR and am not succeeding. I've tried to "export" my current launch configuration then import it (no problem there) and still I'm stuck as exporting to a runnable JAR doesn't see it.

If I'm not doing this properly then, please, if you know how, help. I can't do this in NetBeans because NetBeans doesn't have the AspectJ plugin. Confused

Again, in advance - THANK YOU! Smile

N. Harrington
Re: Can't Create Executable JAR [message #656093 is a reply to message #655987] Thu, 24 February 2011 08:08 Go to previous messageGo to next message
Josh is currently offline JoshFriend
Messages: 8
Registered: February 2011
Junior Member
To create an executable Jar you need to create a class:

MyAppMain.java

public class MyAppMain 
{
	public static void main( String [] args )
	{
		// Do something
	}
}



When you create the jar, and you double click on it, it will launch your program in the jvm which should be installed on almost everyones computer!
Re: Can't Create Executable JAR [message #656203 is a reply to message #656093] Thu, 24 February 2011 14:50 Go to previous messageGo to next message
Nicholas Shaw is currently offline Nicholas ShawFriend
Messages: 8
Registered: January 2011
Junior Member
Thank you, Josh, but that isn't my problem. I have a project, a package, two interfaces, and three classes with the last class containing a main method. It also contains one aspect. As I mentioned in my first post - the program runs fine within Eclipse which requires a main method.

If I go into "run configurations", the proper configuration is there. My problem is that it isn't displayed in "Export/Runnable JAR file".

I guess, if "Export/Runnable JAR file" is the proper/correct mechanism to create an executable then my problem is how to get the launch configuration into "Export/Runnable JAR file/Launch Configuration". Since the launch configuration doesn't display, I can't proceed.

I appreciate you're responding!
Thanks!

N. Harrington
Re: Can't Create Executable JAR [message #656211 is a reply to message #655587] Thu, 24 February 2011 15:14 Go to previous messageGo to next message
Nicholas Shaw is currently offline Nicholas ShawFriend
Messages: 8
Registered: January 2011
Junior Member
I've also done a complete search of both the Eclipse and Eclipse workspace looking for anywhere the launch files are kept.

I went back to the documentation and did a search on "Runnable JAR File Specification" (where I'm stuck) and nothing.

I can create a launch file but under "Runnable JAR File Specification" it doesn't allow me to search for a launch file. So I'm stuck.

Again, I appreciate ANY help anyone can give.

N. Harrington
Re: Can't Create Executable JAR [message #656225 is a reply to message #655587] Thu, 24 February 2011 15:41 Go to previous messageGo to next message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
On 21.02.2011 21:04, nharrington01@gmail.com wrote:
> Hi, I'm new to Eclipse using the AspectJ plugin. I'm running the
> Eclipse IDE for Java Developers, build # 20100917-0705 with Helios
> Service Release 1.
>
> In NetBeans 6.9.1, to create an executable I select "clean and
> build". Fairly straight forward. I've gone through some of the FAQ's
> (there are a lot) and chose to export it to a "Runnable JAR file".
> Within the Workbench, the program I wrote to test everything out (Java
> and Aspect) works well; however, when I try to export it to a
> "Runnable JAR file", my program is not listed in the "Launch
> Configuration".
How did you launch it when testing? The 'Runnable JAR file' export
wizard only works for 'Java Application' launch configurations.

Dani
> So I'm obviously doing something wrong or missing some steps.
>
> Can someone help me with making a program executable without Eclipse?
>
> In advance - THANK YOU!
>
> N. Harrington
Re: Can't Create Executable JAR [message #656226 is a reply to message #655587] Thu, 24 February 2011 15:56 Go to previous messageGo to next message
Josh is currently offline JoshFriend
Messages: 8
Registered: February 2011
Junior Member
From what I am reading, if I am reading correctly: Are you trying to make a .jar file that you double click in order to run? Or what exactly?
Re: Can't Create Executable JAR [message #656260 is a reply to message #656226] Thu, 24 February 2011 19:11 Go to previous messageGo to next message
Nicholas Shaw is currently offline Nicholas ShawFriend
Messages: 8
Registered: January 2011
Junior Member
Yes, Josh, you are correct. I'm trying to make a .jar file that runs when it is double clicked.

Thanks,

N. Harrington
Re: Can't Create Executable JAR [message #656281 is a reply to message #656225] Thu, 24 February 2011 21:02 Go to previous messageGo to next message
Nicholas Shaw is currently offline Nicholas ShawFriend
Messages: 8
Registered: January 2011
Junior Member
Dani,

For testing I have, under project, automatic build. So I simply hit run and it runs. I observe the results in the console.
Thanks,

N. Harrington
Re: Can't Create Executable JAR [message #656328 is a reply to message #656260] Fri, 25 February 2011 07:13 Go to previous messageGo to next message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
On 24.02.2011 20:12, Nicholas Shaw wrote:
> Yes, Josh, you are correct. I'm trying to make a .jar file that runs
> when it is double clicked.
It doesn't work like this unless you've chosen java.exe to run *.jar
files in your OS. You need to create a script that executes:
<path to Java install>/jre/bin/java -jar exported.jar

Dani
>
> Thanks,
>
> N. Harrington
Re: Can't Create Executable JAR [message #656329 is a reply to message #656281] Fri, 25 February 2011 07:13 Go to previous messageGo to next message
Dani Megert is currently offline Dani MegertFriend
Messages: 3802
Registered: July 2009
Senior Member
On 24.02.2011 22:02, Nicholas Shaw wrote:
> Dani,
>
> For testing I have, under project, automatic build. So I simply hit
> run and it runs. I observe the results in the console.
You should find the launch configuration via Run > Run Configurations...

Dani
> Thanks,
>
> N. Harrington
Re: Can't Create Executable JAR [message #656425 is a reply to message #656329] Fri, 25 February 2011 15:14 Go to previous messageGo to next message
Nicholas Shaw is currently offline Nicholas ShawFriend
Messages: 8
Registered: January 2011
Junior Member
Thanks, Dani, I appreciate your's and Josh's help. I guess I thought Eclipse operated similar to NetBeans that does enable the creation of an executable (via an executable JAR file). I'll try your recommendation of a script.

N. Harrington
Re: Can't Create Executable JAR [message #664659 is a reply to message #655587] Mon, 11 April 2011 14:30 Go to previous messageGo to next message
Sylvain  all is currently offline Sylvain allFriend
Messages: 1
Registered: April 2011
Junior Member
Had the same problem...

The trick is to create a normal run configuration with the same start class as your AspectJ run configuration. When you create your runnable JAR, select the normal run configuration. The resulting JAR will have AspectJ support.
Re: Can't Create Executable JAR [message #664740 is a reply to message #664659] Mon, 11 April 2011 18:50 Go to previous messageGo to next message
Nicholas Shaw is currently offline Nicholas ShawFriend
Messages: 8
Registered: January 2011
Junior Member
Sylvain all wrote on Mon, 11 April 2011 08:30
Had the same problem...

The trick is to create a normal run configuration with the same start class as your AspectJ run configuration. When you create your runnable JAR, select the normal run configuration. The resulting JAR will have AspectJ support.


Thanks, sylvain, I'll give that a try! I appreciate the help!
Regards,

Nicholas.
Re: Can't Create Executable JAR [message #664838 is a reply to message #655587] Tue, 12 April 2011 09:12 Go to previous message
kavitha is currently offline kavithaFriend
Messages: 1
Registered: October 2010
Junior Member
Thanks for sharing this..

windows ftp server
Previous Topic:How to add custom validation?
Next Topic:Generics and unparameterized types
Goto Forum:
  


Current Time: Fri Apr 26 07:42:38 GMT 2024

Powered by FUDForum. Page generated in 0.04232 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top