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.

Java 10: The type java.lang.Object cannot be resolved

See original GitHub issue
Environment
  • Operating System:
$ uname -a
Linux localhost.localdomain 4.15.9-200.fc26.x86_64 #1 SMP Mon Mar 12 17:11:43 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux
  • JDK version: openjdk version "10" 2018-03-20
  • Visual Studio Code version:
Version 1.21.1
Commit 79b44aa704ce542d8ca4a3cc44cfca566e7720f1
Date 2018-03-14T14:46:30.761Z
Shell 1.7.9
Renderer 58.0.3029.110
Node 7.9.0
Architecture x64
  • Java extension version: 021.0
Steps To Reproduce
  1. These:
wget https://download.java.net/java/GA/jdk10/10/binaries/openjdk-10_linux-x64_bin.tar.gz
tar xf openjdk-10_linux-x64_bin.tar.gz
pushd jdk-10
export JAVA_HOME=export JAVA_HOME=$(pwd)
popd
git clone git@github.com:elastic/elasticsearch.git
pushd elasticsearch
code .
  1. Open a java file like Bootstrap.java to kick of the language service.
  2. Mouse over /* on line 1. You get
The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files

I get a bunch of errors in the logs like:

message: Unbound classpath container: 'JRE System Library [JavaSE-1.8]' in project ':benchmarks';code: 963

And some around cycles but I don’t think either of these are a problem here because when I restart with Java 9 like so:

echo Drop back to the last commit that supported java 9
git checkout eebda6974dea3445d5a4043a843d206046861470
export JAVA_HOME=/usr/java/jdk-9.0.4
rm -rf ~/.config/Code/User/workspaceStorage/*
code .

I once again get definitions for things like Object.

If I jump back to java 10 while still on the java 9 supporting commit and restart everything breaks again.

I haven’t tested this outside of Elasticsearch because I don’t have another project handy but I don’t see any issues around Java 10 so I kind of expected it to just work.

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Reactions:2
  • Comments:14 (4 by maintainers)

github_iconTop GitHub Comments

3reactions
nik9000commented, Apr 1, 2018

You can try http://download.jboss.org/jbosstools/jdt.ls/staging/java-0.22.0-912.vsix

Works for me. Thanks for the quick response, @snjeza!

2reactions
nik9000commented, Mar 31, 2018

From @Snjeza it looks like has been fixed upstream so we’re just waiting in them to release and vscode-java to upgrade.

I’m stuck on Java 10 so this issue prevents me from using vscode-java. I admit I’m probably in the minority. We try to keep up with all the new Java releases to be good open source citizens but lots of projects don’t have time for that.

On Sat, Mar 31, 2018, 3:15 AM ChirayuShishodiya notifications@github.com wrote:

I’m facing the same issue.

  • Operating System: Windows 7 Ultimate Service Pack 1
  • Java version: java version “10” 2018-03-20 Java™ SE Runtime Environment 18.3 (build 10+46) Java HotSpot™ 64-Bit Server VM 18.3 (build 10+46, mixed mode)
  • Visual Studio code version: Version 1.21.1 Commit 79b44aa704ce542d8ca4a3cc44cfca566 e7720f1 Date 2018-03-14T14:46:47.128Z Shell 1.7.9 Renderer 58.0.3029.110 Node 7.9.0 Architecture x64
  • Language support for Java extension version: v0.21.0
  • Maven for Java extension version: v0.6.0

Steps to reproduce:

  1. Using the ‘Maven for Java’ extension, generate a new project archetype by the name, maven-archetype-quickstart.
  2. Open one of the .java files in the project to kick off the Language Support.
  3. Mouse over any of the import statements. You will get errors like: The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files and The import java.util cannot be resolved

— You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/redhat-developer/vscode-java/issues/483#issuecomment-377672565, or mute the thread https://github.com/notifications/unsubscribe-auth/AANLoq9HCRvwHIigE-abDB7ug_f4l6b6ks5tjyzzgaJpZM4TAgmx .

Read more comments on GitHub >

github_iconTop Results From Across the Web

Java project in Eclipse: The type java.lang.Object cannot be ...
While we are working with tomcat 6 and jdk 1.8 versions, some of the features will not work and this error ...
Read more >
"The type java.lang.Object cannot be resolved" when building ...
"The type java. lang. Object cannot be resolved" when building multithreaded with OpenJDK17 · Issue #1099 · eclipse-tycho/tycho · GitHub.
Read more >
Java project in Eclipse: The type java.lang.Object ... - Intellipaat
1 Answer · Close the project and resume it. · Clean the project (It will restore the buildpath hence reconfiguring with the JDK...
Read more >
'The type Java.lang.Object cannot be resolved. It is indirectly ...
You need to go to your Java preferences and make sure you have a valid JRE selected for your project (it could be...
Read more >
The type java.lang.Object cannot be resolved. It is indirectly ...
Above error shows up when you do not have JRE or JDK not added to your build path. This is the well-known bug...
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