VS code setup for Java remote development - visual-studio-code

few weeks back vscode made JDK-11 mandatory for java development in VS-code
The Eclipse Platform has decided to require Java 11 as the minimum requirement for its September 2020 release. See https://www.eclipse.org/lists/eclipse-pmc/msg03821.html.
Because vscode-java depends on the Eclipse JDT.LS, the same requirement applies to vscode-java but on a more agressive timeline: vscode-java usually consumes JDT.LS builds that depend on bleeding edge JDT features, effectively shipping pre-release versions of Eclipse Platform/JDT. As of July 22nd, 2020, Java 11 is now required for running vscode-java.
source: vscode
i am using remote ssh extension to connect to my remote VM (ubuntu on vagrant).
when i open Java file in remote-ssh ,i am getting error saying install Java 11.
i have the java 11 already in my vagrant.
i can see the following in my VM
$ update-java-alternatives -l
java-1.11.0-openjdk-amd64 1111 /usr/lib/jvm/java-1.11.0-openjdk-amd64
java-1.8.0-openjdk-amd64 1081 /usr/lib/jvm/java-1.8.0-openjdk-amd64
vagrant#vagrant:/usr/lib/jvm
$ ls
total 24K
drwxr-xr-x 4 root root 4.0K Feb 21 2020 .
drwxr-xr-x 138 root root 4.0K Aug 13 17:57 ..
lrwxrwxrwx 1 root root 25 Feb 20 2019 default-java -> java-1.11.0-openjdk-amd64
lrwxrwxrwx 1 root root 21 Jan 15 2020 java-1.11.0-openjdk-amd64 -> java-11-openjdk-amd64
-rw-r--r-- 1 root root 2.0K Jan 15 2020 .java-1.11.0-openjdk-amd64.jinfo
drwxr-xr-x 7 root root 4.0K Feb 21 2020 java-11-openjdk-amd64
lrwxrwxrwx 1 root root 20 Jan 17 2020 java-1.8.0-openjdk-amd64 -> java-8-openjdk-amd64
-rw-r--r-- 1 root root 2.7K Jan 17 2020 .java-1.8.0-openjdk-amd64.jinfo
drwxr-xr-x 7 root root 4.0K Feb 21 2020 java-8-openjdk-amd64
all my java projects depends on java-8 so just to work with in vscode , i need Java-11.
please help me to setup this Env.

The easiest is to change your java config with the following command:
sudo alternatives --config java
and choose the Java version you want active.

Related

What are ~/.m2 and ~/.p2 folders and can I delete them?

