How to configure AsciidocFX with Path to PlantUML - asciidoc

I am using AsciidocFX version 1.7.4 to edit Asciidoc documents. When working on PlantUML diagrams and creating a syntax error, which is caused by using syntax that is not supported in older versions, I see the following message
PlantUML 1.2021.2
This version of PlantUML is 398 days old, so you should consider upgrading...
I have the following version installed on my system:
PlantUML version 1.2022.3 (Tue Mar 29 09:10:57 PDT 2022)
(GPL source distribution)
Java Runtime: OpenJDK Runtime Environment
JVM: OpenJDK 64-Bit Server VM
Obviously, AsciidocFX finds a different version. How can I configure AsciidocFX to use my latest locally install version? I went through the Settings dialogs as well as looked in the ~/.AsciidocFX-1.7.4 folder but could not find any clue.

planumtl consist of a single plantuml.jar file. You should find a plantuml-1.2021.2.jar file in your installation folder, under lib, delete it and replace it with your own version.

Related

BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 61 on Apple Arm

I have installed Android Studio Canary 2020.3.1.22 and trying to run Flutter project on Apple Silicon(ARM) Mac. Unfortunately, it is giving me this error when I try to run default flutter counter app.
Here is the error I am getting:
Could not open settings generic class cache for settings file '/Users/khamidjonkhamidov/StudioProjects/dummy/android/settings.gradle' (/Users/khamidjonkhamidov/.gradle/caches/6.7/scripts/f0emg6u6oecmxqzgk5g9nn4ui).
> BUG! exception in phase 'semantic analysis' in source unit '_BuildScript_' Unsupported class file major version 61
Gradle version: 6.7 but I tried 7+
JDK version 17
I would really appreciate your help)
According to the official grade docs: Java 17 and later versions are not yet supported.
You can check compatibility here.
So I have installed Java11 from Azul.
p.s. don't forget to change jdk version in Android studio
Preferences -> Build -> Build Tools -> Gradle -> Gradle JDK
Got the same error while I upgraded my build.gradle to Java 17. And the fix is as simple as we think:
Gradle starts supporting Java17 only from 7.3 release
Here's the complete reference for Java vs Gradle compatibility:
https://docs.gradle.org/current/userguide/compatibility.html
Upgraded my gradle to 7.3 in gradle-wrapper.properties.
https\://services.gradle.org/distributions/gradle-7.3.3-bin.zip
Some of you may experience now the Gradle dependency cache corrupt error after this like me. So better delete the gradle-wrapper.jar and reinstall it using the command:
./gradlew wrapper
Everything will work perfectly fine from here.
In case if you still face Gradle corrupt issue, please check whether you are using latest version of IDE especially Intellij.
First, you can execute this command: /usr/libexec/java_home -V, to retrieve all installed jdsk:
[~]$ /usr/libexec/java_home -V
Matching Java Virtual Machines (4):
17.0 (x86_64) "Oracle Corporation" - "OpenJDK 17.0" /Users/ciccio/Library/Java/JavaVirtualMachines/openjdk-17.0/Contents/Home
14.0.1 (x86_64) "Oracle Corporation" - "OpenJDK 14.0.1" /Users/ciccio/Library/Java/JavaVirtualMachines/openjdk-14.0.1/Contents/Home
11.0.12.1 (x86_64) "Amazon.com Inc." - "Amazon Corretto 11" /Users/ciccio/Library/Java/JavaVirtualMachines/corretto-11.0.12/Contents/Home
10.0.2 (x86_64) "Oracle Corporation" - "Java SE 10.0.2" /Library/Java/JavaVirtualMachines/jdk-10.0.2.jdk/Contents/Home
1.8.0_302 (x86_64) "Amazon" - "Amazon Corretto 8" /Users/ciccio/Library/Java/JavaVirtualMachines/corretto-1.8.0_302/Contents/Home
Now, imagine you want to remove the version 17:
[~]$ java -version
openjdk version "17" 2021-09-14
OpenJDK Runtime Environment Homebrew (build 17+0)
OpenJDK 64-Bit Server VM Homebrew (build 17+0, mixed mode, sharing)
Go into the path of the version you want to remove (in this case "/Users/ciccio/Library/Java/JavaVirtualMachines/openjdk-17.0/Contents/Home"), and delete entire folder: "/Users/ciccio/Library/Java/JavaVirtualMachines/openjdk-17.0".
Once removed, go back on terminal and use:
[~]$ /usr/libexec/java_home -v 14.0.1 --exec javac -version
javac 14.0.1
to force the new version to use (14.0.1).
Next check if is correct:
[~]$ java -version
openjdk version "14.0.1" 2020-04-14
OpenJDK Runtime Environment (build 14.0.1+7)
OpenJDK 64-Bit Server VM (build 14.0.1+7, mixed mode, sharing)
[~]$
Your Gradle now is back to work.
Basically, I installed jdk using brew install java which was not compatible with my current gradle I guess. So
I uninstalled java first using: brew uninstall java
installed JDK 8 or JDK 11 from azul.
Installed gradle: gradle-6.9-all.zip
When done, everything worked smoothly.
I found a way to fix this error without messing with the locally installed Java version or Gradle. Here is what I did:
If you are developing a Flutter project and got this error, go to File -> Close Project.
Then re-open from the android folder (omit this if you received from a pure Android project).
Now, Gradle may detect the issue on its own, and it will take a while to check. After it is done, it may provide upgrade steps in an upgrade assistant window at the bottom of the window along with logcat, build, terminal etc… which you need to accept and tell it to execute. Once it finishes, the error is resolved, and you are good to go.
If it does not seem to do anything on its own, then please open the Project Structure tab. Now select the latest Gradle version available that does not contain -rc (you don't want these, most of the time they are not stable releases).
Now select the JDK version that Gradle uses by going to Gradle (sidebar on the right of the window) -> Wrench Icon -> Gradle Settings. Select a compatible JDK version according to the Gradle project's documentation, as found HERE. Current latest stable version of Gradle is 7.4 with maximum supported JDK version 17 (also latest I believe if you use something like openJDK which I use), but Android Studio version at 7.1 so be careful.
Tested on MacBook Air M1 running macOS Monterey 12.2.1.
I faced this error when I updated my android studio
Solution:
you need to upgrade your distributionUrl According to the java version
‌Below is the Java version and Supported Gradle version
Check currently active java version:-
javac -version
If it is greater than 11 downgrade it to 11 or 8. Check your available java jdk version installed:-
/usr/libexec/java_home -V
If java 11 or 8 is not installed first install one of them using this link:- Download jdk 8
then change the default java version in .bash_profile
Edit .bash_profile
sudo nano ~/.bash_profile
Add 1.8 or 11 as default. (Add below line to bash_profile file)
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
OR
export JAVA_HOME=$(/usr/libexec/java_home -v 11)
Now Press CTRL+X to exit the bash. Press 'Y' to save changes. And reload bash_profile
source ~/.bash_profile
Happened with newly created Flutter app in 2023 January with Mac Mini M1. If you have another working Flutter apps do not downgrade or update Java version as it will cause problem with all other working ones. Find gradle-wrapper.properities file inside gradle/wrapper folder (directly inside Android folder) and check gradle version. You just need to use newer version of gradle. I replaced this one and used flutter run command from terminal and it worked:
distributionUrl=https\://services.gradle.org/distributions/gradle-7.5-all.zip
With this one:
distributionUrl=https\://services.gradle.org/distributions/gradle-7.6-all.zip
No need to do anything else. Version number may be different for you depending on when you are trying this and what Java version you have.
Finally I Got the Solution
It is very easy to solve
step 1 : select the gradle version which support your java version link
step 2 : open your project navigate to your_project_name/android/gradle/wrapper/gradle-wrapper.properties
step 3 : in distributionUrl change the gradle version according to your java version
That's it No need to install older java versions
Happy coding
System: Mac M1, Android Studio Electric Eel (2022.1.1 Patch 1), JDK 19.02
I encountered this error when created a fresh project using flutter create and tried to run it in Android Studio.
Now I've got an interesting solution that worked for me:
Open the flutter project in Android Studio
Open build.gradle, the one under android folder
On the top right it shows "Open for Editing in Android Studio" (although it's already in Android Studio!). Click on that to open it for editing. I opened it in another window, but doesn't matter.
It starts to automatically download and update gradle to sync the build file. At one point, tt might also prompt you to upgrade gradle, which is good to do.
Done! Close the build.gradle and re-run the project. It should build and run fine.
I had this issue when I set the target for a new IntelliJ Kotlin project to be Java 17. My fix was to:
set the target to 9 in build.gradle.kt
close the project
delete the .gradle and .idea directories from the project folder
remove the project from the recent projects list
open the gradle file from IntelliJ and get it to rebuild everything
Open the Gradle settings and change the Gradle JVM to the same JDK version you are using.
(I am using 14.0.2)
This worked for me.
I had that Issue creating Projects from IntelliJ.
It seems the issue was the Gradle JVM Version.
Here is a configuration that works:
System:
Mac with ARM, Mac OS 12.1, M1 Max
java version 18.0.1-zulu
kotlin version 1.7.0
gradle version 7.5
I installed those version with sdkman https://sdkman.io/
and set the config manually on intellij (See attached Screenshot for Details)
IntelliJ Gradle JVM config
My solution was to open the android project in Android Studio. It detected the needed Gradle update and performed the update upon command.
I can't speak for everyone, but for me, I went into Flutter project's file android/gradle/gradle.properties, and changed the org.gradle.java.home value so that it pointed to a folder containing JDK 11 instead of JDK 18. That way, it used a JDK version that was actually supported.
On my side I fixed this issue by setting the default Java Version to 8 (download it if needed)
Mac:
Open Terminal.
open ~/.bash_profile
Add
# SWITCH TO JAVA VERSION 8
export JAVA_HOME=`/usr/libexec/java_home -v 1.8`
Save and restart Android Studio.
Giving my two seconds here...
In my case, I could fix it by finding my gradle version in the file gradle.wrapper.properties and checking the compatibility with the JDK, so I needed to install the JDK 16, so in my build.gradle(:app) I put this line of code inside the android {} :
compileOptions {
sourceCompatibility JavaVersion.VERSION_16
targetCompatibility JavaVersion.VERSION_16
}
After this I build my android version again, and it worked.
I ran into this issue on VSCode+Mac using the Gradle for Java extension.
My project uses Java 17 but Gradle was using JDK19, which I also had installed.
I removed the jdk-19.jdk folder from /Library/Java/JavaVirtualMachines and then ran the "Clean Java Language Server Workspace" task in VSCode.
After that, Gradle successfully built and I was even able to put the jdk-19 folder back and things continued to work.
Changing the Java Version in the Intellij resolved the issue.
Easy fix in 2023:
Command in the terminal:
export JAVA_HOME=$(/usr/libexec/java_home -v 1.8)
Check classpath, current working one:
classpath 'com.android.tools.build:gradle:7.1.2'
Check gradle-wrapper.properities file:
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-7.4-all.zip
If still not solved you need to change Gradle JDK from inside Android Studio like below.
After that you can run fluter app directly from terminal without any issue. Note: Android Studio default JDK (11.0.15) does not work and causes this issue. Azul Zulu 16.0.2 works and solves the issue.
In my case, I use the react native cli and my android gradle is 7.3.1. I open the android folder in the android folder in the android studio and it suggests my gradle once after degradation it works fine
Windows Users
Open Android Studio and Click on Setting ICON far right. And Go to Project Structure Option and select the SDK's Version 11.0.15 and click apply than on the left side click on Module Option and select Module SDK's options and select Project SDK 11. and at the bottom at Project Settings CLICK on SDK and select on 11 SDK versions. It will give you the JDK path
C:\Program Files\Android\Android Studio\jbr
Copy this path and Open the System Environment Variable Create a New JAVA_HOME path with the location
and click OK and save everything Now run your app in ANDROID STUDIO and ENJOY!
Context: Flutter, Mac M1, Java 19.0.2
Problem occured on following command:
flutter build apk
I just installed (reintalled) gradle via homebrew like this:
brew install gradle
I suppose it was related to my recent upgrade (Java was upgraded to OpenJDK Temurin 19.0.2).
I also noticed that flutter command was trying to use gradle 7.4 (the only one gradle version installed before). As previously mentioned by others, there has to be consistency between your Java version and gradle version according to Gradle Official Compatibility Matrix.
Please, verify it with following commands:
java -version
gradle -version
I think this process / solution can be applicable in general. Hope it helps!

IntelliJ IDEA build.gradle.kts autocomplete not working

I have a strange problem that I was not able to find any solution so far.
I am quite new to gradle and set up a project using kotlin as the script language for my build-file.
Wherever I look, people seem to have comprehensive autocomplete capabilities in the build.gradle.kts file, but in my case, IntelliJ acts as if it doesn't have access to the sources.
No/very basic autocomplete, and only very basic syntax highlighting is happening.
For example if I click on the plugins` block (or any other block for that matter) to see the definition, IntelliJ tells me "Cannot find declaration to got to"
There is very little context-sensitive autocomplete:
I have read this answer about adding the -all distribution jar to the gradle-wrapper.properties file but it did not change anything. My gradle-wrapper.properties looks like this:
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.1-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
I am using:
IntelliJ IDEA 2019.3.1 (Ultimate Edition)
Build #IU-193.5662.53, built on December 18, 2019
Runtime version: 11.0.5+10 amd64
VM: OpenJDK 64-Bit Server VM by Oracle Corporation
Linux 5.4.12-arch1-1
Memory: 1981M
Cores: 8
Gradle version is:
./gradlew -v
------------------------------------------------------------
Gradle 6.1
------------------------------------------------------------
Build time: 2020-01-15 23:56:46 UTC
Revision: 539d277fdba571ebcc9617a34329c83d7d2b259e
Kotlin: 1.3.61
Groovy: 2.5.8
Ant: Apache Ant(TM) version 1.10.7 compiled on September 1 2019
JVM: 13.0.1 (Oracle Corporation 13.0.1+9)
OS: Linux 5.4.12-arch1-1 amd64
I would appreciate any help in getting a little more joy and ease with my entry into the gradle world. :)
For me I found this error:
Caused by: org.gradle.api.GradleException: Spring Boot plugin requires Gradle 6.8.x, 6.9.x, or 7.x. The current version is Gradle 6.5.1
so changing Gradle to a newer version helped me!

How to install OpenJDK 11 on Windows?

In the past, Oracle used to publish an executable installers for Windows that would:
Unpack files
Add registry keys indicating the installed version and path
Add the JRE to the system PATH
Register an uninstaller with Windows.
As of Java 11, the Oracle's free version of Java (Oracle OpenJDK) doesn't seem to include an installer. It is just a zip file containing the binaries.
How are we supposed to install OpenJDK 11 on Windows seeing as the aforementioned integrations are no longer there? Aren't they necessary?
Extract the zip file into a folder, e.g. C:\Program Files\Java\ and it will create a jdk-11 folder (where the bin folder is a direct sub-folder). You may need Administrator privileges to extract the zip file to this location.
Set a PATH:
Select Control Panel and then System.
Click Advanced and then Environment Variables.
Add the location of the bin folder of the JDK installation to the PATH variable in System Variables.
The following is a typical value for the PATH variable: C:\WINDOWS\system32;C:\WINDOWS;"C:\Program Files\Java\jdk-11\bin"
Set JAVA_HOME:
Under System Variables, click New.
Enter the variable name as JAVA_HOME.
Enter the variable value as the installation path of the JDK (without the bin sub-folder).
Click OK.
Click Apply Changes.
Configure the JDK in your IDE (e.g. IntelliJ or Eclipse).
You are set.
To see if it worked, open up the Command Prompt and type java -version and see if it prints your newly installed JDK.
If you want to uninstall - just undo the above steps.
Note: You can also point JAVA_HOME to the folder of your JDK installations and then set the PATH variable to %JAVA_HOME%\bin. So when you want to change the JDK you change only the JAVA_HOME variable and leave PATH as it is.
Java 17 (LTS) and up
For Java 17 and up, you can use the Eclipse Adoptium website. According to their about section, the Eclipse Adoptium project is the continuation of the original AdoptOpenJDK mission.
Java 11 (LTS), Java 8 - 16
For Java 11 (8 through 16), you can use AdoptOpenJDK, a website hosted by the java community. You can find .msi installers for OpenJDK 8 through 16 there, which will perform all the things listed in the question (Unpacking, registry keys, PATH variable updating (and JAVA_HOME), uninstaller...).
Use the Chocolatey packet manager. It's a command-line tool similar to npm. Once you have installed it, use
choco install openjdk --version=11.0
in an elevated command prompt to install OpenJDK 11 (leave out the --version parameter to install the latest version).
To update an installed version to the latest version, type
choco upgrade openjdk
Pretty simple to use and especially helpful to upgrade to the latest version. No manual fiddling with path environment variables.
From the comment by #ZhekaKozlov: ojdkbuild has OpenJDK builds (currently 8 and 11) for Windows (zip and msi).
You can use Amazon Corretto. It is free to use multiplatform, production-ready distribution of the OpenJDK. It comes with long-term support that will include performance enhancements and security fixes. Check the installation instructions here.
You can also check Zulu from Azul.
One more thing I like to highlight here is both Amazon Corretto and Zulu are TCK Compliant. You can see the OpenJDK builds comparison here and here.
For Java 12 onwards, official General-Availability (GA) and Early-Access (EA) Windows 64-bit builds of the OpenJDK (GPL2 + Classpath Exception) from Oracle are available as tar.gz/zip from the JDK website.
If you prefer an installer, there are several distributions. There is a public Google Doc and Blog post by the Java Champions community which lists the best-supported OpenJDK distributions. Currently, these are:
AdoptOpenJDK has been superseded by Adoptium/Temurin (Hotspot) and IBM Semeru (OpenJ9)
Adoptium Temurin
Amazon Corretto
IBM Semeru (with OpenJ9 JVM)
Liberica from Bellsoft
Microsoft Build of OpenJDK
OpenLogic OpenJDK
Red Hat OpenJDK
SAPMachine (backed by SAP)
Zulu Community (backed by Azul Systems)
https://www.openlogic.com/openjdk-downloads allowed me to pick a 32-bit version of OpenJDK8 (don't ask - Arduino IDE doesn't compile with 11), I think they just wrap around AdoptOpenJDK MSIs but I couldn't find 32-bit distros on AdoptOpenJDK.
In addition to the above answers, it is worth noting that you have to move your JDK Path entry to the top of the Path
Here is the complete answer. first of all you have to install the Chocolatey. to install Chocolatey run powershell as administrator and run the following command
Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))
after this run open cmd as administrator and run this command
choco install -y openjdk11
it will install the openjdk to the following location
C:\Program Files\Eclipse Adoptium\jdk-11.0.16.101-hotspot
finllay set your JAVA_HOME TO
C:\Program Files\Eclipse Adoptium\jdk-11.0.16.101-hotspot
and cheers
WinGet is now available on Windows 10+ to install the Microsoft Build of OpenJDK on your machine. See details and access the downloads page at https://aka.ms/msopenjdk/ where Zip files and instructions.
Scoop installs programs you know and love, from the command line with a minimal amount of friction.
Install scoop
Add java scoop bucket add java
Install OpenJDK scoop.cmd install openjdk17

How to stop gradle from downloading every time

I have installed gradle in Ubuntu 16.04.
Here is the output for gradle -v
------------------------------------------------------------
Gradle 2.10
------------------------------------------------------------
Build time: 2016-01-26 15:17:49 UTC
Build number: none
Revision: UNKNOWN
Groovy: 2.4.5
Ant: Apache Ant(TM) version 1.9.6 compiled on July 8 2015
JVM: 1.8.0_101 (Oracle Corporation 25.101-b13)
OS: Linux 4.4.0-38-generic amd64
But even now, whenever I create a new project based on gradle v2.10, it downloads it and then builds the project. According to the tutorials, after installing it, I shouldn't need to download it again. What is the problem here?
you will have to replace url with local path like this
distributionUrl = file\:///e:/android/gradle-2.10-bin.zip
and comment
distributionUrl=https\://services.gradle.org/distributions/gradle-2.10-all.zip
in gradle-wrapper.properties
I think you have two concepts mixed up:
A manual installation of gradle (gradle.bat / gradle.sh)
The gradle wrapper (gradlew.bat / gradlew.sh)
When you mention executing gradle -v this has absolutely no effect on the gradle wrapper. The wrapper works independently of any manually installed gradle versions.
Since you are referencing gradle being downloaded I assume you are discussing the gradle wrapper (gradlew). The wrapper will first check if it has downloaded the version previously by checking the cache stored under $GRADLE_USER_HOME so will only ever download each version once. Subsequent gradlew invocations will use the previously downloaded/unzipped installation.

Apache on Windows

I want to install Apache server on Windows.
The book says that i can go to official site http://httpd.apache.org/download.cgi and download latest Apache version (Book year 2008, and in example showed 2.2.9v, and this example how to install on Windows, not Linux). So i go to this address, and there latest version 2.4.7, but its .tar.bz2 and .tar.gz extension, and how i understand it will be difficult to install it cause its on Linux, for Windows must be .msi, but there no file with that extension, only 2.0.65 version and older. I understand that in Linux maybe appear earlier Apache version, but how it's real that in 2008 year, there was 2.2.9 version, but now in 2014 the latest .msi version 2.0.65 ?
Easy! Here you go:
http://www.apachelounge.com/download/
You'll find the latest Apache HTTP server's there pre-built for you (Binaries).
Edit: They are not provided in .MSI files like Apache would but you can unzip the files to C:\Apache2 and set it up manually, like a true developer!

Resources