just started a migration java 8 to 11.
While in java 8, rt.jar and others were easily available, we used
import com.sun.security.auth.module.NTSystem;
Using java 11, my IDE (intellij) tells me:
Error:(3, 36) java: cannot find symbol
symbol: class NTSystem
location: package com.sun.security.auth.module
Any idea what I need to change?
If your module doesn't have module-info.java then the class NTSystem should be available. Otherwise, you can add requires jdk.security.auth to make it available:
module <module-name> {
requires jdk.security.auth;
}
Also, remember that IDEA is a smart IDE and you can press Alt+Enter on the error line to see a quick fix for the error. In your case, IDE will propose to add requires jdk.security.auth.
Related
i try for 2 days to generate a documentation on android studio Bumblebee, i have try multiples possibility, generate documentation with -sourcepath /path/android.jar, command line in shell javadoc with just a class.java, select Jdk embedded in build deployment gradle, custom scope project, and more... but i have the same problem :
error: package does not exist
error: cannot find symbol
error: static import only from classes and interfaces
have you a solution ? thank you for helping me
I am very new to Java and using IntelliJ
I am running an open source file.
but the building giving this error
Error:(21, 43) java: package jdk.nashorn.internal.ir.annotations does
not exist
I tried installing JDK 11 but still getting the same error.
What I have to do so the system recognize this library?
Not sure if this will help you so many months later, I think you used the spring web initializer to create a new project, at the test class you will find you are importing that class, delete the import statement and then delete the test case, then try to re build the project and it should run, as it was mentioned at the comments the class is not longer part of Java 11, probably later on you can try to use Junit for some of your test cases
Adding JAVA_HOME on my env fixed the issue.
I moved my antlr4 based project which uses 6 different grammers to a different folder (and github depository). Now when I try to rebuild the Java project in I'm getting errors such as
Error:(30, 39) java: cannot find symbol
symbol: variable CharStreams
location: class com.applitools.ekb.PhpExtractInterfaceTool
even though the code includes
import org.antlr.v4.runtime.*;
and in a different grammar, it is even more explicit
import org.antlr.v4.runtime.CharStreams;
In the latter case, InteliJ (2019) colors CharStreams in red and says "cant resolve CharStreams"
All I did is copy the project over and all works as expected in the original project. I tried to unistall and then reinstall the antlr4 plugin - didn't help.
The error I get when I hover over scan.useDelimiter("\n"); is: "The type java.util.regex.Pattern cannot be resolved. It is indirectly referenced from required .class files"
I have tried re-installing my Java and JDK. JRE system library jre8 is referenced in the Java build path of my project. It's the workspace' default jre. It has rt.jar in it, which I am told, should contain all I need.
When I hit run I get "Exception in thread "main" java.lang.Error: Unresolved compilation problem: at pack.Main.main(Main.java:15)"
Line 15 only says public static void main(String[] args) { The code with the error is in the main class, not in the main method though.
My goal with this piece of code is to read user input, all of it until user hits enter. The delimiter part is there because on default scan.next() stops at spaces, I want the entire line.
Yes, I have cleaned my project.
Eclipse version: Indigo Service Release 2 Build id: 20120216-1857
Some code:
import java.util.Scanner;
import java.util.regex.*;
private static void someMethod(){
Scanner scan = new Scanner(System.in);
scan.useDelimiter("\n");
String pass = scan.next();
}
What is my next step here?
EDIT:
I'm getting a comparible error when using .contrains(String) on a String:
The type java.lang.CharSequence cannot be resolved. It is indirectly referenced from required .class files
String test = "bla_bla";
if(test.contains("a_"))
I had the same issue using JDK 1.8.0_20 and Eclipse 4.4.0. Eclipse kept saying "The import java.util.regex.Pattern cannot be resolved". This also wasn't happening in JDK 7 and 6. From my estimation, there must be something wrong with the package in JDK 8. I've also had the same issue with javax.swing.JTable with JDK 8, but not 7 or 6, so it must be JDK 8.
To solve the issue, I went to find a .jar file of the Util package that would contain a working Pattern class. After downloading one from http://www.java2s.com/Code/Jar/r/Downloadregexjar.htm, and incorporating it into my build path, Pattern once again worked. The same solution also solved my issue with the Swing package.
This is not the ideal solution, as the .jar file contains a lot of redundant packages already included in JDK 1.8.0_20, but it was the only solution I could come up, besides downgrading to JDK 7 or 6.
I do hope Oracle does fix this issue soon in future releases of JDK 8.
Hope this helps!
I am trying to "Mavenize" our existing Commerce solution. However, I am getting a weird error when I try to run mvn compile I get the following error.
[ERROR] /home/user/tmp/IBM/WCDE_ENT70/workspace/WebSphereCommerceServerExtensionsData/ejbModule/org/ecommerce/wcs/changerequest/ChangeRequestAccessBean.java:[347,32] cannot find symbol
[ERROR] symbol : method createAccessBeans(java.util.Collection)
[ERROR] location: class org.ecommerce.wcs.changerequest.ChangeRequestAccessBean
When I check the class it is related to the com.ibm.ivj.ejb.runtime.AbstractEntityAccessBean class which IBM has neglected to include JavaDoc for anywhere. I look into eclipse and it shows me the method in question was correct using code complete, however, it still fails with maven.
I am wondering if it isn't a customisation to the IBM jre (I am not using that for this POC) and if there is no way around it (short of extending the class and reimplementing).
Anyone?
Problem had to do with multiple imports of different versions of the same dependency. Now this has been resolved.