ceylon

Ceylon fat-jar with non-default run function


I have a simple http server in a folder named POSTtoFile. It has one module (server) with one package (server) with a file runServer.ceylon with a function runServer which is the main method. Building a fat jar like this:

ceylon fat-jar server/1.0.0 --run=server::runServer

and running the jar like this:

java server-1.0.0.jar

I get this error:

Error: Could not find or load main class server-1.0.0.jar

buiding the fat jar like this:

ceylon fat-jar server/1.0.0 --run=runServer

gives the same outcome.

I followed this guide.


Solution

  • Running a jar file is done with java -jar server-1.0.0.jar. If you omit the -jar parameter, it is trying to load a class named server-1.0.0.jar (which is not a valid class name, at least in Java, not sure about the JVM).