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.
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 Files\Java{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.
Related
I know this question has been asked before, but there were no straight answers.
I am a high school student in a programming class, and I am having an issue with my IDE, which is jGRASP. I normally use Eclipse, but the class requires me to use jGRASP. When I try to save and run a basic program, I get this error:
I think it has to do with my pathing, as I use Linux. The current path is /home/arnav/Desktop/School/APCS.
I appreciate any help.
Scroll the output up to see the error.
Most likely you have the JRE installed but not JDK, so there is no java compiler, and the message is that javac was not found, or the JDK is installed but its "bin" directory is not on the system PATH.
The problem may be connected with jGRASP project workspace setting. Click the Settings menu, point to Compiler Settings, and then click Workspace. The Settings for workspace dialog box appears.
Under the FLAGS or ARGS section of the dialog box, click the dot inside
the square next to the Compile option and enter the compiler option (-d).
Then click the Apply button.
Click the OK button to close the dialog box, and then compile your
program as usual.
But if (-d) appear two times in your compilation code line, remove one by following the previous instruction above
I visited the link that is shown by Android Studio. But they did not have that exact version of the JDK. I installed what I could find for Windows. I thought I picked the correct file but still getting an error. What am I missing here?
This is a screenshot of what I tried
What I think possibly happened here is that your Path is not appropriately specified in Environment variables.
Follow the steps and your problem should be fixed:
Cancel the installation (For now)
Open up the Control Panel
Go to the "System and Security section"
Click on "System"
On the top left corner, it should say something like "Advanced System Settings". Open that up, and type in a password if necessary.
Under the "Advanced" tab, click "Environment Variables"
Under the "System Variables" section, scroll down until you find a variable called "Path"
Select it, and click the edit button.
DO NOT delete or touch anything here yet, but instead try to find a location that says something like: "C:\Program Files\Java\jdk1.7.0_40\bin;"
If you do find that, ONLY EDIT the "jdk1.7.0_40" to what your current JDK is. For example, if I had the same JDK as you, 1.7.0_79, the location would be changed to "C:\Program Files\Java\jdk1.7.0_79\bin;"
Save and exit out of all the windows we opened.
Restart your installer, and it should work!
Good Luck!
I'm trying to install phonegap and the Android platform guide says
You may also need to enable Java and Ant. Open a command prompt and
type java, and also type ant. Append to the PATH whichever fail to
run: ;%JAVA_HOME%\bin;%ANT_HOME%\bin
But when I do so, I get:
C:\Users\Phillip>java
Error: could not open `C:\cf_dev\JDK\lib\amd64\jvm.cfg'
I'm not sure where cf_dev came from, but apparently it's causing java to not run correctly from the command line.
From the Phone Gap Documentation:
To modify the PATH environment on Windows 7:
-Click on the Start menu in the lower-left corner of the desktop, right-click on Computer, then click Properties.
Click Advanced System Settings in the column on the left.
In the resulting dialog box, press Environment Variables.
Select the PATH variable and press Edit.
Append the following to the PATH based on where you installed the SDK, for example:
;C:\Development\adt-bundle\sdk\platform-tools;C:\Development\adt-bundle\sdk\tools
The answer is to uninstall Java and reinstall it.
I am new to Eclipse and Java programming having mainly worked with Microsoft Visual Studio.
I installed Eclipse (Kepler 4.3) with no issues along with WindowsBuilder and SWT.
I created a new project adding in references to SWT, both WindowsBuilder JARS, and resty. Into the project, I created a new package and selected a SWT composite. I gave appropriate names.
The GUI designer came up with no issues. I added in a couple of controls. The idea is to create a hello world application, display that application, and build it. Eclipse has automatically build checked.
Okay, the IDE in designer view shows the GUI of my Hello World application and the source view the source, so no problems there.
I press Run, and the first time I had to select a run configuration, which I selected EclipseStarter. There was not many options. I click on run and nothing happens.
If I go to the project's bin package folder, I see a file with a ".class" extension.
Why does pressing Run|Run (Ctrl+F11) do nothingness? There is a brief hour glass showing, but then nothing after that.
How do I launch the application from within Eclipse?
Is the generated ".class" file the correct runtime? I double click on that and Windows does not know what to do with it?
The end platform will be CentOS, but Java as I understand things, should be platform independent, so my Hello World application should run on my Windows 7 Pro box just as nicely. (I did not try CentOS yet) as I want to see it work on my desktop and know what file to copy over.
I think you selected the wrong option EclipseStarter.
Try running it as a Standalone Java Application.
It is a Standalone Java Application that you're building, right?
(I mean, the analogue of a Windows Forms App in .NET)
1. I guess because you selected the wrong type.
2. Ctrl+F11 is for Running it, F11 only is for Debugging it.
3. The class file has to be run by a JVM, Windows cannot run it directly,
it is not anything like a native executable or like a .NET assembly
(which Windows 7 knows how to run). But as you're using Eclipse you
already have a JVM.
The solution is multi-fold.
I had to delete Eclipse and install the 32-bit version of everything. That simplified life, as 64-bit caused issues running.
Create a new package
From the toolbar, select "Create new visual classes" drop down. Select "SWT" --> "Application windows".
Create the application window
Press the play button, 8th icon having selected the package first.
That enabled to run my Hello World on Windows. The output is a .java.
I still have a problem running from the command line, but that is a different issue.
Summary: My main issue was creating a SWT application window first and that I should have 32-bit for everything.
I received my new computer friday and after moving over all of my development projects, my Eclipse "hover" popups have quit working. What I mean is usually when I hover over an element/method/etc... , a small window with the javadoc info will pop up telling me parameters, and a description of the method. Now it just says:
Note: The Javadoc for this element could neither be found in the attached source nor the attached Javadoc.
I've already seen this SO post and tried it. Although I will say there are 15 different packages when you go into preferences>java>installed jre's>edit. All point to an http:// address for the docs.
Also the Android documentation I installed doesn't pull up either (which is what I'm developing for).
Is this with your standard Java classes/methods/etc. or for custom/Android code? I think your problem is because of your installed JRE. You need to download the Java SE 6 SDK from here. The JDK has all of the standard Java classes' source files. Once you have it installed, in Eclipse, go to
'Window'->'Preferences'->'Java'->'Installed JREs'.
Click the 'Add...' button and select 'Standard VM'.
In the 'JRE home' field put "C:\your\path\to\java\jdk1.6_xYourVersionx". It will automatically populate the 'JRE name' field and import all of the necessary jars.
Click 'Finish' and then 'OK'.
If it's a problem with some nonstandard Java code, make sure that you've downloaded the source code. Then,
Right-click on your project and go to 'Build Path'->'Configure Build Path...'.
Select the 'Libraries' tab and expand the entry for your jar file. There should be a sub-entry 'Source attachment: (None)'.
Select it and click the 'Edit...' button and put in your path to the source code.
Click 'OK' and 'OK'.
NOTE: If you've already installed the JDK, you can edit your current JRE to point to the jdk folder instead of the jre folder i.e. "C:\Java\jdk1.6.0_xx" instead of "C:\Java\jre6".
2nd NOTE: Your bit version of Java must match your bit version of Eclipse, so 32-bit Eclipse requires a 32-bit Java, etc.