Learn, Share, Build

October 08, 2017, at 05:16 AM

I've got a very simple program:


package com;
import sun.misc.Contended;
public class Test {

and pom.xml

<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
     xsi:schemaLocation="http://maven.apache.org/POM/4.0.0                              http://maven.apache.org/xsd/maven-4.0.0.xsd">

when I put mvn compile I've got:

[ERROR] Failed to execute goal org.apache.maven.plugins:maven-compiler-plugin:3.2:compile (default-compile) on project proj: Compilation failure
[ERROR] /home/john/Desktop/proj/src/main/java/com/Test.java: cannot find symbol
[ERROR] symbol:   class Contended
[ERROR] location: package sun.misc


Answer 1

Because, sun.misc moved to jdk.internal.misc and they are private package to JDK.

... friend interfaces should be moved out of 'sun.misc' and located in a truly private package. This is so that they are not part of the proposed to be exported 'sun.misc' package.

You can use --add-exports and --add-opens to gain access to internal API.

In your case, you can add following in your pom.xml


Please note, you need to change <<your.module>> to your actual module name.

Reference : - JEP-261:Module System

Learn, Share, Build

Learn, Share, Build

The { symbol is not working in eclipseIf I try to use it, it turns on and off the Skip All Breakpoints opportunity

Learn, Share, Build

Learn, Share, Build

Suppose I have a synchronized block on an Object lock

Learn, Share, Build

Learn, Share, Build

I try to debug Java code on Visual Studio Code, but I always get this error Failed to resolve classpath: Main class '<name of mainclass here>' doesn't exist in the workspaceI need help

Learn, Share, Build

Learn, Share, Build

I have an application created in Spring Boot https://githubcom/JonkiPro/REST-Web-Services