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
Related
I recently wanted to try Java, so i started out with Hello World! I installed OpenJDK 11 for VSCode and ran the program, but it produced the following error:
Running the contributed command: 'java.execute.workspaceCommand' failed.
I looked at the Java runtime configuration and it detected the JDK, but it showed that error!
Go to extensions tab
Search for Java extension package
Click on disable. If it gets disabled, well and good otherwise a pop-up may appear at the bottom, in the bottom of pop-up, click on disable for all windows or something similar text.
Enable the Java extension package again.
In my case, it worked after step 4, let me know about yours
In VSCode:
Go to "Extensions"
Type "Java Extension Pack"
Uninstall
Install
I had this error, and it disappeared after reloading the window:
<Ctrl-P> Developer: Reload Window
or simply,
<Ctrl-R>
I was running into this problem when something with my maven repository settings was incorrect. When I placed the right settings.xml file in the .m2 directory, I was able to launch the program from vscode.
I could also be related to this issue:
https://github.com/redhat-developer/vscode-java/issues/1929
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.
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've got a problem with Eclipse Kepler. In my Java project i've got some warnings and now they are shown as error marks (red crosses) in the project explorer.
It looks like this picture http://i.stack.imgur.com/H8j7f.png
So my question is:
Is it possible to switch it back to the yellow cross for warnings and red cross for errors?
I haven't found anything about it, so I hope you can help me.
Edit:
I've made a test project, and here is a screenshot:
Thanks!
It might me because you set the compiler to mark as errors what used to be a warning. You can set this in the Window->Preference menu. So open it and go into Java->Compiler->ErrorsWarnings and check if everything is like you want it to be.
You can also check into the compiler menu (Java->Compiler) if the java Compiler compliance level is set as you want it to be as #Chrylis suggested.
Otherwise it might be because your program is unable to compile because of a dependency problem then you might want to check your build path or JRE in the Run configurations menu.
Right click on your project -> Run as -> Run Configurations.
I solved it :)
At the first start I took my old workspace as workspace. Because of that there was an Error "Missing Action set" (I've found the "error log"-window :) ) and thats why the red crosses has been shown.
Now I have a new workspace and now everything is fine!
When I try to add a Java Exception Breakpoint, I get a blank white screen with no "Matching items:" At the bottom I don't have a package symbol. Is there any way I can configure Eclipse so I can add a breakpoint corresponding to a Java Exception? I am remote debugging.
I have experienced the same behaviour. The build works otherwise fine, and JDK is in the build path. Eclipse Kepler SR 1, Windows 7.
For me, the dialog started to work when I went to Run -> Debug Configurations -> [my debug configuration] -> source tab and added [myjdkpath]/jre/lib/rt.jar there manually. After doing that, the other exceptions appeared as well.
When I removed it again after adding, I was still able to see all my exceptions like supposed to. I guess you can just add any library there, debug, and remove it for Eclipse to "refresh" itself.
For me the cause was that the nature of the project the .target file resided in lacked a Java nature, that is it was just a 'Generic' project.
Open the normally hidden .project file and modify the <natures> section by adding the java nature as in the snippet below then re-open your project.
...
<natures>
<nature>org.eclipse.jdt.core.javanature</nature>
</natures>
...
When I open up the "Add Java Exception breakpoint" dialog window, there is already "Exception" displayed in the input field and all exceptions eclipse knows are listed.
You should type in the name of the exception into the input field. If you don't know the exact name you should write lower-case and you can use "*" as a wildcard.
Then the types matching that name should occur in the list and you can choose them for your breakpoints.
Be aware that these special breakpoints may slow down the debugged process signifiantly. So don't forget to remove them after debugging. This is a lesson I learned the hard way. ;)
I had this problem with Eclipse Neon and JDK 1.8u131. I had created a new workspace and imported only Maven projects. When I tried to add an exception breakpoint, the Matching items area were blank.
The currently accepted answer of "adding the JDK's rt.jar" did not fix the problem for me.
What did work is the following:
Find a "runnable" Java class in one of the imported Maven projects; runnable meaning: a class with a main() method.
Right-click on the "runnable" class
From the right-click menu, select Run As->Java Application.
Eclipse kicks off an index operation.
Click on the Debug perspective and click on the Breakpoints view's Add Java Exception Breakpoint toolbar icon.
Eclipse displays exceptions in the Matching items area populated normally.
The specific version of Eclipse on which I had this problem is:
Eclipse Java EE IDE for Web Developers.
Version: Neon.2 Release (4.6.2)
Build id: 20161208-0600
Windows 10 64-bit anniversary update