Error with the java command (jvm.cfg) - java

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.

Related

Import JavaFX Packages To Run Through Command Line/CMD

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.

How can you manually find the Java Development Kit when setting up Android Studio on a PC running Windows 8.1?

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!

Ant - Eclipse [Reference to undefined variable INSTALLED_PATH]

I cannot run ant files in eclipse, when i try to run them the following dialog appears.
SOLVED: I am not sure what was the problem, but I think the java/ant path in windows path variable was the problem.
However I have removed any extra value from windows path variable; restart the computer and now every thing works fine.
Referred from : Eclipse 3.7, Ant, Java 1.7
In Eclipse, click the ant file -- Run As -- External Tools Configuration and click on the JRE tab.
Select "Run in the same JRE as the workspace"
I think The problem is because of:
You are using INSTALLED_PATH variable in your ant script which is not undefined.
specify value for INSTALLED_PATH in the below screen
Right click on ant file, then choose Run AS-> Ant build(2 Option), then select environment tab in the pop up, then add a new variable "INSTALLED_PATH"

Java - Different behaviour between exported JAR and Eclipse IDE

today I got a strange problem while trying to call a batch file from Eclipse IDE.
The setting for a normal user is:
Call a .bat file
This sets some environment variables
And calls a Eclipse RCP application
The setting for my program is:
Call the same .bat file via Runtime.exec()
When calling it as normal user, all works well, the RCP gets started.
When calling it within Eclipse IDE via Runtime.exec() I get an error message complaining that Program Files\jre6\bin\server\jvm.dll could not be found (although it is there).
When exporting my program as an executable .jar file, it works well like I would click on the .bat myself.
What is the difference? (Operating system is Win7)
In Eclipse,
Right click on the project and click "Properties".
Select "Java Build Path".
Select "Libraries" tab.
Select "JRE System Library" and click "Edit".
Check if the System Library points to a valid JDK installation(not JRE). If it doesn't point to a valid JDK installation.
Select "Alternate JRE" and click on "Installed JREs"
Click on Add, point to valid JDK installation and click OK.
In "Alternate JRE" drop down, select the newly added valid JDK and click Finish.
Run the program and check.
Ok got it.
It seems to be a specific problem of Eclipse 3.7.
After installing 4.2 all works perfectly well.

New computer, broken Eclipse

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.

Categories