Import JavaFX Packages To Run Through Command Line/CMD












1















So I am attempting to develop a JavaFX program using my favourite editor (Visual Studio Code) and then run that program through the windows 10 Command Prompt Command Line using




javac program.java




then




java program




I am currently running jdk & jre 1.8.0_181 (which I have been told already includes the JavaFX packages) however I keep getting compilation errors saying that the packages dont exist




Error: Package javafx.collections does not exist.



import javafx.collections.*;

^



I am currently in my third year of an information technology degree at university and on my university computers, javafx programs run completely normally just using the commands mentioned above however when I attempt to recreate these on my personal laptop, I get those errors. I know my program has no coding errors because it worked on their version with no compilation/runtime errors. If anyone can suggest any reasons why this may be happening (i.e. there is something I need to do to setup my javafx properly or I need to use a specific command to run the program) it would really help. Thanks.










share|improve this question























  • You're definitely using OracleJDK 8 and not OpenJDK 8, correct?

    – Slaw
    Nov 16 '18 at 11:36











  • Yes that is correct. I tried the 1.8.0_191 from Oracle and that didnt work @Slaw

    – Blake Dunstan
    Nov 16 '18 at 11:38


















1















So I am attempting to develop a JavaFX program using my favourite editor (Visual Studio Code) and then run that program through the windows 10 Command Prompt Command Line using




javac program.java




then




java program




I am currently running jdk & jre 1.8.0_181 (which I have been told already includes the JavaFX packages) however I keep getting compilation errors saying that the packages dont exist




Error: Package javafx.collections does not exist.



import javafx.collections.*;

^



I am currently in my third year of an information technology degree at university and on my university computers, javafx programs run completely normally just using the commands mentioned above however when I attempt to recreate these on my personal laptop, I get those errors. I know my program has no coding errors because it worked on their version with no compilation/runtime errors. If anyone can suggest any reasons why this may be happening (i.e. there is something I need to do to setup my javafx properly or I need to use a specific command to run the program) it would really help. Thanks.










share|improve this question























  • You're definitely using OracleJDK 8 and not OpenJDK 8, correct?

    – Slaw
    Nov 16 '18 at 11:36











  • Yes that is correct. I tried the 1.8.0_191 from Oracle and that didnt work @Slaw

    – Blake Dunstan
    Nov 16 '18 at 11:38
















1












1








1








So I am attempting to develop a JavaFX program using my favourite editor (Visual Studio Code) and then run that program through the windows 10 Command Prompt Command Line using




javac program.java




then




java program




I am currently running jdk & jre 1.8.0_181 (which I have been told already includes the JavaFX packages) however I keep getting compilation errors saying that the packages dont exist




Error: Package javafx.collections does not exist.



import javafx.collections.*;

^



I am currently in my third year of an information technology degree at university and on my university computers, javafx programs run completely normally just using the commands mentioned above however when I attempt to recreate these on my personal laptop, I get those errors. I know my program has no coding errors because it worked on their version with no compilation/runtime errors. If anyone can suggest any reasons why this may be happening (i.e. there is something I need to do to setup my javafx properly or I need to use a specific command to run the program) it would really help. Thanks.










share|improve this question














So I am attempting to develop a JavaFX program using my favourite editor (Visual Studio Code) and then run that program through the windows 10 Command Prompt Command Line using




javac program.java




then




java program




I am currently running jdk & jre 1.8.0_181 (which I have been told already includes the JavaFX packages) however I keep getting compilation errors saying that the packages dont exist




Error: Package javafx.collections does not exist.



import javafx.collections.*;

^



I am currently in my third year of an information technology degree at university and on my university computers, javafx programs run completely normally just using the commands mentioned above however when I attempt to recreate these on my personal laptop, I get those errors. I know my program has no coding errors because it worked on their version with no compilation/runtime errors. If anyone can suggest any reasons why this may be happening (i.e. there is something I need to do to setup my javafx properly or I need to use a specific command to run the program) it would really help. Thanks.







java javafx cmd visual-studio-code






