API in Java, running JAR displays API::JavaScriptRunner 1.1.4

Asked by Dado on 2018-11-07

I'm trying my first application in Java , using Intellij Idea and sikulixapi.jar as additional library.
I'm simply finding the windows start menu button and clicking it.
It's working correctly if I run it from inside the IDE but then I build the JAR artifact and tried to run it outside the IDE, from the command prompt in windows and surprise, it doesn't work, it doesn't do the same as before, instead a window appears with title "API::JavaScriptRunner 1.1.4-SNAPSHOT" end below "enter some JavaScript (know what you do - may silently die ;-) example: run("git*") will run te Javascript showcase from GitHub........." etc etc
It is expecting me to write some javascript code inside the textbox , I think to run it then.
Why this window is appearing ? am I'm building the jar in the wrong way? I correctly specified my class as main class during artifact configuration

any help is appreciated
thenks
Dado

Question information

Language:
English Edit question
Status:
Answered
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Last query:
2018-11-08
Last reply:
2018-11-10
RaiMan (raimund-hocke) said : #1

Select the right main function
Cannot be that from the sikulixapi.jar

Dado (dadotc) said : #2

in the end I was able to fix it someway, but it's a workaround not a real solution.
I don't have experience in Java nor in Intellij Idea so probably is something stupid that I'm making wrong,
the problem is that in the final JAR that I'm producing (using JAR Artifact in the IDE) I have a META-INF folder that is coming from the sikulixapi.jar library, and inside that folder there is this manifest:

Manifest-Version: 1.0
Archiver-Version: Plexus Archiver
Created-By: Apache Maven 3.5.2
Built-By: travis
Build-Jdk: 11.0.1
Main-Class: org.sikuli.script.Sikulix

as you can see the main class is "org.sikuli.script.Sikulix" that I suspect is what is running now.

The problem so is that in my final JAR I don't find the Manifest I have in the IDE that is correct and point to my class as Main-Class , but there is Sikulixapi Manifest.

As a workaround I solved opening the sikulixapi.jar file and changed the manifest to point to my class but this is more a workaround than a solution, very dirty!

any suggestion please?

thanks
bye
Dado

RaiMan (raimund-hocke) said : #3

I am offline until Nov 20th, so I cannot Check the IDEA Setup.

But there surely is an Option to specify the main class for the final jar.

Another option is to setup your project as Maven

Can you help with this problem?

Provide an answer of your own, or ask Dado for more information if necessary.

To post a message you must log in.