如题,出现的原因是这样的:我将mac系统上的eclipse项目复制到了ubuntu环境下,通过vscode的远程功能连接ubuntu。

然后项目上就出现了各种报错,显示The type java.lang.Object cannot be resolved。

查明原因是两个系统的jdk不一致,所以生成的项目配置不一样。

查看.classpath文件,它是用于配置jdk版本的。

原来是这样:

<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-12"/>

修改后是这样:

<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/JavaSE-1.8"/>

然后重启vs code就没有报错了。

注意不要直接复制我的,具体修改成怎样,看你jdk的版本,可以试试在vscode生成一个新的项目,看看.classpath是怎么配置的。

出现这个问题的原因有很多:

类似jdk或jre没有指定;可以尝试vscode clean the java language server workspace。

VSCode部署JAVA项目出现The type java.lang.Object cannot be resolved的更多相关文章

  1. 部署hibernate框架项目时出现问题:The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files.

    基本情况: (这些其实关系不大)我是直接impor导入HibernateDemo项目到eclipse中的,该项目的hibernate版本是3.6.7.Final版,使用了Hibernate Tools ...

  2. The type java.lang.Object cannot be resolved

    有时候在Eclipse中打开或者导入项目时会出现标题字样的问题:The type java.lang.Object cannot be resolved. It is indirectly refer ...

  3. 解决本机安装多版本jdk导致The type java.lang.Object cannot be resolved It is indirectly referenced ...

    本机开始安装了jdk1.6,然后安装了jdk1.8 当在调自动化的时候,发现传入函数传参String类型,报错The type java.lang.Object cannot be resolved ...

  4. eclipse中java文件报错:The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files

    问题:The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class fi ...

  5. 【典型错误】The type java.lang.Object cannot be resolved.

    参考:http://blog.csdn.net/wo519074786/article/details/7697967 The type java.lang.Object cannot be reso ...

  6. The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files

    The type java.lang.Object cannot be resolved.It is indirectly referenced from required .class files ...

  7. 杂(三)-The type java.lang.Object cannot be resolved It is indirectly referenced ...

    The type java.lang.Object cannot be resolved. It is indirectly referenced from required .class files ...

  8. Java MyEclipse:The type java.lang.CharSequence cannot be resolved. It is indirectly referen

    从svn上下载项目后配置weblogic后启动报错: myeclipse  The type java.lang.CharSequence cannot be resolved. It is indi ...

  9. java项目的心得,java项目的代码层次的架构划分

    java项目使用的架构是ssm(Spring+SpringMVC+MyBatis). 一.后台代码一般分三层,Controller,Service,Dao. 1.Controller层是对前端或者接口 ...

随机推荐

  1. C++:重载前置++/--返回引用,重载后置++/--返回临时对象

    标准库中iterator对++/--的重载代码如下: _Myiter& operator++() { // preincrement ++*(_Mybase *)this; return (* ...

  2. Ambari HDP 下 SPARK2 与 Phoenix 整合

    1.环境说明 操作系统 CentOS Linux release 7.4.1708 (Core) Ambari 2.6.x HDP 2.6.3.0 Spark 2.x Phoenix 4.10.0-H ...

  3. 基于 Serverless Component 全栈解决方案 Ⅱ

    虽然之前的文章 基于 Serverless Component 的全栈解决方案 介绍了如何借助 Serverless Component 快速搭建 Restful API 后端服务 和 Vue.js ...

  4. this的使用情况

    this的几种使用情况 1.在普通函数内部,this指向的是window,在严格模式下,this的值是undefined function fun(){ console.log(this); } fu ...

  5. H5谷歌登录 webview错误

    接入谷歌登录 H5接入谷歌登录打包apk使用webview谷歌登录不上(谷歌不支持用户代理被归类为嵌入式用户代理(也称为网络视图),因此不允许向Google发出OAuth授权请求) 解决办法:替换ua ...

  6. html5之table嵌入form表单布局(务必注意:table标签必须在form表单内部,不能再form表单外部!)

    切记:用table标签来布局form表单元素,table标签必须放在form表单内部,否则可能会出现各种bug 原文地址:https://blog.csdn.net/weixin_43343144/a ...

  7. SVN状态图标不显示的解决办法

    第一步:检查设置 右键->TortoiseSVN->setting->Icon Overlays->Status cache->default/Shell.或者 右键-& ...

  8. Windows、Linux之间传输文件的几种方式

    常见的文件传输协议有ftp.sftp,sftp就是在ftp的基础上对传输的数据进行了加密. ftp速度快,sftp速度略慢但安全性高. ftp默认使用21端口,sftp默认使用22端口. 我使用的是C ...

  9. Java虚拟机——JVM

    一.JVM整体架构 1.JVM(Java虚拟机):指以软件的方式模拟具有完整硬件系统功能.运行在一个完全隔离环境中的完整计算机系统,是物理机的软件实现.常用的虚拟机有VMWare.Virtual Bo ...

  10. 传智播客C++视频学习笔记(1)

    下载Visual Studio Community版本, #include<iostream> using namespace std; int main() { cout << ...