Can be de-compiled JavaFX applications?

I'm a former developer of Silverlight and I just discovered JavaFX 2.0. I'd like to build some applications that would be delivered in browser applications, and I wonder about how secure my source code is a JavaFX application.

In the world of Silverlight apps could be décompilés, so the best recommendation to protect your source code was using a utility of obfuscation. Would that be true here in JavaFX world too?

JavaFX = Java. And Java classes can be décompilés, Yes. Obfuscation is the best way to protect the code; "do not give a hoot" is another. This has little to do with Silverlight or JavaFX, it's an inherent problem of applications that work under the customer they can be divided into. The only real way to protect against the theft of code is to do what you want to be protected on a server and display it as a service.

Tags: Java

Similar Questions

  • How can I keep only one instance of the javafx application at the same time?

    Hello
    How can I keep only one instance of the javafx application at the same time?
    Let not the user run the javafx application is running on your PC.

    Hello. This program does what you want. You can probably find a better solution.

    import javafx.application.Application;
    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.scene.Scene;
    import javafx.scene.control.Button;
    import javafx.scene.layout.StackPane;
    import javafx.stage.Stage;
    
    import java.io.BufferedReader;
    import java.io.File;
    import java.io.FileReader;
    import java.io.FileNotFoundException;
    import java.io.*;
    import java.nio.channels.FileLock;
    import javafx.application.Platform;
    import javafx.stage.WindowEvent;
    
    public class Simpleapp extends Application {
    
        public static void main(String[] args) {
    
            launch(args);
        }
    
        @Override
        public void start(Stage primaryStage) throws Exception {
    
            final File file = new File("flag");
            final RandomAccessFile randomAccessFile = new RandomAccessFile(file, "rw");
            final FileLock fileLock = randomAccessFile.getChannel().tryLock();
    
            System.out.print(fileLock == null);
            if (fileLock == null) {
                Platform.exit();
            }
    
            primaryStage.setTitle("Hello World!");
            Button btn = new Button();
            btn.setText("Say 'Hello World'");
    
            StackPane root = new StackPane();
            root.getChildren().add(btn);
            primaryStage.setScene(new Scene(root, 300, 250));
    
            primaryStage.setOnCloseRequest(new EventHandler() {
    
                @Override
                public void handle(WindowEvent arg0) {
                    try {
                        fileLock.release();
                        randomAccessFile.close();
                        System.out.println("Closing");
                    } catch (Exception ex) {
                        System.out.print(ex.getMessage());
                    }
    
                }
            });
    
            primaryStage.show();
        }
    }
    
  • How can I implement a comfirmation window when closing the javafx applications?

    Hi, guys
    I would add a confirmation window when the user closes my javafx application, if the user clicks Yes, I close the application, so no, I wouldn't close it, how can I implement this feature?
     
    primaryStage.setOnCloseRequest(new EventHandler<WindowEvent>(){
    
                   @Override
                   public void handle(WindowEvent arg0) {
                        try
                        {
                             //todo
                        }
                        catch(Exception ex)
                        {
                             System.out.print(ex.getMessage()+"\r\n");
                        }
    
                   }
            });

    Hello. Here is an example:

    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.geometry.Pos;
    import javafx.stage.*;
    import javafx.scene.*;
    import javafx.scene.paint.Color;
    import javafx.scene.layout.*;
    import javafx.scene.control.*;
    
    public class ModalDialog {
    
        public ModalDialog(final Stage stg) {
         final Stage stage = new Stage();
            //Initialize the Stage with type of modal
            stage.initModality(Modality.APPLICATION_MODAL);
            //Set the owner of the Stage
            stage.initOwner(stg);
            Group group =  new Group();
            HBox hb = new HBox();
             hb.setSpacing(20);
            hb.setAlignment(Pos.CENTER);
            Label label = new Label("You are about to close \n your application: ");
            Button no  = new Button("No");
    
            no.setOnAction(new EventHandler() {
    
                public void handle(ActionEvent event) {
                       stage.hide();
                }
            });
            Button yes  = new Button("Yes");
            yes.setOnAction(new EventHandler() {
    
                public void handle(ActionEvent event) {
                       stg.close();
                }
            });
    
             hb.getChildren().addAll(yes, no);
             VBox vb =  new VBox();
             vb.setSpacing(20);
             vb.setAlignment(Pos.CENTER);
             vb.getChildren().addAll(label,hb);
            stage.setTitle("Closing ...");
            stage.setScene(new Scene( vb, 260, 110, Color.LIGHTCYAN));
            stage.show();
    
        }
    
    }
    

    Test:

       import javafx.application.Application;
    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.scene.Group;
    import javafx.scene.Scene;
    import javafx.scene.control.Button;
    import javafx.scene.paint.Color;
    import javafx.stage.Stage;
    import javafx.stage.*;
    
    /**
     *
     * @author Shakir
     */
    public class ModalTest extends Application {
    
        /**
         * @param args the command line arguments
         */
        public static void main(String[] args) {
            Application.launch(ModalTest.class, args);
        }
    
        @Override
        public void start(final Stage primaryStage) {
            primaryStage.setTitle("Hello World");
            Group root = new Group();
            Scene scene = new Scene(root, 300, 250, Color.LIGHTGREEN);
    
           primaryStage.setOnCloseRequest(new EventHandler(){
    
                   @Override
                   public void handle(WindowEvent arg0) {
                                    arg0.consume();
                        try
                        {
                         ModalDialog md = new ModalDialog(primaryStage);
                                    }
                        catch(Exception ex)
                        {
                             System.out.print(ex.getMessage()+"\r\n");
                        }
    
                   }
            });
    
            primaryStage.setScene(scene);
            primaryStage.show();
        }
    }
    
  • I have problems with JavaFX applications run on raspberry pi!

    I have problems with JavaFX applications run on raspberry pi. I did all the steps of the course videos: overclocking, without comment that I had to uncomment on the framebuffer, but Exceptions are always produce. Demonstration of fireworks as an example does not work. Someone went through this problem? Java applications are ok. Like the versions of java in netbeans project and also on 'Properties' and they are all JDK 8. So if anyone can give a clue, I am very grateful!

    Can you provide the exceptions that you got so I can help you better?

    You want to make a coaching for this session?

    Vinicius-

  • If we can make Templateing with JavaFX

    If we can do Templateing (such as Facelets Vs JSF, Struts Vs tiles) with JavaFX? I want to design pages to user interface with header, body, footer as well now. Thank you.

    > my JavaFX application have a main Menu, if I have to repeat these codes for each controller class?

    No, you don't need to repeat the main menu of each controller (and you don't have to repeat it).

    Try this setting very small sample that shows how you can separate your scene in different FXML static components (for example, by separating a content header).

  • First JavaFX application with time sequential process

    Hi all

    I'm working on my first JavaFX application.  I have a user (view) UI elements in place, I have a controller that works properly (with the exception that I will mention below), and I have a model that works properly (processes data correctly), but the model code was written to run under a user interface.

    What I want to do is the following.  When the user clicks on the "Run" button, the user input is passed to the model via the controller and the data is processed.  It's a do - once a sort of thing where the input is transformed into the output and that's the end of it.  The user interface can be reset and new entry provided, and all this happens again by clicking the run button.  Here's the problem: the treatment has several steps that need to occur in order, but some may take some time.  I want to provide feedback via a message (what is done) and overall progress via a progress bar (the two items in the current user interface).  The problem is that I am still very confused on how to accomplish the user comments.

    The user interface was built in SceneBuilder, and I attributed to the onMouseClicked event to call the runButtonClicked() method in the controller.

    The runButtonClicked() method calls the private methods that run the processing steps (I'll do something more intelligent exception - please ignore that for now)...

    public void runButtonClicked() {}

    runButton.setDisable (true);

    sdfFileBrowseButton.setDisable (true);

    outputFileBrowseButton.setDisable (true);

    try {}

    prepareSDFFile();

    prepareModels();

    collectDescriptors();

    makeSamples();

    evaluateSamples();

    writeResultsToTextFile (results, outputFile);

    } catch (IOException exception) {}

    System.out.println ("Caught an IOException:" + exception.getMessage ());

    } catch (JAXBException exception) {}

    System.out.println ("caught JAXBException:" + exception.getMessage ());

    }

    }

    Each of the calls in try-catch are tasks that need to be linked in the order listed.  Some of them may take a long time (for example, collectDescriptors(), evaluateSamples(), and writeResultsToTextFile().  The work is not done in the controller.  The controller creates instances of classes that do the actual work (this seems to be a departure from most of the tutorials I've seen - it seems the model and the controller are mixed in the tutorials).

    I would like to alert the user about this step is execution (by means of a message in the user interface) and at what stage of the process as a whole is in (through a progress bar).  It would be nice if the progress bar might reflect the status of each individual step (back to 0 at the beginning of the next step), but given the bar just reflect more all the advances (e.g., how many six steps were finished) would be sufficient.

    I also want to be able to manage a Cancel key event and just stop the whole process and reset the app (lose whatever work has been done is OK).

    -I can truly say what should be the best approach.  None of the examples in several tutorials, I went on that have really touched on this type of sequential process.  I would like suggestions.

    Thank you


    Dave.


    Suggested approach

    What you describe is a quite classic case to use the utility javafx.concurrent (task and Service).

    Your application is a perfect fit for the use of these services, which will provide you with:

    1. an execution thread concurrent to run your journal of the current process

    2. a feedback mechanism of thread-safe for the progress that you can link to a ProgressBar for interactive progress feedback.

    3. a feedback mechanism of thread-safe for messages that you can bind a label to your interactive status feedback.

    4 code example that illustrates the ability to cancel and restart the process.

    5, a setter callback method of success that can be configured to provide a result and decide on the success.

    6. a reminder Set accessor method failure which can be set to make an exception and to take measures in case of failure.

    Task and Service samples

    There are a lot of examples of tasks if you search for task of JavaFX.

    There are also great documentation in the javadoc task and Service .

    Here is an example of using a service of JavaFX.  The example is a bit old and uses does not use some new features of the API such as setOnSucceeded or setOnFailed, it also uses models of generator now frowned upon, however, the bulk of it is still relevant to what you want.

    Here is another sample more complicated to make 300 cards off screen and save the files in JavaFX, although I doubt that your task should be as complicated and probably a unique control service is all you need, in order to not pay too much attention to the more complicated example unless you need this kind of functionality.

    Here's another simple example for Re: create several parallel tasks into a single service, which shows in fact sequential and a side event of the stage of the tasks within a service.

    Progress can be reset between the steps, so that the message indicates the current step and progress indicates the status of the market rather than overall progress.  You can expose different processes for feeding of the overall progress back in addition to the progress of the step.

    For more help

    If you're still having problems, I'm sure someone on the forum could easily model a draft sample application illustrating the techniques based on the info you provided in your question, just ask if you would like that...

  • can I run a javafx from main thread thread?

    EDIT: what I want the code for:
    (1) controller class
    -runs in the background
    -creates shopping cart
    -create listeners for applications that will add items to your basket
    -regulates which application has access to the screen
    (2) class ShoppingCart
    -runs in the background
    -receive the items of no Java-based applications
    -stores these items "in the basket.
    (3) class checkout
    -GUI for the user to remove items in their cart
    -complete the transaction before returning control to your cart

    I'm new to javafx - and haven't used Java over the years, namely, I'm trying the following:

    -------------------------------------------------------------------------------------------------------------------------------
    Controller class
    -------------------------------------------------------------------------------------------------------------------------------
    public class Controller {
         private static ShoppingCart shoppingCart;
    
         public static void main(String[] args) {
              ExecutorService exec = Executors.newFixedThreadPool(5);
              try {
                   shoppingCart = new ShoppingCart(2001);
                   exec.execute(shoppingCart);
              } catch (IOException ex) {
                   ex.printStackTrace();
              }
         }
    }
    -------------------------------------------------------------------------------------------------------------------------------
    Class ShoppingCart
    -------------------------------------------------------------------------------------------------------------------------------
    public class ShoppingCart extends Stage implements Runnable {
         private ServerSocket serverSocket;
         private Socket clientSocket;
         private Socket socket;
         private final int port;
         
         private BufferedReader bReader;
         private BufferedWriter bWriter;
         
         private final ArrayList<String> items = new ArrayList<Item>();
    
        public ShoppingCart(int port) throws IOException {
              this.port = port;
        }
         
         /*
          * when an item arrives at the port, pass the port through to RecieveItem to digest the incomming stream
          */
        @Override
        public void run() {
              
              boolean addMoreItems = true;
              try {
                   this.serverSocket = new ServerSocket(port);
              } catch (IOException ex) {
                   ex.printStackTrace();
              }
              try {
                   while(addMoreItems){
                        this.clientSocket = serverSocket.accept();
                        String theItem = receiveItem(clientSocket);
                        if(theItem == null)
                             addMoreItems = false;
                        else
                             this.items.add(theItem);
                   }
              } catch (IOException ex) {
                   ex.printStackTrace();
              }
        }
    
        private String receiveItem(Socket socket) throws IOException {
              String readLine = "";
              String itemString = "";
              
              this.socket = socket;
              this.bReader = new BufferedReader(new InputStreamReader(socket.getInputStream()));
              
              while(readLine != null){
                   readLine = bReader.readLine();
                   // if we are finished adding items, proceed to checkout
                   if(readLine.equalsIgnoreCase("checkout")) {
                        // show cart for user to see items before paying
                        itemString = null;
                   } else { // otherwise, add the item
                        itemString += "|" + readLine;
                   }
              }
              
              return itemString;
         }
    -------------------------------------------------------------------------------------------------------------------------------
    When I try to run the code, I get the following:
    -------------------------------------------------------------------------------------------------------------------------------
    Exception in thread "main" java.lang.IllegalStateException: Not on FX application thread; currentThread = main
    -------------------------------------------------------------------------------------------------------------------------------

    So, is this possible? What Miss me?
    Thanks for reading my questions :)
    Dave.

    Published by: 1003225 on 29 April 2013 20:26

    Published by: 1003225 on April 30, 2013 12:49

    I did some research and aparently you must republish the same answer for me to be able to show your answer as being correct (for some reason, it is not editable)

    Answer:

    You can launch an application Java to the main thread by calling Application.launch, but you can call it only once per process or an exception will be thrown:
    http://docs.Oracle.com/JavaFX/2/API/JavaFX/application/application.html#launch%28Java.lang.class, %20java.lang.String...%29

    ---------

    Partners:

    The cycle of life and the management of threads that run user by the JavaFX application code is documented in the javadoc for JavaFX Application:
    http://docs.Oracle.com/JavaFX/2/API/JavaFX/application/application.html

    Conditions of application output is kept by Platform.setImplicitExit:
    http://docs.Oracle.com/JavaFX/2/API/JavaFX/application/platform.html#setImplicitExit%28boolean%29

  • Menu item to exit a JavaFX application

    Hello. I am very new to JavaFX so please forgive what may be an obvious question.

    Can anyone provide a code example to create a menu entry for example, file-> exit to quit a JavaFX application?

    I can create the menus, but I don't know how to perform the actual output.

    Use the setOnAction method? What is the code performs the actual closing of the app?

    Thank you.

    Tony

    Hello. Here is an example:

    import javafx.application.Application;
    import javafx.application.Platform;
    import javafx.event.ActionEvent;
    import javafx.event.EventHandler;
    import javafx.scene.Group;
    import javafx.scene.Scene;
    import javafx.scene.control.Button;
    import javafx.stage.Stage;
    import javafx.scene.control.*;
    
    public class MenuIt extends Application {
    
        public static void main(String[] args) {
            Application.launch(args);
        }
    
        @Override
        public void start(Stage primaryStage) {
    
            MenuItem menuItem = new MenuItem("Exit");
    
            final Menu menu = new Menu("File");
            menu.getItems().add(menuItem);
    
            MenuBar menuBar = new MenuBar();
            menuBar.getMenus().add(menu);
    
            menuItem.setOnAction(new EventHandler() {
    
                @Override
                public void handle(ActionEvent e) {
                    Platform.exit();
                }
            });
    
            primaryStage.setTitle("Menu sample");
            Group root = new Group();
    
            Scene scene = new Scene(root, 300, 250);
    
            root.getChildren().add(menuBar);
            primaryStage.setScene(scene);
            primaryStage.show();
        }
    }
    
  • methods of a JavaFX application from another application

    Hallo.

    So, I did some work on JavaFX 2.0 integrating graphics into a program called Max/MSP. It is a kind of Visual language for handling the music. Among it's features is the ability to write your own classes java, extended by the MaxObject class and create the custom components in your Max Patches. I received a MaxObject to launch a JavaFX applications, so I know that this part can be done. Now, I need two programs to talk properly with each other.

    So, what I'm looking for is a pretty standard, reliable way to get ApplicationA, i.e. which launches application (and thusly can pass arguments by hand), to be able to transmit information in application B and vice versa. I'm assuming that someone else out there he wanted a JavaFX application to interface with another piece of java code. An Advisor on what should I look for in? Both applications are running on the same computer. And I hope my question is clear decently...
    -Jean

    Hey John,

    I would like to try some of the following to refine your question:
    * Put your launch within another thread code to see if that stops the problem of blocking
    * use a random value that is passed to your application instead of 42 so that you can tell if new instances are created, etc.
    call a different method for bang for your second call to the method just separate the flow to isolate your question

    Something like:

    public class MaxPart extends MaxObject {
    
        private boolean started;
        private Circles circles;
    
        public synchronized void bang()
        {
            if (!started)
            {
                outlet(0, "Starting Circles application...");
                started = true;
                new Thread()
                {
                    public void run()
                    {
                        Application.launch(Circles.class, null);
                        outlet(0, "Circles application launch completed");
                    }
                }.start();
    
                // you could do some synchronized blocking here to wait for the instance to be set, try just doing a
                // simple sleep for now and add synch in if it works
                try { Thread.sleep(2000); } catch (InterruptedException e) {};
    
                circles = Circles.instance;
                Double randomValue = Math.random();
                outlet(0, "Circles assigned random value: " + randomValue);
                circles.setValue(randomValue);
            }
            else
            {
                outlet(0, "Circles is already started, not starting another one");
            }
        }
    
        public void anotherBang()
        {
            outlet(0, "Circles random value was: " + circles.getValue());
        }
    }
    

    Either way, you mention that you want to use the Singleton pattern. You pretty much are already - the 'instance' is a singleton that gets the value once (when the Application is launched) and is then used in the world. There is nothing real magic of singletons.

    Also, just to let you know the 'main' method in your application of circles is not needed or used. The bang method directly calls the launch. You only need this main method if you want to run the standalone app of circles (which is still useful for testing).

    Hope that helps,
    zonski

    Did you find this answer useful? If so, please indicate as 'correct' or 'useful '?

  • iTunes can't recognize their own applications and can't seem to sync my iPad by itself is

    iTunes can't recognize their own applications and can't seem to sync my iPad by itself either. It seems that, once Steve Jobs is dead the iTunes team said to themselves, ' Finally! We can screw this up like we always wanted to do without guidance or the reason behind us! "Does anyone have any input that would help me get back on the track, or I'd still appreciate an alternative to it. He did nothing but go straight downhill at high speed since Steve died.

    < re-titled by host >

    Rhaptor wrote:

    iTunes can't seem to recognize its own applications,

    What "applications"? iTunes is a unique application.

    and can't seem to sync my iPad by itself either.

    The iPad sync to iTunes. The iPad does not synchronize with itself...

    Looks like a time that Steve Jobs is dead

    You had intrigued me until this silly statement...

    Someone at - it an entry that might help it back on track

    What kind of input do you need?
    What's wrong?

    He did nothing but go straight downhill at high speed since Steve died.

    Maybe you should move to another platform with a responsible life.

  • I just bought an Iphone 6s and not yet am possession of en from the Sim Card. Ook, do you know if I can use the phone including applications via Wifi and put the chip later? Thank you. Renault JL

    I just bought an Iphone 6s and not yet am possession of en from the Sim Card. Ook, do you know if I can use the phone including applications via Wifi and put the chip later? Thank you. Renault JL

    No, because if you bought a new iPhone, then you need a SIM card to activate it before you can use the wifi applications.

    This is a phone after all, you don't need a sim card any to be able to activate it.

  • How can I Alt - Tab between Application Windows even?

    Chromebook/Windows/Linux I can alt tab between the application windows, but on mac, I can only switch between the applications themselves.

    Is there a way I can do so that I can alt tab between chrome windows?

    Thank you

    ADIN

    ADIN,

    Try (⌘ + ~).

  • 2007 Mac Pro screens with pixelated strange habits travel &amp; can't access files or applications.

    Have a 2007 Mac Pro 2.66 GHz Dual-Core Intel Xeon (OS 10.7.5). Today both screens started having strange pixelated, modes of travel, and we can not access files or applications.

    Thought that maybe the video card went bad, but would not be prevented from using the apps, or click files would it? Have to keep restarting the box. Working temporarily, then pixilation and locked files races again.

    Ideas or suggestions?  Don't know how to solve problems

    Thank you!

    Sara

    -What video card is installed?

    I suspect that the pixilation is due to a video card problem.

    Open the cover, with Mac off nd unplugged and clean inside. If the map includes a fan make sure it turns freely.

    -What do mean by "we can't access files or applications? What is going on?

  • I can't download Netflix. I can download/update of other applications.  I checked my limitations and my iOS is updated.  I tap on the little cloud to download, a circle flashes briefly then reappears the cloud with the arrow.  I rebooted and hard r

    I can't download Netflix. I can download/update of other applications.  I checked my limitations and my iOS is updated.  I tap on the little cloud to download, a circle flashes briefly then reappears the cloud with the arrow.  I rebooted and restarted hard.  Netflix working on other Apple devices.

    Try to download to your computer, iTunes then sync it to your device.

  • How can I transfer my files, applications, etc. of the older IMac (OS10.6.8) for the new IMac (OS10.10)? Please notify and TYI.

    Just bought a refurbished IMac (21.5-inch 2.9 GHz quad-core Intel Core i5 OS10.10 iMac). How can I transfer my files, applications, etc. the old IMac (20-inch 2.4 GHz Intel Core 2 Duo OS10.6.8) to the most recent IMac? Please notify and LYDIA.

    Move your content to a new Mac - Apple Support

    A new Mac set up an ancient, its backups or PC

Maybe you are looking for