From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Pankaj Jangid Newsgroups: gmane.emacs.help Subject: Re: Editing Java (with LSP) Date: Thu, 16 Jun 2022 08:59:19 +0530 Message-ID: <87pmj99tgw.fsf@codeisgreat.org> References: <87k09ky8kc.fsf@gmail.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="5364"; mail-complaints-to="usenet@ciao.gmane.io" User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux) Cc: help-gnu-emacs@gnu.org To: Alessandro Bertulli Original-X-From: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Thu Jun 16 05:30:06 2022 Return-path: Envelope-to: geh-help-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1o1gCs-00019T-JV for geh-help-gnu-emacs@m.gmane-mx.org; Thu, 16 Jun 2022 05:30:06 +0200 Original-Received: from localhost ([::1]:33192 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1o1gCr-0004sN-1e for geh-help-gnu-emacs@m.gmane-mx.org; Wed, 15 Jun 2022 23:30:05 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:40210) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1o1gCE-0004s9-B1 for help-gnu-emacs@gnu.org; Wed, 15 Jun 2022 23:29:26 -0400 Original-Received: from mail-pg1-x532.google.com ([2607:f8b0:4864:20::532]:39737) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1o1gCC-0002zU-MQ for help-gnu-emacs@gnu.org; Wed, 15 Jun 2022 23:29:26 -0400 Original-Received: by mail-pg1-x532.google.com with SMTP id q140so100086pgq.6 for ; Wed, 15 Jun 2022 20:29:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=codeisgreat-org.20210112.gappssmtp.com; s=20210112; h=from:to:cc:subject:references:mail-followup-to:date:in-reply-to :message-id:user-agent:mime-version:content-transfer-encoding; bh=8DD2hCr9U6jk871Im7jw1FN+IIiKhgmnoah1kpb0+h0=; b=TALl5k9f7+hycnN3Pbs8EfBvSVXFV/sIe7Xu0DbXXfZjZSGJYyqB+P3hhLfQ4oUi7W wGrBQro4blwydr31bORI6eXmsLGyLanOwrHLYO/u6hrgRcuAf+515B9x8FlTogHUvLBf 7fasAzSREUY7q8HLC9cBJFBYVDWtVYjmS/9HR4f4ox5qw3Mvve0PAhlIPPeoOiyL1fu5 j3EOyCEh05j3JpQ12J5nmnsDl/qWY1P/9R7BNMVxF5k5QWXtoooXoQ4UZprxz7H6T1tQ wbOGgGceY1FzFuE3yOlxe3STpOmdkakFeYKxNRd8g9I6jBV5X4tgtZdwCEl0zCQxm5Pi fK5g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:references:mail-followup-to :date:in-reply-to:message-id:user-agent:mime-version :content-transfer-encoding; bh=8DD2hCr9U6jk871Im7jw1FN+IIiKhgmnoah1kpb0+h0=; b=2BsvdG0AsWLXZGRUDr3e8IuuO2pS305HsNeH1O36L1m2tseTZx4ij9Jfi0M1JWLfRn N0fA9t+HgDUVcRQsmb8VZwCEq/lREq+75zk3sjBtc2b23PuVt5z3vrajxJDAE3Idlfit hVeYwAHCQJmvVtuAZU6tnl7EpmfYKUpZ4pdPNz95rOgI6gZwsYXBJstAvEHXR/w6SUta 29qWst4S7FkTxVnyWn4JdTEpGEWdJHfj8NqmHxpzymhVAFWtB5XBG42XoFGc8yebE9pB Q/ucZ7GCw2wtSFa7tJKRwp2af16/Q825p5qix1SFLsxcdm0ourTVF2vhUhqpYa6exArx UCgA== X-Gm-Message-State: AJIora8lAgbGKXnvigxo8LN5viUMNzPXfUQ+xribw8e+JNPyB1jDjqwW MdAlDENMqxhJj+WuwcdTrYRPl05+gJXcTA== X-Google-Smtp-Source: AGRyM1uK7dD6gGGfV+b+DIxK1nmzgHe1RRmzhh0HMPbTti3Nb90nDB1WBJ7e7+jL2F4NCPSZzU2ugw== X-Received: by 2002:a63:74d:0:b0:3fc:8fd3:c23b with SMTP id 74-20020a63074d000000b003fc8fd3c23bmr2661692pgh.392.1655350162676; Wed, 15 Jun 2022 20:29:22 -0700 (PDT) Original-Received: from anant ([49.36.238.183]) by smtp.gmail.com with ESMTPSA id e12-20020a170902ed8c00b0015e8da1fb07sm394615plj.127.2022.06.15.20.29.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Jun 2022 20:29:22 -0700 (PDT) Mail-Followup-To: Alessandro Bertulli , help-gnu-emacs@gnu.org In-Reply-To: <87k09ky8kc.fsf@gmail.com> (Alessandro Bertulli's message of "Mon, 13 Jun 2022 15:43:46 +0200") Received-SPF: none client-ip=2607:f8b0:4864:20::532; envelope-from=pankaj@codeisgreat.com; helo=mail-pg1-x532.google.com X-Spam_score_int: -16 X-Spam_score: -1.7 X-Spam_bar: - X-Spam_report: (-1.7 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, HEADER_FROM_DIFFERENT_DOMAINS=0.249, RCVD_IN_DNSWL_NONE=-0.0001, SPF_HELO_NONE=0.001, SPF_NONE=0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: help-gnu-emacs@gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Users list for the GNU Emacs text editor List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: help-gnu-emacs-bounces+geh-help-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "help-gnu-emacs" Xref: news.gmane.io gmane.emacs.help:137872 Archived-At: Alessandro Bertulli writes: > Can you please give me your feedback? Does any of you write Java code? > How is it? Do you have the same problems too? If yes, have you found a > solution? Do you use LSP? Or some other package? > I use eglot+eclipse.jdt.ls. There is a bit of struggle in setting this up. Although, eglot tries to download latest eclipse.jdt.ls but it is not always perfect. There are CLASSPATH issues and all those things which are typical of Java. And even after full setup I face issues here and there. Sometimes. My setup is like this (assuming you have cloned eclipse.jdt.ls repository inside ~/.emacs.d and built using =E2=80=98./mvnw clean package= =E2=80=99), --8<---------------cut here---------------start------------->8--- (unless (package-installed-p 'eglot) (package-install 'eglot)) (custom-set-variables '(eglot-connect-timeout nil)) (declare-function eglot-ensure "eglot") (add-hook 'java-mode-hook #'eglot-ensure) ; eclipse.jdt.ls (defun my/add-to-classpath (item) "Add ITEM to CLASSPATH." =20=20 (let ((class-path (getenv "CLASSPATH"))) =20=20=20=20 (defvar class-path-list (if class-path (split-string class-path ":"))) (cl-pushnew item class-path-list) (setenv "CLASSPATH" (mapconcat 'identity class-path-list ":")))) (when (file-exists-p (expand-file-name "eclipse.jdt.ls" user-emacs-director= y)) (my/add-to-classpath (substring (shell-command-to-string (format "find %s -name 'org.eclipse.equinox.launcher_*jar'" (expand-file-name "eclipse.jdt.ls/org.eclipse.jdt.ls.product/target/repository/plugins" user-emacs-directory))) 0 -1))) --8<---------------cut here---------------end--------------->8--- Also I use =E2=80=98exec-path-from-shell=E2=80=99 package to setup PATHs in= GUI Emacs. ~Pankaj