importing and running jar with swing gui: no main manifest attribute

Asked by john gonale on 2018-04-27

hello! first and foremost, please bear with me, my knowledge of python/jthon/java is extremely limited!, i am using this project to learn as i go

i have a working sikulli script that fires up a web browser, and logs into a free online game, i created a basic gui to set variables with swing in eclipse (using jformdesigner https://marketplace.eclipse.org/content/jformdesigner-swing-gui-designer#group-details )

when i run the script , console shows:

http://prntscr.com/jaqsnu

"no main manifest attribute"

the lines im using to import and open are :

# loading the jar file for the gui
load("C:\\sikulli\\KHv4.sikuli\\configwindow.jar")

#import the jar
import subprocess

# run the configwindow GUI
subprocess.call(['java', '-jar', 'C:\\sikulli\\KHv4.sikuli\\configwindow.jar'])

i have uploaded the .jar file, as well as the .class, .java, and .jfd files here:
https://mega.nz/#F!72AhBCTD!3fKiAILI9huwu6MU21CzaQ

i assume i made a mistake somewhere in eclipse, any pointers or reference material would be greatly appreciated!

Question information

Language:
English Edit question
Status:
Solved
For:
Sikuli Edit question
Assignee:
No assignee Edit question
Solved by:
RaiMan
Solved:
2018-04-27
Last query:
2018-04-27
Last reply:
2018-04-27
Best RaiMan (raimund-hocke) said : #1

You have to prepare the jar in a way, that it is runnable from command line:
java -jar C:\sikulli\KHv4.sikuli\configwindow.jar

To get this working, your jar needs a main class, that takes care to show the window on the screen.

Look in the net for Java tutorials, how to run an app with awt/swing components.

... but that is not all:
to use this "window" as a preset for some values needed inside your script later, you have to store the settings when the user has clicked ok (for example as a property file), so that you can access these values afterwards for your script.

... and you have to somehow wait for the user to click ok, since calling subprocess simply detaches a new process in parallel, while your script will continue to run.

... and this is not needed with your current concept:
# loading the jar file for the gui
load("C:\\sikulli\\KHv4.sikuli\\configwindow.jar")

since you do not access anything inside the jar in your script.

john gonale (erojiji) said : #2

great thanks, i had not given thought to the need to store the variables, i will look into writing those to a file from the gui that i can read into sikuli to set them.

 i had already thought about the need for the script to stop while the user is in the gui, i am planning to use a variable set to true to accomplish this with a while loop. the final button in the gui is basically a 'run' button that will swap that var to false, allowing it to exit that loop and continue on, i can change this so it loads the stored values, checks them to see if the run variable was changed to true, and if not loop again

john gonale (erojiji) said : #3

Thanks RaiMan, that solved my question.