I know they are somehow linked to Eclipse and .m2 is related to maven.
However, I never really used maven and I don't use it anymore, though I still use Eclipse, and these two folders ~/.p2 and ~./m2 are about 4Gb each and I'm wondering if I can simply delete them.
To clarify, my ~/.p2 folder looks like that:
cd ~/.p2
du -sh */
3.2M org.eclipse.equinox.p2.core/
48M org.eclipse.equinox.p2.engine/
45M org.eclipse.equinox.p2.repository/
3.6G pool/
I'm wondering if pool/ folder needs to be that big or do I have relic/zoombie files there and how to find out about it?
For example, why do I have so many versions of PyDev?
drwxr-xr-x 6 alan staff 192 Apr 4 2016 /Users/alan/.p2/pool/plugins/org.python.pydev.core_4.5.5.201603221110
drwxr-xr-x 6 alan staff 192 May 11 2016 /Users/alan/.p2/pool/plugins/org.python.pydev.core_5.0.0.201605051159
drwxr-xr-x 6 alan staff 192 Jun 22 2016 /Users/alan/.p2/pool/plugins/org.python.pydev.core_5.1.1.201606162013
drwxr-xr-x 6 alan staff 192 Jun 28 2016 /Users/alan/.p2/pool/plugins/org.python.pydev.core_5.1.2.201606231256
drwxr-xr-x 6 alan staff 192 Sep 16 2016 /Users/alan/.p2/pool/plugins/org.python.pydev.core_5.2.0.201608171824
drwxr-xr-x 6 alan staff 192 Oct 26 2016 /Users/alan/.p2/pool/plugins/org.python.pydev.core_5.3.0.201610121612
drwxr-xr-x 6 alan staff 192 Nov 1 2016 /Users/alan/.p2/pool/plugins/org.python.pydev.core_5.3.1.201610311318
drwxr-xr-x 6 alan staff 192 Dec 8 2016 /Users/alan/.p2/pool/plugins/org.python.pydev.core_5.4.0.201611281236
drwxr-xr-x 6 alan staff 192 Jan 25 2017 /Users/alan/.p2/pool/plugins/org.python.pydev.core_5.5.0.201701191708
drwxr-xr-x 6 alan staff 192 Mar 22 2017 /Users/alan/.p2/pool/plugins/org.python.pydev.core_5.6.0.201703221358
drwxr-xr-x 6 alan staff 192 Apr 12 2017 /Users/alan/.p2/pool/plugins/org.python.pydev.core_5.7.0.201704111357
drwxr-xr-x 6 alan staff 192 Jun 16 2017 /Users/alan/.p2/pool/plugins/org.python.pydev.core_5.8.0.201706061859
drwxr-xr-x 6 alan staff 192 Aug 28 2017 /Users/alan/.p2/pool/plugins/org.python.pydev.core_5.9.2.201708151115
drwxr-xr-x 6 alan staff 192 Sep 22 2017 /Users/alan/.p2/pool/plugins/org.python.pydev.core_6.0.0.201709191431
drwxr-xr-x 6 alan staff 192 Nov 9 2017 /Users/alan/.p2/pool/plugins/org.python.pydev.core_6.1.0.201711051306
drwxr-xr-x 6 alan staff 192 Nov 29 2017 /Users/alan/.p2/pool/plugins/org.python.pydev.core_6.2.0.201711281614
drwxr-xr-x 7 alan staff 224 Mar 1 2018 /Users/alan/.p2/pool/plugins/org.python.pydev.core_6.3.1.201802272029
drwxr-xr-x 7 alan staff 224 Mar 23 2018 /Users/alan/.p2/pool/plugins/org.python.pydev.core_6.3.2.201803171248
drwxr-xr-x 7 alan staff 224 May 15 2018 /Users/alan/.p2/pool/plugins/org.python.pydev.core_6.3.3.201805051638
drwxr-xr-x 7 alan staff 224 Jul 12 2018 /Users/alan/.p2/pool/plugins/org.python.pydev.core_6.4.3.201807050139
drwxr-xr-x 7 alan staff 224 Aug 9 2018 /Users/alan/.p2/pool/plugins/org.python.pydev.core_6.4.4.201807281807
drwxr-xr-x 7 alan staff 224 Oct 2 2018 /Users/alan/.p2/pool/plugins/org.python.pydev.core_6.5.0.201809011628
drwxr-xr-x 7 alan staff 224 Nov 9 2018 /Users/alan/.p2/pool/plugins/org.python.pydev.core_7.0.3.201811082356
drwxr-xr-x 7 alan staff 224 Feb 12 2019 /Users/alan/.p2/pool/plugins/org.python.pydev.core_7.1.0.201902031515
drwxr-xr-x 7 alan staff 224 Jul 1 2019 /Users/alan/.p2/pool/plugins/org.python.pydev.core_7.2.1.201904261721
drwxr-xr-x 7 alan staff 224 Aug 31 2019 /Users/alan/.p2/pool/plugins/org.python.pydev.core_7.3.0.201908161924
drwxr-xr-x 7 alan staff 224 Nov 7 2019 /Users/alan/.p2/pool/plugins/org.python.pydev.core_7.4.0.201910251334
drwxr-xr-x 8 alan staff 256 Mar 9 10:20 /Users/alan/.p2/pool/plugins/org.python.pydev.core_7.5.0.202001101138
drwxr-xr-x 8 alan staff 256 Jun 6 13:49 /Users/alan/.p2/pool/plugins/org.python.pydev.core_7.6.0.202006041357
I also have files as old as 2012, which I'm quite sure I'm not using them.
.m2 is your local Maven repository. It contains all ever downloaded Maven dependencies and Maven plugins. You can delete this folder (except maybe existing configuration/settings files, outside of the repository subfolder). If required Maven will recreate this folder and download everything: in Eclipse right-click a project and choose Maven > Update Project..., click Select All and hit OK
.p2 of this size contains most of your Eclipse installation (all plugins Eclipse is made up of) that you installed via the Eclipse Installer (in contrast to installing Eclipse via unpacking a ZIP or using a DMG file on macOS where the plugins are contained in the plugins subfolder). Do not delete this folder, otherwise you will not be able to start Eclipse anymore. To clean up this folder, run the Eclipse Installer, in the top right menu select Bundles Pools... (in Eclipse, the term bundle is a synonym for plugin) and in the Bundles Pool Management dialog run Clear Cache... and Cleanup Agent...
The .m2 folder holds Maven configuration files and a copy of every artifact you ever downloaded. You can typically delete the .m2/repository folder if you need the disk space.
The .p2 folder is apparently for the Eclipse installer. I usually use a ZIP distribution which does not fill up this.

Installing Postgresql 9.6 on AWS - EC2

I have to install a specific version of Postgresql to my AWS-EC2 instance.
I followed the tutorial :Setting up PostgreSQ.
In the past i did as per the tutorial and it worked perfectly fine. This time, since I need the 9.6 version, I twisted a bit :
$ sudo yum install postgresql96 postgresql96-server postgresql96-devel postgresql96-contrib postgresql96-docs
the installation worked fine. I am now trying to resume the setup :
sudo postgresql-setup initdb
and get the following error:
$ sudo postgresql-setup initdb
sudo: postgresql-setup: command not found
i tried the following as well just for the sake of it.
$ sudo postgresql96-setup initdb
sudo: postgresql96-setup: command not found
$ ls -ila /etc/rc.d/init.d
total 264
393352 drwxr-xr-x 2 root root 4096 Nov 5 08:25 .
393347 drwxr-xr-x 10 root root 4096 Aug 26 18:05 ..
393961 -rwxr-xr-x 1 root root 1729 Mar 27 2017 acpid
394280 -rwxr-xr-x 1 root root 2062 Aug 16 2016 atd
394415 -rwxr-xr-x 1 root root 3448 Mar 8 2017 auditd
394323 -r-xr-xr-x 1 root root 1362 Mar 30 2017 blk-availability
394399 lrwxrwxrwx 1 root root 46 Aug 26 18:05 cfn-hup -> /opt/aws/apitools/cfn-init/init/redhat/cfn-hup
393935 -rwxr-xr-x 1 root root 5160 Feb 28 2014 cgconfig
393936 -rwxr-xr-x 1 root root 3580 Feb 28 2014 cgred
394243 -rwxr-xr-x 1 root root 3782 Oct 4 2018 cloud-config
394244 -rwxr-xr-x 1 root root 3763 Oct 4 2018 cloud-final
394245 -rwxr-xr-x 1 root root 3855 Oct 4 2018 cloud-init
394246 -rwxr-xr-x 1 root root 3840 Oct 4 2018 cloud-init-local
394058 -rwxr-xr-x 1 root root 2826 Sep 28 2016 crond
393819 -rw-r--r-- 1 root root 25651 Aug 17 2017 functions
393820 -rwxr-xr-x 1 root root 6037 Aug 17 2017 halt
394186 -rwxr-xr-x 1 root root 1395 Dec 13 2017 hibagent
394131 -rwxr-xr-x 1 root root 2267 Nov 12 2018 hibinit-agent
393401 -rwxr-xr-x 1 root root 8563 Sep 27 2013 ip6tables
393402 -rwxr-xr-x 1 root root 8468 Sep 27 2013 iptables
394156 -rwxr-xr-x 1 root root 1955 Oct 29 2018 irqbalance
393821 -rwxr-xr-x 1 root root 652 Jan 18 2017 killall
394324 -r-xr-xr-x 1 root root 2137 Mar 30 2017 lvm2-lvmetad
394325 -r-xr-xr-x 1 root root 2274 Mar 30 2017 lvm2-lvmpolld
394326 -r-xr-xr-x 1 root root 3045 Mar 30 2017 lvm2-monitor
394211 -rwxr-xr-x 1 root root 2904 Sep 18 2014 mdmonitor
394195 -rwxr-xr-x 1 root root 2200 Jul 2 17:59 messagebus
393822 -rwxr-xr-x 1 root root 4334 Jan 18 2017 netconsole
393823 -rwxr-xr-x 1 root root 5309 Jan 18 2017 netfs
393824 -rwxr-xr-x 1 root root 6742 Aug 17 2017 network
394003 -rwxr-xr-x 1 root root 6703 Oct 8 2015 nfs
394074 -rwxr-xr-x 1 root root 3526 Oct 8 2015 nfslock
394152 -rwxr-xr-x 1 root root 1926 May 3 2019 ntpd
393919 -rwxr-xr-x 1 root root 2049 May 3 2019 ntpdate
394548 -rwxr-xr-x 1 root root 7949 Dec 4 2018 postgresql96
394426 -rwxr-xr-x 1 root root 1556 Sep 10 2014 psacct
393778 -rwxr-xr-x 1 root root 2034 Sep 27 2013 quota_nld
393748 -rwxr-xr-x 1 root root 1515 May 17 2016 rdisc
394296 -rwxr-xr-x 1 root root 1816 Aug 17 2017 rngd
393273 -rwxr-xr-x 1 root root 2073 May 9 2018 rpcbind
394082 -rwxr-xr-x 1 root root 2518 Oct 8 2015 rpcgssd
394084 -rwxr-xr-x 1 root root 2305 Oct 8 2015 rpcidmapd
394087 -rwxr-xr-x 1 root root 2464 Oct 8 2015 rpcsvcgssd
393972 -rwxr-xr-x 1 root root 2011 Nov 11 2014 rsyslog
393643 -rwxr-xr-x 1 root root 2056 Sep 10 2014 saslauthd
394014 -rwxr-xr-x 1 root root 3702 Aug 17 2016 sendmail
393825 -rwxr-xr-x 1 root root 647 Jan 18 2017 single
394647 -rwxr-xr-x 1 root root 4180 Oct 23 23:47 sshd
393639 -rwxr-xr-x 1 root root 1642 Mar 19 2014 udev-post
Chances are high that Amazon Linux doesn't fit well with PostgreSQL 9.6 or need extra undocumented custom installation steps.
To install a specific version of services like PostgreSQL, the easiest way and probably the new standard is using Docker (and docker-compose).
So, (almost) whatever the Linux distribution you are using:
sudo yum install docker then sudo service docker start (The extensive doc for Amazon Linux or other Linux distributions)
Then install docker-compose
Find an example of a docker-compose.yml file for PostgreSQL, there are many. Just make sure your image parameter is set to image: "postgres:9.6"
docker-compose up and you should be all set

How to upgrade zookeeper from from 3.4.8 to 3.4.13?

I am trying to upgrade zookeeper from 3.4.8 to 3.4.13.
Before upgrade the content of /usr/lib/zookeeper
drwxr-xr-x 5 root root 4.0K Aug 23 08:39 .
drwxr-xr-x 77 root root 12K Aug 23 08:50 ..
drwxr-xr-x 2 root root 4.0K Aug 23 08:39 bin
lrwxrwxrwx 1 root root 19 May 24 11:25 conf -> /etc/zookeeper/conf
drwxr-xr-x 2 root root 4.0K Aug 23 08:39 lib
-rw-r--r-- 1 root root 12K May 24 11:25 LICENSE.txt
-rw-r--r-- 1 root root 170 May 24 11:25 NOTICE.txt
-rw-r--r-- 1 root root 1.3M Aug 23 08:39 zookeeper-3.4.8.jar
lrwxrwxrwx 1 root root 38 Aug 23 08:39 zookeeper.jar -> /usr/lib/zookeeper/zookeeper-3.4.8.jar
As mentioned in answer I have downloaded the zookeeper from this link and placed the zookeeper-3.4.13.jar in /usr/lib/zookeeper and pointed the symbolic link like below
lrwxrwxrwx 1 root root 39 Aug 30 03:19 zookeeper.jar -> /usr/lib/zookeeper/zookeeper-3.4.13.jar
But on checking the status after resarting zookeeper it is still pointing to 3.4.8
ubuntu#vrni-platform:/etc/zookeeper/conf$ telnet localhost 2181
Trying 127.0.0.1...
Connected to localhost.
Escape character is '^]'.
status
Zookeeper version: 3.4.8--1, built on 02/06/2016 03:18 GMT
It appears this is because of the way the jars are loaded from /usr/lib/zookeeper/bin/zkEnv.sh
#release tarball format
for i in "$ZOOBINDIR"/../zookeeper-*.jar
do
CLASSPATH="$i:$CLASSPATH"
done
Can someone let me know is this some known issue is zkEnv.sh? Is this expected?
This has been answered in zookeeper mailing list. We should not have multiple zookeeper-<version>.jar in the CLASSPATH.

Install TYPO3 under a symlink (Platform.sh)

I'm trying to install TYPO3 using a symlink structure based on platform.sh.
drwxrwxrwx 1 vagrant vagrant 4.0K Feb 13 11:58 .
drwxrwxrwx 1 vagrant vagrant 0 Feb 13 11:17 ..
-rwxrwxrwx 1 vagrant vagrant 1.2K Feb 10 15:29 composer.json
-rwxrwxrwx 1 vagrant vagrant 72K Feb 10 15:29 composer.lock
drwxrwxrwx 1 vagrant vagrant 4.0K Feb 10 15:29 .git
-rwxrwxrwx 1 vagrant vagrant 193 Feb 10 15:29 .gitignore
-rwxrwxrwx 1 vagrant vagrant 35K Feb 10 15:29 LICENSE
-rwxrwxrwx 1 vagrant vagrant 716 Feb 10 15:29 Makefile
-rwxrwxrwx 1 vagrant vagrant 95 Feb 10 15:29 php.ini
drwxrwxrwx 1 vagrant vagrant 0 Feb 10 15:29 .platform
-rwxrwxrwx 1 vagrant vagrant 3.2K Feb 10 15:29 .platform.app.yaml
-rwxrwxrwx 1 vagrant vagrant 2.0K Feb 10 15:29 README.md
drwxrwxrwx 1 vagrant vagrant 4.0K Feb 10 15:39 vendor
drwxrwxrwx 1 vagrant vagrant 4.0K Feb 13 11:30 web
lrwxrwxrwx 1 vagrant vagrant 0 Feb 10 15:39 _www -> .platform/local/builds/default/web
But I always get the following message:
/ is not a directory
Directory / should be a directory, but is of type link
This happens because the Class DirectoryNode uses
return !#is_link($path) && #is_dir($path);
to identify directorys and it does not match on symlinks.
I'm looking forward to your solution.
You mean the warning in the Install Tool? You can actually ignore that as it is a false positive, everything works out just fine.
I had this error once, a long time ago. If I remember that correctly, I had to clear the opcode cache in the install tool.
_www/typo3conf/LocalConfiguration.php is a dead symlink to writable/LocalConfiguration.php
It seems to be a bug.
Temporary solution: Remove Symlink (Installtool will create it on its own)

Invalid content was found starting with element 'hc:html' - newer versions solution?

When trying to deploy jrxml with hc:html I get the following error:
org.xml.sax.SAXParseException; lineNumber: 26; columnNumber: 277; cvc-complex-type.2.4.a: Invalid content was found starting with element 'hc:html'. One of '{"http://jasperreports.sourceforge.net/jasperreports":component}' is expected
Now I found duplicate questions but they are all related to old versions of jasper soft.
So my context is:
Jasper Soft Studio 5.6.0;
Server: 5.5.0
I don't have something like jasperreports-htmlcomponent-5.0.1.jar in my JasperSoftStudio package.
I've tried to add com.jaspersoft.studio.html_5.6.0.final.jar
But still get the exception..
Has anyone attempted to load report with html to the newer versions of jasper server?
That is how my directory looks like after I added the html jar.
root#jasper:/opt/jasperreports-server-cp-5.5.0/apache-tomcat/lib# ls -la
total 16864
drwxr-xr-x 2 root root 4096 Aug 4 11:41 .
drwxr-xr-x 10 root root 4096 Mar 18 10:21 ..
-rwxr-xr-x 1 root root 15264 Jul 2 2013 annotations-api.jar
-rwxr-xr-x 1 root root 54142 Jul 2 2013 catalina-ant.jar
-rwxr-xr-x 1 root root 134215 Jul 2 2013 catalina-ha.jar
-rwxr-xr-x 1 root root 1581311 Jul 2 2013 catalina.jar
-rwxr-xr-x 1 root root 257520 Jul 2 2013 catalina-tribes.jar
-rw-r--r-- 1 root root 1238098 Aug 4 11:41 com.jaspersoft.studio.html_5.6.0.final.jar
-rwxr-xr-x 1 root root 3528544 Oct 24 2013 db2jcc-9.7.jar
-rwxr-xr-x 1 root root 1801636 Jul 2 2013 ecj-4.2.2.jar
-rwxr-xr-x 1 root root 46085 Jul 2 2013 el-api.jar
-rw-rw-rw- 1 root root 1473091 Jun 9 08:57 hsqldb-2.3.2.jar
-rwxr-xr-x 1 root root 385123 Oct 24 2013 ingres-jdbc-9.2.0.jar
-rwxr-xr-x 1 root root 123241 Jul 2 2013 jasper-el.jar
-rwxr-xr-x 1 root root 599428 Jul 2 2013 jasper.jar
-rwxr-xr-x 1 root root 88690 Jul 2 2013 jsp-api.jar
-rwxr-xr-x 1 root root 214918 Oct 24 2013 mariadb-java-client-1.1.2.jar
-rwxr-xr-x 1 root root 2152051 Oct 24 2013 ojdbc6-11.2.0.2.jar
-rwxr-xr-x 1 root root 548310 Oct 22 2012 postgresql-9.1-903.jdbc4.jar
-rwxr-xr-x 1 root root 579785 Oct 24 2013 postgresql-9.2-1002.jdbc4.jar
-rwxr-xr-x 1 root root 177598 Jul 2 2013 servlet-api.jar
-rwxr-xr-x 1 root root 584207 Oct 24 2013 sqljdbc-1.6-2206.100.jar
-rwxr-xr-x 1 root root 6873 Jul 2 2013 tomcat-api.jar
-rwxr-xr-x 1 root root 796527 Jul 2 2013 tomcat-coyote.jar
-rwxr-xr-x 1 root root 235411 Jul 2 2013 tomcat-dbcp.jar
-rwxr-xr-x 1 root root 77364 Jul 2 2013 tomcat-i18n-es.jar
-rwxr-xr-x 1 root root 48693 Jul 2 2013 tomcat-i18n-fr.jar
-rwxr-xr-x 1 root root 51678 Jul 2 2013 tomcat-i18n-ja.jar
-rwxr-xr-x 1 root root 124006 Jul 2 2013 tomcat-jdbc.jar
-rwxr-xr-x 1 root root 23201 Jul 2 2013 tomcat-util.jar
-rwxr-xr-x 1 root root 254163 Oct 24 2013 vertica_4.1.19_jdk_5.jar
The solution is to grab the a jar for the html component from Jasper Studio or iReport and then upload it to the server.
Steps:
Since newer version of Jasper Report Designer is Eclipse based -
navigate to plugins folder.
Find com.jaspersoft.studio.html_x.x.x.final.jar.
Extract the contents of the jar to a folder.
Grab a jar from within the lib folder of this jar.
(Your_eclipse_distribution/plugins/com.jaspersoft.studio.html_5.6.0.final/lib/htmlcomponent.jar)
Copy the library to your server /WEB-INF/lib (NOT the one I've shown in question).
Restart Server
It is quite weird that after so many years Jasper Server does not natively support embedded html and it is also weird that you have to lurk inside the report designer libraries and extract the jar manually. Not to mention that Jasper Server report viewer won't show you your report with html. Which leads me to conclusion that they make everything they can to make it inconvenient to work with CE.