share|improve this question













share|improve this question











share|improve this question




share|improve this question










asked Nov 16 '18 at 11:31









Blake DunstanBlake Dunstan

155




155













  • You're definitely using OracleJDK 8 and not OpenJDK 8, correct?

    – Slaw
    Nov 16 '18 at 11:36











  • Yes that is correct. I tried the 1.8.0_191 from Oracle and that didnt work @Slaw

    – Blake Dunstan
    Nov 16 '18 at 11:38





















  • You're definitely using OracleJDK 8 and not OpenJDK 8, correct?

    – Slaw
    Nov 16 '18 at 11:36











  • Yes that is correct. I tried the 1.8.0_191 from Oracle and that didnt work @Slaw

    – Blake Dunstan
    Nov 16 '18 at 11:38



















You're definitely using OracleJDK 8 and not OpenJDK 8, correct?

– Slaw
Nov 16 '18 at 11:36





You're definitely using OracleJDK 8 and not OpenJDK 8, correct?

– Slaw
Nov 16 '18 at 11:36













Yes that is correct. I tried the 1.8.0_191 from Oracle and that didnt work @Slaw

– Blake Dunstan
Nov 16 '18 at 11:38







Yes that is correct. I tried the 1.8.0_191 from Oracle and that didnt work @Slaw

– Blake Dunstan
Nov 16 '18 at 11:38














1 Answer
1






active

oldest

votes


















0














So I was the one to originally ask the question but I just found a solution that happens to work and for those in the future who have this issue, I uninstalled ALL versions of java that I had running on my computer completely through the "Add or Remove Programs" page. Once done I installed specifically this version of Java (none of the others worked properly for me but this may differ for you): Java SE Development Kit 8u192 (Found at https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html). Once installed, find your Java directory in your Program Files directory "C:Program Files", and open the jdk folder that you just installed. Get the path to this folder and copy it to the clipboard. Open your control panel, click on "System and Security" (if you cannot find this button, skip to the next step). Click on "System" > "Advanced System Settings" (on the left bar). Click the "Advanced" tab at the top, then "Environmental Variables..." at the bottom. Under "System Variables", look for a variable called JAVA_HOME. If you cannot find it, click "New", enter "JAVA_HOME" into the "Variable Name" field, and enter the path you copied to the clipboard earlier into the "Variable Value" field. Click "OK". Next find the "Path" variable and click edit. Look for a directory in the list similar to "C:Program FilesJava{some jdk here}bin". If you find one, click it, click delete on the right and then click new. Then in the created text field, enter "%JAVA_HOME%bin". Click "OK" until all of the windows we opened are closed. The javac should now work with JavaFX.






