Executable jar file for embedded jetty application

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|

Executable jar file for embedded jetty application

west suhanic
Hello All:

I have a fully functioning embedded jetty application.
I would now like to package it in an executable jar file.
I do not use maven or ant. It is built using a makefile.
I have a manifest file containing the needed jar files etc.
I can build the executable jar file. However the problem occurs
when I run it. The application starts and I get no error messages
but I cannot contact the embedded server via the command line or
a web browser.

I have gone over the documentation and it is not obvious if what I want to do
is even possible. So I have a few questions:

0)Am I missing something in the documentation?
1)Is building an executable jar file without maven or ant possible?
2)If so, how? Do I need to add some code to my embedded server?

thank you,

west suhanic 

_______________________________________________
jetty-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users
Reply | Threaded
Open this post in threaded view
|

Re: Executable jar file for embedded jetty application

Joakim Erdfelt-8
Using makefile you'll have a lot of extra work to do with merging various files for this executable jar (aka uber-jar).

There are 2 example projects we maintain, but they use maven and the various plugins that do the merging for us in a smart fashion.

If you are working with ServletContextHandler, you can use a uber-jar.


This will merge everything that you use into a single executable jar for yourself.

If you are working with WebAppContext, you can use a live-war.


This produces a war file that, can itself, be executed (like an executable jar).
This has the same merging concerns as above, but is structured differently to allow the war file to operate safely.


Joakim Erdfelt / [hidden email]

On Tue, Mar 6, 2018 at 8:53 AM, west suhanic <[hidden email]> wrote:
Hello All:

I have a fully functioning embedded jetty application.
I would now like to package it in an executable jar file.
I do not use maven or ant. It is built using a makefile.
I have a manifest file containing the needed jar files etc.
I can build the executable jar file. However the problem occurs
when I run it. The application starts and I get no error messages
but I cannot contact the embedded server via the command line or
a web browser.

I have gone over the documentation and it is not obvious if what I want to do
is even possible. So I have a few questions:

0)Am I missing something in the documentation?
1)Is building an executable jar file without maven or ant possible?
2)If so, how? Do I need to add some code to my embedded server?

thank you,

west suhanic 

_______________________________________________
jetty-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users


_______________________________________________
jetty-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users
Reply | Threaded
Open this post in threaded view
|

Re: Executable jar file for embedded jetty application

west suhanic
Hello All:

I am able to build an uber jar called x.jar via a makefile. The steps are:

1)Build a manifest file with the necessary classpaths specified. Here is one I auto generate. I have simply
shortened it  for this example. The key bit is to have one space after the colon which terminates "Class-Path" and two
spaces at the start of each classpath line. In the line "Main-Class:  g.m.TheMain" there are two spaces between the
colon and the letter g   .   Here is the manifest file, called manifest.mf,  which I use on a gentoo machine:

Class-Path:
  /home/b/jars/jetty/9.4.8.v20171121/jetty-continuation-9.4.8.v20171121.jar
  /home/b/jars/jetty/9.4.8.v20171121/jetty-server-9.4.8.v20171121.jar
  /home/b/jars/jetty/9.4.8.v20171121/jetty-http-9.4.8.v20171121.jar
Main-Class:  g.m.TheMain

I auto generate this manifest file in the Makefile because my classpath has over twenty elements.

The jar file statement for the executable jar is:

jar cvfm x.jar ./manifest.mf -C g/m .

Then to use the executable jar do:

java -jar x.jar

thanks,

west suhanic





On Tue, Mar 6, 2018 at 12:28 PM, Joakim Erdfelt <[hidden email]> wrote:
Using makefile you'll have a lot of extra work to do with merging various files for this executable jar (aka uber-jar).

There are 2 example projects we maintain, but they use maven and the various plugins that do the merging for us in a smart fashion.

If you are working with ServletContextHandler, you can use a uber-jar.


This will merge everything that you use into a single executable jar for yourself.

If you are working with WebAppContext, you can use a live-war.


This produces a war file that, can itself, be executed (like an executable jar).
This has the same merging concerns as above, but is structured differently to allow the war file to operate safely.


Joakim Erdfelt / [hidden email]

On Tue, Mar 6, 2018 at 8:53 AM, west suhanic <[hidden email]> wrote:
Hello All:

I have a fully functioning embedded jetty application.
I would now like to package it in an executable jar file.
I do not use maven or ant. It is built using a makefile.
I have a manifest file containing the needed jar files etc.
I can build the executable jar file. However the problem occurs
when I run it. The application starts and I get no error messages
but I cannot contact the embedded server via the command line or
a web browser.

I have gone over the documentation and it is not obvious if what I want to do
is even possible. So I have a few questions:

0)Am I missing something in the documentation?
1)Is building an executable jar file without maven or ant possible?
2)If so, how? Do I need to add some code to my embedded server?

thank you,

west suhanic 

_______________________________________________
jetty-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users



_______________________________________________
jetty-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users
Reply | Threaded
Open this post in threaded view
|

Re: Executable jar file for embedded jetty application

Joakim Erdfelt-8
Don't forget to merge the META-INF/services/ files too.


Joakim Erdfelt / [hidden email]

On Wed, Mar 7, 2018 at 11:11 AM, west suhanic <[hidden email]> wrote:
Hello All:

I am able to build an uber jar called x.jar via a makefile. The steps are:

1)Build a manifest file with the necessary classpaths specified. Here is one I auto generate. I have simply
shortened it  for this example. The key bit is to have one space after the colon which terminates "Class-Path" and two
spaces at the start of each classpath line. In the line "Main-Class:  g.m.TheMain" there are two spaces between the
colon and the letter g   .   Here is the manifest file, called manifest.mf,  which I use on a gentoo machine:

Class-Path:
  /home/b/jars/jetty/9.4.8.v20171121/jetty-continuation-9.4.8.v20171121.jar
  /home/b/jars/jetty/9.4.8.v20171121/jetty-server-9.4.8.v20171121.jar
  /home/b/jars/jetty/9.4.8.v20171121/jetty-http-9.4.8.v20171121.jar
Main-Class:  g.m.TheMain

I auto generate this manifest file in the Makefile because my classpath has over twenty elements.

The jar file statement for the executable jar is:

jar cvfm x.jar ./manifest.mf -C g/m .

Then to use the executable jar do:

java -jar x.jar

thanks,

west suhanic





On Tue, Mar 6, 2018 at 12:28 PM, Joakim Erdfelt <[hidden email]> wrote:
Using makefile you'll have a lot of extra work to do with merging various files for this executable jar (aka uber-jar).

There are 2 example projects we maintain, but they use maven and the various plugins that do the merging for us in a smart fashion.

If you are working with ServletContextHandler, you can use a uber-jar.


This will merge everything that you use into a single executable jar for yourself.

If you are working with WebAppContext, you can use a live-war.


This produces a war file that, can itself, be executed (like an executable jar).
This has the same merging concerns as above, but is structured differently to allow the war file to operate safely.


Joakim Erdfelt / [hidden email]

On Tue, Mar 6, 2018 at 8:53 AM, west suhanic <[hidden email]> wrote:
Hello All:

I have a fully functioning embedded jetty application.
I would now like to package it in an executable jar file.
I do not use maven or ant. It is built using a makefile.
I have a manifest file containing the needed jar files etc.
I can build the executable jar file. However the problem occurs
when I run it. The application starts and I get no error messages
but I cannot contact the embedded server via the command line or
a web browser.

I have gone over the documentation and it is not obvious if what I want to do
is even possible. So I have a few questions:

0)Am I missing something in the documentation?
1)Is building an executable jar file without maven or ant possible?
2)If so, how? Do I need to add some code to my embedded server?

thank you,

west suhanic 

_______________________________________________
jetty-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users




_______________________________________________
jetty-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users
Reply | Threaded
Open this post in threaded view
|

Re: Executable jar file for embedded jetty application

Joakim Erdfelt-8
Also, if you have a META-INF/MANIFEST.MF with a `Class-Path` entry, you don't have a uber jar :-)

You have an old school executable jar with hardcoded classpath.


Joakim Erdfelt / [hidden email]

On Wed, Mar 7, 2018 at 11:14 AM, Joakim Erdfelt <[hidden email]> wrote:
Don't forget to merge the META-INF/services/ files too.


Joakim Erdfelt / [hidden email]

On Wed, Mar 7, 2018 at 11:11 AM, west suhanic <[hidden email]> wrote:
Hello All:

I am able to build an uber jar called x.jar via a makefile. The steps are:

1)Build a manifest file with the necessary classpaths specified. Here is one I auto generate. I have simply
shortened it  for this example. The key bit is to have one space after the colon which terminates "Class-Path" and two
spaces at the start of each classpath line. In the line "Main-Class:  g.m.TheMain" there are two spaces between the
colon and the letter g   .   Here is the manifest file, called manifest.mf,  which I use on a gentoo machine:

Class-Path:
  /home/b/jars/jetty/9.4.8.v20171121/jetty-continuation-9.4.8.v20171121.jar
  /home/b/jars/jetty/9.4.8.v20171121/jetty-server-9.4.8.v20171121.jar
  /home/b/jars/jetty/9.4.8.v20171121/jetty-http-9.4.8.v20171121.jar
Main-Class:  g.m.TheMain

I auto generate this manifest file in the Makefile because my classpath has over twenty elements.

The jar file statement for the executable jar is:

jar cvfm x.jar ./manifest.mf -C g/m .

Then to use the executable jar do:

java -jar x.jar

thanks,

west suhanic





On Tue, Mar 6, 2018 at 12:28 PM, Joakim Erdfelt <[hidden email]> wrote:
Using makefile you'll have a lot of extra work to do with merging various files for this executable jar (aka uber-jar).

There are 2 example projects we maintain, but they use maven and the various plugins that do the merging for us in a smart fashion.

If you are working with ServletContextHandler, you can use a uber-jar.


This will merge everything that you use into a single executable jar for yourself.

If you are working with WebAppContext, you can use a live-war.


This produces a war file that, can itself, be executed (like an executable jar).
This has the same merging concerns as above, but is structured differently to allow the war file to operate safely.


Joakim Erdfelt / [hidden email]

On Tue, Mar 6, 2018 at 8:53 AM, west suhanic <[hidden email]> wrote:
Hello All:

I have a fully functioning embedded jetty application.
I would now like to package it in an executable jar file.
I do not use maven or ant. It is built using a makefile.
I have a manifest file containing the needed jar files etc.
I can build the executable jar file. However the problem occurs
when I run it. The application starts and I get no error messages
but I cannot contact the embedded server via the command line or
a web browser.

I have gone over the documentation and it is not obvious if what I want to do
is even possible. So I have a few questions:

0)Am I missing something in the documentation?
1)Is building an executable jar file without maven or ant possible?
2)If so, how? Do I need to add some code to my embedded server?

thank you,

west suhanic 

_______________________________________________
jetty-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users





_______________________________________________
jetty-users mailing list
[hidden email]
To change your delivery options, retrieve your password, or unsubscribe from this list, visit
https://dev.eclipse.org/mailman/listinfo/jetty-users