This week's book giveaway is in the Clojure forum.
We're giving away four copies of Clojure in Action and have Amit Rathore and Francis Avila on-line!
See this thread for details.
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Jar execution command

 
Nicolas Kal
Ranch Hand
Posts: 69
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all!

I finished everything regarding the assignment and i am about to upload it. I was going through last minute check and noticed the following on the instructions:

When you submit your assignment, each part (client and server) must be executable using a command of this exact form:

java -jar <path_and_filename> [<mode>]


To execute my application I use this :
java -cp runme.jar client.ApplicationController -standalone


The difference is on the -cp, does this indicate an automatic failure?
 
Radi Hadzhiyski
Ranch Hand
Posts: 47
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
in my opinion yes!

but why you have to write the classpath?

when you create the jar file, you can give them an entry point like this:

jar cfev runme.jar suncertify.client.ApplicationController suncertify

assumed, your that is the right entry point, after that you can simply write:

java -jar runme.jar standalone

EDIT:

the entry point is like, when you have created a manifest file with a main-class clause, but it is easier, when you don't want to have
other things in the manifest file
 
Carlos Morillo
Ranch Hand
Posts: 221
Java Python Scala
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
To make an executable jar, first create a manifest that tells which class file is the main class.

Create a text file manifest.txt that contains a line like:


Main-Class: x.y.MyMainClass


and then build your jar file with:


jar -cvfm my_archive.jar manifest.txt *.class


Hope this helps,


Carlos.
 
Nicolas Kal
Ranch Hand
Posts: 69
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By entry-point you mean to specify which is the class with the "main" i suppose. But if understood correct, at least according to my instructions, the server should have a main too so it can be executed by the command line. is it possible to define two entry points?
 
Roberto Perillo
Bartender
Posts: 2271
3
Eclipse IDE Java Spring
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Nicolas Kal wrote:is it possible to define two entry points?


No, champion. The main class must be unique, and it has to deal with the 3 different ways the application can be executed. The only difference is the arguments you provide in the command line.
 
Nicolas Kal
Ranch Hand
Posts: 69
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Thanks for the clarification! I'll modify, retest and finally upload..
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic