Skip to main content

Questions tagged [java]

Java is a programming language. Use this tag for all questions on how to use emacs to work with Java code.

Filter by
Sorted by
Tagged with
0 votes
1 answer
42 views

dap-mode java debug configuration for JUnit test

I have a gradle multiproject with different java subprojects. I'm also using lombok in my code. When I try debug a JUnit test using dap-java-debug-test-method, I therefore get error messages regarding ...
user3617992's user avatar
0 votes
1 answer
56 views

How to change java file behaviour to use 2 character indentation

If I create a C file I get 2 character indentation which is what I want. However, if I create a java file, eg Hello.java then I am getting 4 character indentation. And I can't work out why. My ....
arcomber's user avatar
  • 229
1 vote
0 answers
93 views

How can I configure my emacs so I can program in java?

I installed Emacs recently, because I already had a good experience with Vim (another ide that gives the user freedom to modify the ide as the user wants) and as I am studying Java together with Elisp ...
Bruno Ciccarino's user avatar
1 vote
0 answers
650 views

Emacs as Java IDE - How to run code?

I am looking at setting up Emacs for Java development. As much as possible, I would like to achieve Emacs being comparable to IntelliJ IDEA in terms of features, and also ease-of-use / "things ...
user43791's user avatar
0 votes
1 answer
371 views

lsp-java and its relation to the eclipse.jdt.ls language server

When using lsp-java with a 3 file project and one external jar, I am not using gradle or maven. I put the jar into a lib directory, open a Java file and everything works. Then I follow find-...
Harald's user avatar
  • 352
0 votes
1 answer
123 views

How to add an external library to java lsp

I am working on a simple java program, it uses a jason.jar and junit.*.jar (for testing). I usually run the tests through the command line; i never run my programs through and Editor/IDE, I always use ...
Hackerman's user avatar
0 votes
1 answer
263 views

View documentation of Java inside of emacs

I want to view Java documentation like https://docs.oracle.com/en/java/ inside emacs. I have tried lsp-java with lsp-ui but my setup wasn't enough.
Francesco Cadei's user avatar
0 votes
1 answer
89 views

org-mode: How to define then call a Java method using source blocks

I have a super simple example where I have a list, a Java method and a call to this method. It looks like this: #+name: animals - dog - cat - guinea pig - horse #+name: does-contains-cat #+begin_src ...
Nicryc's user avatar
  • 147
1 vote
0 answers
379 views

How to run JUnit tests with lsp-mode and dap-mode, without build tools like maven

I have a Guix profile in which I installed for a beginner's java class a java environment as minimal as possible: openjdk 17, java-junit (which is JUnit 4), emacs-lsp-java, and emacs-dap-mode. I ...
elyuku's user avatar
  • 102
1 vote
0 answers
262 views

emacs workspace/executeCommand with `vscode.java.resolveMainClass` failed

I'm trying to debug java in emacs.I'm running the command M-x dap-java-debug in emacs and I'm getting below error. emacs workspace/executeCommand with vscode.java.resolveMainClass failed. (error &...
Rajkumar Natarajan's user avatar
0 votes
0 answers
81 views

Is there any way of making company show local classes inside a Java project?

I have a configuration for Java code on emacs that's the following: (use-package flycheck :ensure t :config (global-flycheck-mode)) (use-package company :ensure t :hook (after-init . global-...
raylight's user avatar
  • 247
2 votes
1 answer
295 views

Eglot spams the minibuffer in Java mode

I am essentially having this issue but for the java-mode. Eglot shows too many messages in the java files. How can I fix this? I only wanna see the documentation and error messages in the minibuffer.
scribe's user avatar
  • 1,090
0 votes
1 answer
340 views

How to setup maven for lsp-java

I need to import gurobi.jar to my project to correctly view the flycheck's errors. I have read Maven in 5 Minutes and How to add local jar files to a Maven project? but I am still not able to ...
Francesco Cadei's user avatar
0 votes
1 answer
96 views

Java-LSP freezes from Flymake error

I am very new to Java and have only been using an lsp for the past month or two. I have done some projects in Go, Python and Rust with lsp-mode and haven't had any problems. Now that I have been ...
greenbug's user avatar
0 votes
0 answers
61 views

lsp failing while requiring uninstalled packages

