SonarQube scanner: use non-default Java - sonarqube5.1

I have a box running SonarQube scanner. The default JDK is 7.
I need to run sonar-runner using JDK 8 but I would like to keep the default JDK at 7.
I tried changing JAVA_HOME before running sonar-runner but had no luck. I also couldn't find any properties that can change that.
Any thoughts?

Setting JAVA_HOME should work (see sonar-scanner source code if you're curious).
It's behaving well for me with SonarQube Scanner 2.6.1. Default on Java 7:
nico#deb-nico:~$ sonar-scanner
INFO: Scanner configuration file: /home/nico/sq_playground/sonar-scanner-2.6.1/conf/sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarQube Scanner 2.6.1
INFO: Java 1.7.0_101 Oracle Corporation (64-bit)
Forcing to Java 8:
nico#deb-nico:~$ export JAVA_HOME=/usr/lib/jvm/java-8-oracle/jre
nico#deb-nico:~$ sonar-scanner
INFO: Scanner configuration file: /home/nico/sq_playground/sonar-scanner-2.6.1/conf/sonar-scanner.properties
INFO: Project root configuration file: NONE
INFO: SonarQube Scanner 2.6.1
INFO: Java 1.8.0_91 Oracle Corporation (64-bit)
Looking good. Note that the SonarQube Scanner for Jenkins has a built-in option to let you choose which JDK the scanner should use.

Related

IntelliJ add Java 11

I need to add my installed Java 11 version to the project settings, because of this error (Error:java: invalid source release: 11).
When i go to project structure -> Project settings -> Project there it just shows Java 1.8.
When i try to add "java-11-openjdk-amd64" it fails with the reason "The selected directory points to a JRE, not a JDK.".
java -version
openjdk version "11.0.4" 2019-07-16
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.4+11)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.4+11, mixed mode)
The java application is available in the Java Runtime Environment (JRE). The fact that java is available in version 11 does not necessarily mean that the Java Development Kit (JDK) is also installed for version 11. However, IntelliJ needs the JDK which includes tools like the compiler javac.
In order to use Java 11 in IntelliJ, you need to install the Java 11 JDK.
For example on Ubuntu you can do that by executing:
sudo apt install openjdk-11-jdk

IntelliJ IDEA doesn't recognize lombok's Fields

IntelliJ recognize lombok annotations including #FieldNameConstants and I can import the generated fields via: import static com.somepackage.SomeClass.Fields.field (even autocomplete works after typing 'SomeClass' or 'Fields').
However when I want to build the project it says :
java: cannot find symbol
symbol: class Fields
location: com.somepackage.SomeClass
Intelli version:
IntelliJ IDEA 2019.3 (Community Edition)
Build #IC-193.5233.102, built on November 28, 2019
Runtime version: 11.0.4+10-b520.11 amd64
VM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
Windows 10 10.0
GC: ParNew, ConcurrentMarkSweep
Memory: 2000M
Cores: 4
Registry:
Non-Bundled Plugins: Lombook Plugin
Lombok version:
1.18.8 (tried it also with 1.18.10)
The same project(maven based springboot) works well in eclipse.
Lombok is correctly installed and annotation preprocesing is enabled. I have tried several uninstalls (both the ide and lombok) and clean project imports. Same result.

Why monitoring CPU and Sample are not available on visualVM

Since a few days VisualVM doesn't work very well.
I don't know why monitoring CPU and Sample are not avalables.
Thank you.
Jérôme
Version: 1.8.0_45 (Build 1380-140910); platform 20140910-unknown-revn
System: Windows 7 (6.1) Service Pack 1, amd64 64bit
Java: 1.8.0_45; Java HotSpot(TM) 64-Bit Server VM (25.45-b02, mixed mode)
Vendor: Oracle Corporation, http://java.oracle.com/
Environment: Cp1252; fr_FR (visualvm)
User directory: C:\Users\Jerome\AppData\Roaming\VisualVM\8u40
Cache directory: C:\Users\Jerome\AppData\Local\VisualVM\Cache\8u40
Clusters:
C:\Program Files\Java\jdk1.8.0_45\lib\visualvm\platform
C:\Program Files\Java\jdk1.8.0_45\lib\visualvm\visualvm
C:\Program Files\Java\jdk1.8.0_45\lib\visualvm\profiler
I found this "not issue" ;)
It doesn't work because java app was running from eclipse and i didn't use jre (in eclipse) from jdk.
I modyfied this and it works.

Android Build Error: Unable to locate Java VM. Please set JAVA_HOME environment variable

I'm using Ti Studio on Win7, and my project builds and works when I have my Android plugged in via USB and I run using "Android Device".
However, when I try to buid it for distribution I get:
[ERROR] Program launch failed. Unable to locate Java VM. Please set JAVA_HOME environment variable.
I have looked at this thread which describes a similar problem, and verified that JAVA_HOME is set:
+>echo %JAVA_HOME%
C:\Program Files\Java\jdk1.6.0_29
Also, in Ti Studio I have verified that Preferences->Studio->Platforms->Android has the "Android SDK Home" set to the path where Android SDK is installed.
Can anyone guide me on what else I need to do to fix this?
Thanks!
UPDATE FOR ANAND
+>javac -version
javac 1.6.0_29
+>java -version
java version "1.7.0_01"
Java(TM) SE Runtime Environment (build 1.7.0_01-b08)
Java HotSpot(TM) 64-Bit Server VM (build 21.1-b02, mixed mode)
Did you read System Requirements?
From Documentation:
For Windows, the 32-bit version of Java JDK is required regardless of
whether Titanium is running on a 32-bit or 64-bit system.
Try to install additional 32bit version of Java (without removing the 64bit) and set the system variable.
You may refer this answer.
Hope it helped you
Configure environment variables as mentioned here and JDK must be 32 bit

How do i configure WebLogic 8.1 to use a specific JRE / JDK on my development machiine

How do i configure WebLogic 8.1 to use a specific JRE / JDK on my development machine. I realized that it is using hot spot and i would like to change it to run on JRockit.
You need to change the JAVA_VENDOR setting in the setDomainEnv.sh/.cmd file (depending whether you are running a Linux or Windows box).
Adding/changing the following lines to the start of your setDomainEnv file should work:
set JAVA_VENDOR=BEA
set BEA_JAVA_HOME=(path to your jrockit installation, e.g. c:\BEA\jrockit)
Now you should start the server. You can monitor, in the console (stdout), the indication about which Java version is being used:
starting weblogic with Java version:
java version "1.6.0_05"
Java(TM) SE Runtime Environment (build 1.6.0_05-b13)
BEA JRockit(R) (build R27.6.0-50_o-100423-1.6.0_05-20080626-2105-windows-ia32, compiled mode)
It is also possible to do it during the configuration wizard, when you are adding a domain, under the Java SDK Selections tab.