I have been using vmware to log into the lab machines at my uni. I just started using vscode on my pc. I installed latest jdk 16.0 and i installed the java extension pack from vscode. But it still wont let me run or compile my program
I keep getting this error, thought it was an issue about the paths after a little bit of research so i made the java:home path to where jdk folder is in my c drive and i still get this error:
c:; cd 'c:\Users\Aaron Mark\Desktop\UNI\FinalAssignment'; & 'c:\Users\Aaron Mark\.vscode\extensions\vscjava.vscode-java-debug-0.34.0\scripts\launcher.bat' 'C:\Program Files\Java\jdk-16.0.1\bin\java.exe' '--enable-preview' '-XX:+ShowCodeDetailsInExceptionMessages' '-Dfile.encoding=UTF-8' '-cp' 'C:\Users\Aaron Mark\AppData\Roaming\Code\User\workspaceStorage\2bfa7b3e373492b1fc42e07c42d17320\redhat.java\jdt_ws\FinalAssignment_fe08a03d\bin' 'QuestionOnePartA
How do i fix this class not found error?
I think you point to the blue sentences displayed before the real output, actually they are not errors but execution scripts, which shows the necessary building and compiling commands to get the output:
If you don't want to see these scripts but pure output, create a launch.json and add "console": "externalTerminal", in configurations. Run without debugging(Ctrl+F5) can open a new external Terminal and no execution scripts shown:
This is not error.
IDE is printing all the program being used for compiling and running the code.
'-cp' : this is your classpath. You can add more external library using it.
I am attempting to build hsdis for use on Windows. I first tried using Cygwin via the following command:
make ARCH=amd64 BINUTILS=binutils-2.26 MINGW=x86_64-w64-mingw32
And receive this log file with errors beginning at line 103.
I then attempted to use the MinGW64 cross-compiler (as outlined here) on a Linux VM with the following command:
make ARCH=amd64 MINGW=x86-64-w64-mingw32 BINUTILS=binutils-2.26
However, the result was this log file and no built DLL.
Any advice would be greatly appreciated, and I would be more than happy to provide any additional information. Thank you!
I'm trying to run sample JavaFX code (taken from the 5th edition of Java Illuminated) under JavaFX 11 and Java 11, using jGRASP 2 under Windows 10.
I've read through the "Getting Started with JavaFX" guide (https://openjfx.io/openjfx-docs/) extensively, and while I've made some progress, I'm stuck.
I've downloaded the latest ZIP file, unpacked it, and updated the CLASSPATH to include a path to the jar files needed to compile. I can successfully compile the file. However, when I try to run, I get the following error message:
Error: JavaFX runtime components are missing, and are required to run this application
The "Getting Started" guide says that this can be fixed by adding the following options to the runtime call:
--module-path "[path]\lib" --add-modules=javafx.controls,javafx.fxml
I've added the options, but I'm still getting the error message.
Previous StackOverflow articles usually end with the option setting above; alas, I can't figure out what else to do.
As a first time user, I've managed to make it work, but it was not straightforward to me.
I guess there are no many people familiarized with this IDE, so I'm going to post the steps I followed, as a basic tutorial:
Download and install jGRASP version 2.0.5_05 Beta.
Since I have a few JDKs installed, it selected by default JDK 10.0.2, so my first step was to find a way to work with JDK 11. That can be done in Settings -> jGrasp Startup Settings, where I can set the path for my java executable:
Then I restarted jGrasp. You can verify which JDK the IDE is using in Tools -> System Info -> Java Version.
Open HelloFX sample class. I've started with the most basic sample from the OpenJFX docs. The code can be found here.
Build -> compile, as expected, will throw a bunch of errors given that JavaFX is no longer part of the JDK:
Following the OpenJFX docs, we need to download the JavaFX SDK from here, and then add the library to the classpath. Go to Settings -> PATH/CLASSPATH -> Workspace, press New, and add, one by one, the different JavaFX jars from the downloaded SDK/lib folder (at least javafx-base.jar, javafx-graphics.jar and javafx-controls.jar).
Build -> compile should work now.
Next step: Build -> Run. This fails:
----jGRASP exec: java HelloFX
Error: JavaFX runtime components are missing, and are required to run this application
----jGRASP wedge: exit code for process is 1.
----jGRASP: operation complete.
That was expected. According to the docs, we need to set the module-path and add-modules arguments.
First attempt: use Run arguments. After setting:
--module-path /Users/<user>/Downloads/javafx-sdk-11.0.2/lib --add-modules javafx.controls
running again failed with the exact same error message as above, but with one difference in the console log:
----jGRASP exec: java HelloFX --module-path /Users/<user>/Downloads/javafx-sdk-11.0.2/lib --add-modules javafx.controls
What's wrong with that!? Well... if you try that on command line, it will fail as well, because the order of arguments is wrong, the vm arguments should go before the class name.
In conclusion: Run arguments are not VM arguments!
Second attempt: In order to provide the VM arguments, the option I found was to edit Settings -> Compiler settings -> Workspace. By default, it is using jdk (integrated debugger) - generic. You can view it and see that for Run it uses:
java %S -ea %S %<FLAGS2> %<MAIN_CLASS> %<ARGS>
So instead of ARGS we need to find a way to set FLAGS2.
Luckily, next to the Environment tab, there is a Flags/Args tab, and there we can set our vm arguments in FLAGS2:
--module-path /Users/<user>/Downloads/javafx-sdk-11.0.2/lib --add-modules javafx.controls
Apply, close the dialog, and Build -> Run the class, now it will work!
If you see the console log, it contains exactly the command you would use when running on command line:
----jGRASP exec: java --module-path /Users/<user>/Downloads/javafx-sdk-11.0.2/lib --add-modules javafx.controls HelloFX
----jGRASP: operation complete.
I guess the next step will be running a more complex project...
Try simply creating a launcher with only a main Method. It could look something like this:
package application;
import javafx.application.Application;
public class MyAppLauncher {
public static void main(final String[] args) {
Application.launch(MyApp.class, args);
}
}
(you can leave the old main Method unused in your App for the time-being)
This worked for me with JDK 13 & JavaFX 13 & Eclipse 2019-12 under Ubuntu.
(I created the Project using "new/Maven Project/Simple Project" and then just added JavaFX, Logging & other stuff as dependencies in pom.xml, which all landed on the Classpath. Only the JDK was on the Modulepath)
No need to bother about Java Modules.
If that works, you can take time to learn about Java Modularisation another day...
...and remember to vote for this Answer. :-)
I have no problem with:
org.gradle.java.home=C:/Program Files/Java/openjdk1.8.0_202
in my (global) gradle.properties file. Also, no problem without it (with nothing set). But if replace it with one of below configurations (all paths are valid):
org.gradle.java.home=C:/Program Files/Java/openjdk-9.0.4
org.gradle.java.home=C:/Program Files/Java/openjdk-10.0.1
org.gradle.java.home=C:/Program Files/Java/openjdk-11.0.1
org.gradle.java.home=C:\\Program Files\\Java\\oraclejdk-11.0.1
then I will get an error message (same for each) after I save the file and import Gradle changes in IntelliJ IDEA:
Unable to start the daemon process.
This problem might be caused by incorrect configuration of the daemon.
For example, an unrecognized jvm option is used.
Please refer to the user guide chapter on the daemon at https://docs.gradle.org/5.0/userguide/gradle_daemon.html
Please read the following process output to find out more:
OpenJDK 64-Bit Server VM warning: Ignoring option MaxPermSize; support was removed in 8.0
Error: Could not find or load main class java.base.java.lang=ALL-UNNAMED
Caused by: java.lang.ClassNotFoundException: java.base.java.lang=ALL-UNNAMED
The note is the issue is only for IDE Gradle sync. Gradle tasks themselves work correctly (independent from IDE)! Even when I run gradle --status (see here about it) can see everything is OK and daemon is running using JDK 11:
>gradlew --status
PID STATUS INFO
10668 IDLE 5.0
And the path of PID: 10668:
>wmic process where "processId=10668" get Name, ProcessID, ExecutablePath
ExecutablePath Name ProcessId
C:\Program Files\Java\openjdk-11.0.1\bin\java.exe java.exe 10668
Finally, I found out the issue was from my IDE settings. It was from SDK Table.
I don't know why correcting them from Project Structure (or Structure for new Projects in Other Settings) couldn't solve the issue. Finally, I imported it (and only it) from a fresh installation.
Note: You don't need a fresh installation really. Just enough to close your IDE, rename its configuration directory and re-open it.
Then IDE starts freshly. This is an opportunity for the test. If OK export pointed setting ... File -> Export Settings ...:
to a file. Then return to your previous state and import the exported file:
If the issue reverted you need to check other settings (other than SDK Table).
I am having issues assembling Spark using the sbt on my machine.
Attempting the assembly without allocating extra memory either runs out or times out on the garbage collector; the exact issue has been different at different times I have tried. However, any attempt to modify the allocated memory, either through Xmx or Xms, and whether giving more or restricting, fails as the sbt doesn't recognize -Xmx or -Xms as a command.
Here is a sample of the kind of command I have been trying (from the source directory of Spark):
sbt -Xmx2g assembly
Here is the error I have been receiving:
java.util.concurrent.ExecutionException:java.lang.OutOfMemoryError: GC overhead limit exceeded
Use 'last' for the full log.
Not a valid command: Xmx2g
Not a valid project: Xmx2g
Expected ':' (if selecting a configuration)
Not a valid key: Xmx2g
Xmx2g
^
I am running 64-bit Java, version 1.8.0_20.
Try creating a new environment variable SBT_OPTS, with the value "-XX:MaxPermSize=1024m". That should give sbt the memory it needs without producing your error.
Check the docs: Building Spark with Maven.
Setting up Maven’s Memory Usage
You’ll need to configure Maven to use more memory than usual by setting MAVEN_OPTS. We recommend the following settings:
export MAVEN_OPTS="-Xmx2g -XX:MaxPermSize=512M -XX:ReservedCodeCacheSize=512m"
Then you can build it with:
mvn -DskipTests package