I have (I think) installed lsp and lsp-java. My java mode hook starts with (message "Running my-java-mode-hook") (auto-revert-mode) ;; Set up lsp (require 'lsp-mode) (require '...
Troy Daniels's user avatar
1 vote
1 answer
172 views

How to set up K&R everywhere (1TBS) brace style in cc-mode?

I'd like Emacs to follow this indentation style: struct Foo { void bar() { for (int i=0; i<10; i++) { if (condition) { // code // code ...
sajmon's user avatar
  • 56
2 votes
1 answer
2k views

Java development on Emacs?

Is is exist good package for java development on Emacs? Good... I mean to support: Debugging Code formatting Code Highlighting Help context Maven support Gradle support and many others things
a_subscriber's user avatar
  • 4,224
1 vote
1 answer
107 views

How to write evaluate java coding in Emacs file?

I am new to Emacs and I want to use org-mode to summarize the coding exercise and key points while learning Java. I am currently using IntelliJ to evaluate algorithmic coding questions I did on ...
JoZ's user avatar
  • 131
1 vote
0 answers
353 views

enable flycheck/syntax checker for Java in Spacemacs

I'm a java developer and I'm beginner using spacemacs, I've configured .spacemacs file to java configuration. Many functionalities works well, for example, a class recognition when I'm coding, but in ...
chavalife17's user avatar
2 votes
1 answer
305 views

Java 15 Text Blocks in CC Mode?

Java SE 15 adds (finally) support for multiline string literals that start with """\n and end with """. Has anyone updated java-mode (CC Mode) to recognize this construct?...
Colin Fraizer's user avatar
0 votes
1 answer
162 views

Where is the *meghanada-server-log*

I recently installed meghanada-mode from melpa to help with some Java I am writing. Mostly I like it. However, it has started showing the following messages (in my *Messages* buffer): Error:...
intel_chris's user avatar
0 votes
1 answer
496 views

Spacemacs Unable to use dap mode for Spring Boot web app

I am trying to set up a break point in my controller so that I can debug my spring boot web application within spacemacs. Can someone walk me through the steps on doing this. The steps I have done so ...
Dan's user avatar
  • 24
0 votes
0 answers
226 views

Error occurs during Java: (wrong-type-argument stringp (require . info))

EDIT: Error is not present with Emacs 26.3. I will revist when Emacs 27 becomes a release. Emacs 27.0.50 This error occurs when I load a .java file or read java code in an org-mode src block. How ...
danbanta's user avatar
1 vote
1 answer
2k views

How to update lsp-java manually?

I'm trying to run a simple HelloWorld from Emacs using dap-mode commands dap-debug and dap-java-debug but prompted the error saying lsp-request: No delegateCommandHandler for vscode.java....
Joseph Tesfaye's user avatar
2 votes
2 answers
5k views

Are there any tutorials/documentation for lsp-java?

I have managed to install lsp-java according to their git Readme (https://github.com/emacs-lsp/lsp-java) and created my workspace. Is there a better way (eg. in form of a documentation or tutorial) ...
topkek's user avatar
  • 89
1 vote
1 answer
760 views

Ensime plugin causes sbt error: "You must explicitly set JDK_HOME or JAVA_HOME"

Spacemacs: 0.200.7 Emacs: 25.3.1 sbt: 1.2.0 Java: openjdk version "1.8.0_171" .sbt/1.0/plugins/plugins.sbt: addSbtPlugin("org.ensime" % "sbt-ensime" % "2.5.1") ...
Metropolis's user avatar
1 vote
0 answers
107 views

Emacs doesn't use macOS's /etc/launchd.conf env variables

Emacs doesn't use macOS's /etc/launchd.conf env variables. I have the following there: function addToPATH { case ":$PATH:" in *":$1:"*) :;; # already there *) PATH="$1:$PATH";; # ...
HappyFace's user avatar
  • 920
1 vote
1 answer
1k views

format java source code natively based on CodeFormatterProfile

Is there an emacs tool to format java code according to a Java Code Formatter Profile (xml) spec, such as the one below? https://github.com/google/styleguide/blob/gh-pages/eclipse-java-google-style....
erjoalgo's user avatar
  • 873
2 votes
3 answers
1k views

LIGHTWEIGHT Java Environment (not JDEE)

Is there a lightweight Java environment for EMACS? I have used JDEE in the past, but it's accumulated a lot of, ahem, features since I used it last, and just trying to set it up has consumed a couple ...
Charlie Martin's user avatar
1 vote
0 answers
107 views

Constrain Eclim to java files

I am using eclim and I am loving it! But I had to disable eclimd-autostart because it keep trying to fire up eclimd when I pop a .js buffer. Autostarting of eclimd is disabled, please start eclimd ...
CESCO's user avatar
  • 374
3 votes
0 answers
42 views

How to specify the (sub)directory for source and compiled files when evaluating Java codeblocks in org mode?

I use Org Mode with Java codeblocks. When I evaluate a codeblock the source files and the compiled files (*.class) are saved in the same directory as the Org file with the codeblocks. How can I ...
tester's user avatar
  • 491
0 votes
0 answers
95 views

use-package - load package depending on the OS username

I am not a Java guy at all, but I mess with it quite often for university reasons. I have used this awesome post by peter goldsborough to set up eclim. Which is nice! But this also requires a lot of ...
CESCO's user avatar
  • 374
1 vote
1 answer
245 views

JDEE runs maven all the time

I am opening a Java source file which is part of a maven project. JDEE now runs maven once, which I can sort of understand. But whenever I move around in the file, it will trigger once more. Since it ...
Arne's user avatar
  • 419
0 votes
1 answer
1k views

How to indent PHP code in PHP-mode?

I come from Java/Netbeans, and I can indent my Java code using alt+shift+f, I have searched through this site and other articles, but I didn't find a good way to indent PHP. What I found: using ...
azzamsa's user avatar
  • 644
1 vote
0 answers
82 views

Eclim problems not being highlighted/problems not being shown in minibuffer

I know I have eclim setup correctly because everything else works, I.E I can do autocomplete, jump to definition etc. I can even see problems with eclim-problems. However, when I make a syntax error, ...
user7637341's user avatar
2 votes
1 answer
383 views

setting JDEE-server in emacs?

i've installed jdee from package-list it was elpa i think .. color highlight and indentation are working fine . but when i run any command ( JDEE commands ) i get this message : Customize ‘jdee-...
melbx's user avatar
  • 121
2 votes
0 answers
63 views

JDEE can not detect multi file

I have two files A.java (base class) and B.java (class). The class B succeed A. In file B.java, I compiled by C-c C-v C-c, then it can not detect file A.java with error message: cannot find symbol ...
Junbeom Lee's user avatar
2 votes
1 answer
173 views

disable on-click mail sending in java mode

using spacemacs in java mode, moving the mouse over an email address displays in the modeline the text mouse-1, C-c RET: mail this address. And if I click on it, a blank email sending form is opened ...
Emmanuel Touzery's user avatar
3 votes
4 answers
190 views

How do I find the variable or lisp code controlling a face at a particular column?

For the longest time I have been ignoring a face change at column 80 in my Java code. The text switches to a pinkish color as shown below. Now it is sufficiently bothersome that I would like to ...
pajato0's user avatar
  • 399
7 votes
5 answers
8k views

Setting up Ditaa in Org-mode

I've been having trouble setting up ditaa to work in emacs, I got my copy of the ditaa jar from here And I've been trying to run this code block #+begin_src ditaa :file hello.png :exports results +-...
Nalisarc's user avatar
  • 296
0 votes
1 answer
333 views

gud-break doesn't work with jdb

I successfully attach to my java app with emacs & gud, but gud-break doesn't work as expected: it runs only: stop at :48 if the line number is 48. So even the class name is missing and the ...
Emmanuel Touzery's user avatar
10 votes
1 answer
1k views

Which class or method or function am I in?

When navigating a source file with incremental search, I often find myself jumping into some context that is taller than the window. This raises the question: "Which class am I in?". Or, if the ...
davidrmcharles's user avatar
2 votes
1 answer
370 views

How to have c-offset style correctly detect a Java constructor and change indentation?

Currently my team (non-Emacs users) indent java like so: public DiskThresholdDecider(Settings settings, NodeSettingsService nodeSettingsService, ...
Lee H's user avatar
  • 2,737
23 votes
3 answers
22k views

Suitability of Emacs as a Java development IDE

I'm making yet another attempt to convert over to Emacs. I'm a decent Vi user but have been using Eclipse for most of my development work for the past 10+ years (has it been that long). So I did some ...
user1172468's user avatar
  • 1,047
3 votes
0 answers
60 views

Java dependency injection

I develop Java programs in Emacs occasionally, and adding a dependency to a dependency-injected class is a common action. For example, imagine adding the dependency Qux to the following class: // ...
Matthew Piziak's user avatar
1 vote
1 answer
2k views

Company eclim: cannot complete at point

What works I have installed emacs-eclim and have it working in my Java buffers. For example, I can invoke eclim-java-refactor-rename-symbol-at-point or eclim-java-show-documentation-for-current-...
Matthew Piziak's user avatar
1 vote
1 answer
1k views

Debugging and setting breakpoints in Java code built with Gradle

I am using Emacs (v24.4) for writing Java applications. I have created a Java library that I am building using Gradle (v2.2) and testing with Spock Framework where I have all my test cases. I would ...
ant2009's user avatar
  • 111
5 votes
2 answers
1k views

Make emacs format Java more consistently

When I open Java files originally created and edited in Emacs, the indentation shows up correctly, as in the image below: However, when I open the same file in Sublime Text, or any other editor ...
Adam R's user avatar
  • 53
6 votes
1 answer
949 views

Simple JDEE Setup for Existing Java Project

I imagine most developers, like myself, starting out with JDEE are beginning with source code that is already written as opposed to a new empty project. What I'm asking for is a simple explanation of ...
Drake Sobania's user avatar
1 vote
2 answers
458 views

Writing Emacs Packages in Java

I am an okay Java programmer and have very little knowledge of Emacs lisp, but I would still like to be able to write some packages for Emacs. Is there a way or package that would allow me to write a ...
user avatar