share|improve this answer
























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53337007%2fimport-javafx-packages-to-run-through-command-line-cmd%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    0














    So I was the one to originally ask the question but I just found a solution that happens to work and for those in the future who have this issue, I uninstalled ALL versions of java that I had running on my computer completely through the "Add or Remove Programs" page. Once done I installed specifically this version of Java (none of the others worked properly for me but this may differ for you): Java SE Development Kit 8u192 (Found at https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html). Once installed, find your Java directory in your Program Files directory "C:Program Files", and open the jdk folder that you just installed. Get the path to this folder and copy it to the clipboard. Open your control panel, click on "System and Security" (if you cannot find this button, skip to the next step). Click on "System" > "Advanced System Settings" (on the left bar). Click the "Advanced" tab at the top, then "Environmental Variables..." at the bottom. Under "System Variables", look for a variable called JAVA_HOME. If you cannot find it, click "New", enter "JAVA_HOME" into the "Variable Name" field, and enter the path you copied to the clipboard earlier into the "Variable Value" field. Click "OK". Next find the "Path" variable and click edit. Look for a directory in the list similar to "C:Program FilesJava{some jdk here}bin". If you find one, click it, click delete on the right and then click new. Then in the created text field, enter "%JAVA_HOME%bin". Click "OK" until all of the windows we opened are closed. The javac should now work with JavaFX.






    share|improve this answer




























      0














      So I was the one to originally ask the question but I just found a solution that happens to work and for those in the future who have this issue, I uninstalled ALL versions of java that I had running on my computer completely through the "Add or Remove Programs" page. Once done I installed specifically this version of Java (none of the others worked properly for me but this may differ for you): Java SE Development Kit 8u192 (Found at https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html). Once installed, find your Java directory in your Program Files directory "C:Program Files", and open the jdk folder that you just installed. Get the path to this folder and copy it to the clipboard. Open your control panel, click on "System and Security" (if you cannot find this button, skip to the next step). Click on "System" > "Advanced System Settings" (on the left bar). Click the "Advanced" tab at the top, then "Environmental Variables..." at the bottom. Under "System Variables", look for a variable called JAVA_HOME. If you cannot find it, click "New", enter "JAVA_HOME" into the "Variable Name" field, and enter the path you copied to the clipboard earlier into the "Variable Value" field. Click "OK". Next find the "Path" variable and click edit. Look for a directory in the list similar to "C:Program FilesJava{some jdk here}bin". If you find one, click it, click delete on the right and then click new. Then in the created text field, enter "%JAVA_HOME%bin". Click "OK" until all of the windows we opened are closed. The javac should now work with JavaFX.






      share|improve this answer


























        0












        0








        0







        So I was the one to originally ask the question but I just found a solution that happens to work and for those in the future who have this issue, I uninstalled ALL versions of java that I had running on my computer completely through the "Add or Remove Programs" page. Once done I installed specifically this version of Java (none of the others worked properly for me but this may differ for you): Java SE Development Kit 8u192 (Found at https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html). Once installed, find your Java directory in your Program Files directory "C:Program Files", and open the jdk folder that you just installed. Get the path to this folder and copy it to the clipboard. Open your control panel, click on "System and Security" (if you cannot find this button, skip to the next step). Click on "System" > "Advanced System Settings" (on the left bar). Click the "Advanced" tab at the top, then "Environmental Variables..." at the bottom. Under "System Variables", look for a variable called JAVA_HOME. If you cannot find it, click "New", enter "JAVA_HOME" into the "Variable Name" field, and enter the path you copied to the clipboard earlier into the "Variable Value" field. Click "OK". Next find the "Path" variable and click edit. Look for a directory in the list similar to "C:Program FilesJava{some jdk here}bin". If you find one, click it, click delete on the right and then click new. Then in the created text field, enter "%JAVA_HOME%bin". Click "OK" until all of the windows we opened are closed. The javac should now work with JavaFX.






        share|improve this answer













        So I was the one to originally ask the question but I just found a solution that happens to work and for those in the future who have this issue, I uninstalled ALL versions of java that I had running on my computer completely through the "Add or Remove Programs" page. Once done I installed specifically this version of Java (none of the others worked properly for me but this may differ for you): Java SE Development Kit 8u192 (Found at https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html). Once installed, find your Java directory in your Program Files directory "C:Program Files", and open the jdk folder that you just installed. Get the path to this folder and copy it to the clipboard. Open your control panel, click on "System and Security" (if you cannot find this button, skip to the next step). Click on "System" > "Advanced System Settings" (on the left bar). Click the "Advanced" tab at the top, then "Environmental Variables..." at the bottom. Under "System Variables", look for a variable called JAVA_HOME. If you cannot find it, click "New", enter "JAVA_HOME" into the "Variable Name" field, and enter the path you copied to the clipboard earlier into the "Variable Value" field. Click "OK". Next find the "Path" variable and click edit. Look for a directory in the list similar to "C:Program FilesJava{some jdk here}bin". If you find one, click it, click delete on the right and then click new. Then in the created text field, enter "%JAVA_HOME%bin". Click "OK" until all of the windows we opened are closed. The javac should now work with JavaFX.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Nov 16 '18 at 16:22









        Blake DunstanBlake Dunstan

        155




        155
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53337007%2fimport-javafx-packages-to-run-through-command-line-cmd%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Bressuire

            Vorschmack

            Quarantine