Save file (JfileChooser) problem

Asked by spyros-liakos on 2018-08-20

Hello...

I got this code:

 choose_save_file = JFileChooser()
 ret_save = choose_save_file.showSaveDialog(None)
 if ret_save == JFileChooser.APPROVE_OPTION:
  save_select = choose_save_file.getSelectedFile()
  file_path = save_select.getAbsolutePath()
  file_directory = save_select.getCanonicalPath()
  pathios = file_directory
  final_file_name = File(file_path)
  file_out = FileOutputStream(final_file_name)

When I run it from sikuli ide and I save a file is working..
When I export my jar from sikuli ide option and run it, it's not saving the file..

The same is also for loading a file..

 if ret == JFileChooser.APPROVE_OPTION:
  fileoptions = chooseFile.getSelectedFile()
  pathios = fileoptions.getAbsolutePath()

  getProps = Properties()
  input = FileInputStream(pathios)
  getProps.load(input)
  check_collect_a.setText(getProps.getProperty("Test1"))
  get_check_collect = check_collect_a_enable.getText()
  check_remove_a_enable.setText(getProps.getProperty("Test2"))
                get_remove_ = check_remove_a_enable.getText()

I read something about policy file but seems not working when I extract my jar..
Please any help?????

Question information

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

not a SikuliX question.

You should consult the Java experts in the net.

spyros-liakos (spy-arts) said : #2

Ok thanks... the code was correct... I was missing something in the rest of my code..