question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Where do I put libraries (jars) if I want to use them in my class?

See original GitHub issue

The only way I managed to make LSP give me autocomplete options for .jars is when I put them inside /workspace/jdt.ls-java-project/lib folder and manually changing /workspace/jdt.ls-java-project/.classpath file to:

<?xml version="1.0" encoding="UTF-8"?>
<classpath>
	<classpathentry kind="src" path="src"/>
	<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
	<classpathentry kind="output" path="bin"/>
	<classpathentry exported="true" kind="lib" path="lib/selenium-api-3.141.59.jar"/>
</classpath>

The problem with this is that the LSP eventually overwrites .classpath file and won’t give me library autocompletion anymore until I manually add it in again. Where do I put my .java and .class files in order for LSP to include them in my editor so I get autocompletion for imports, classes, etc.?

I am using Monaco Editor with monaco-languageclient and custom websocket server that starts an eclipse-jdt-ls.jar and redirects jsonrpc commands to it. Can there somehow be a problem with my configuration?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:2
  • Comments:18 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
ANtlordcommented, May 23, 2021

I’m sorry but I lost it. I used Java to complete a course so I didn’t care about a reliable solution. Eventually I had a folder jdt.ls-java-project in the root of a project, the folder has such .classpath. I remember that later I copied the file from project to project. @rubencaro

I had some experiments on the launch command but I can’t remember why I comment them out.

Hope it helps

0reactions
jdneocommented, Jul 5, 2021

Closing since the issue seems been resolved.

@ANtlord Free to comment if you need more help.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to Add Libraries to a JAR - Java Basics - GitHub Pages
Solution 1: Using the Class-Path Attribute · Solution 2: Unpack Library JARs into a Single JAR · Solution 3: Call java with all...
Read more >
Where to put the external jars? [duplicate] - Stack Overflow
If you're wanting to include a JAR file to your Eclipse project, you would generally create a 'lib' folder inside the project folder, ......
Read more >
Adding a JAR file or class folder to a Java XOM - IBM
Click Java Execution Object Model in the list of properties. Click the Libraries tab to display the Libraries page so that you can...
Read more >
Adding Classes to the JAR File's Classpath
We want to load classes in MyUtils.jar into the class path for use in MyJar.jar. These two JAR files are in the same...
Read more >
Defining and using Java libraries via JAR files - Tutorial
A JAR can contain Java classes and other resources (icons, property files, etc.) and can be executable. You can distribute your program in...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found