0

Since fxml-files uses Controller classes for events, how is it possible to obfuscate an JavaFX application? When the obuscated conntroller classes have different names and paths, the fxml files can't locate them.

Editing the fxml files after obfuscating is not the solution i am searhing for.

Is there another option?

tuna
  • 305
  • 6
  • 13

1 Answers1

2

No point reinventing the wheel;

A quick google search yielded this website.

It uses the Proguard obfuscator.

Cobbles
  • 1,748
  • 17
  • 33
  • 1
    After obfuscating, the controller class names also changes, as wel as their paths. This means that the fxml cant find the controller class. To make it work, i need to exlude the controllers from being obfuscated. But then, whats the point of obfuscating, since the controllers contains the logic.. – tuna Jun 22 '14 at 02:20
  • Are you attaching the controller to the FXML with java or part of the XML file? If the latter, then when you load the file using the FXMLLoader, call `myFxmlLoader.setController(myController);`. This way, the change in the controller name is felt in the setController method as well, if that makes sense. – Cobbles Jun 22 '14 at 10:57
  • The controller is assignd within the FXML file itself, like: fx:controller="MyController">. So is it better to programmaticly set te controller with loader.setController()? – tuna Jun 22 '14 at 12:31
  • Thank you for your help. I managed to accomplish something after some trial and error. – tuna Jun 22 '14 at 20:49
  • 1
    could you tell me how you achieved this I am stuck . – HARSHA sss Sep 29 '20 at 08:53
  • yeah dude how did u do? – Door D Uthpala Nov 03 '20 at 17:57