package com.sun.security.ntlm does not exist - java

I've jdk1.8.0_25 installed on my system but at the time of maven compiling there is always package com.sun.security.ntlm does not exist error occur on ** import com.sun.istack.internal.NotNull;** line. I've found same problem on web but no one can help me to skip this problem.Once again there is a guva.jar used on the project

Although your error is on the NotNull class import, if you really want to work directly with the NTLM classes instead of the Authenticator facilities, you could import anything from the com.sun.security.ntlm package as long as you have the corresponding compiled classes in your classpath (files which are not easy to find).

Related

VS Code - The import "#####" cannot be resolved

So, i am running a java project which have many library that are available in the current working directory but VS code seems to not recognize these library and giving out error "The import ###### cannot be resolved" ex: The import org.apache.pdfbox.pdmodel.PDDocument cannot be resolved"
here is the image that might help you to know more about it
This is the package that i am working on :
Here the org/apache is the library contain the class file that are need to be imported and FileArrangement.java is the file having the import statements
Error i have been receiving
this is what VS code is been showing
i really need your help because i really don't have any idea how to correct this
I have checked other projects and they are also showing the same result although the import statements for java classes like . java.util.ArrayList doesn't show any kind of error and i have tried to clean java in VS code it also didn't work
i just need to correct this error of VS code to import the classes that i need
No error on java.util package
Putting the libraries in your current working directory does not work for Java, you need to add them to the classpath.
If you're using maven, that manages the classpath for you.
If not, you can manage it in VS Code by executing the Java: Configure Classpath command from the Command Palette (Ctrl+Shift+P).
You can add dependencies via Referenced libraries under the JAVA PROJECTS panel.
Or use java.project.referencedLibraries setting in settings.json.
For example:
"java.project.referencedLibraries": [
"library/**/*.jar",
"/home/username/lib/foo.jar"
]
Details can be found in configure-classpath and manage-dependencies.

Android compile single .java file to .class

I have same jar lib for android where I need change class. I opened .jar find and decompile class, do same changes. I need add updated file to jar. As I understand I need compile .java to .class, and then repack jar.
I try convert to classes with javac.exe MyClass.java and I get a lot of errors like
import android.annotation.SuppressLint;
.java:8: error: package android.content does not exist
import android.content.Context;
.java:9: error: package android.graphics does not exist
import android.graphics.Color;
in total 149 errors
Do you have any ideas?
These error messages are the java compiler telling you that there's some android dependencies that he can't figure out how or where to find.
I don't think it's possible to achieve this, because it seems your class relies on Android framework resources.
Take a look at:
compile android app with javac
Did you consider inheritance ? I mean, the desired different behaviour for android maybe can be achieved by inheriting the class then overriding the specific method with new behaviour, I'm just guessing, since I don't have enough info about your problem.

Only a type can be imported. <class> resolves to a package

Since a very long time I'm using STS (eclipse) to code on jenkins and jenkins-plugins.
But since I upgraded to the latest version (STS 3.8.1) I'm not able to do so anymore... The reason is an error I get when ever I import a jenkins-plugin project (maven based, e.g. https://github.com/jenkinsci/config-file-provider-plugin/):
Only a type can be imported. com.cloudbees.plugins.credentials.impl.UsernamePasswordCredentialsImpl resolves to a package
While the message is true about the fact that there is a package called the same as a class, this is the case for many many classes in the source of Jenkins. This is actually a convention, all resources belonging to a specific class have to be places in a package with the same name as the class.
Is there anything I can do to ignore this error?
its a bug in eclipse and hopefully fixed soon: https://bugs.eclipse.org/bugs/show_bug.cgi?id=495598

error package org.python.util does not exist, compilation with ant

I am trying to call a python method in java, similar functionality as Unresolved import org.python / working with jython and java?
However, I am using ant to compile and run my files. using import org.python.util will give me this error
package org.python.util does not exist
I can see that python.org.util exists in jython-2.5.0.jar.
So, here is the class path I have in my build.xml ant file:
classpath="${java.class.path}:./jgrapht/lib/jgrapht-jdk1.5.jar:\
./jgrapht/lib/jgraph.jar:./jgraphx/lib/jgraphx.jar:\
./jython/lib/jython-2.5.0.jar:./colt/lib/colt.jar:."
and I also I added the path to jython jar files to my class path. i.e. looks like echo $path gives me all the required paths. Is there anything missing here that I am not aware of?
Try this to make all classes in the package available:
import org.python.util.*;
Or this to include a particular class:
import org.python.util.TemplateAntTask;
EDIT: Also, looks like there is an extra slash after jython-2.5.0.jar in your classpath.

Importing a Java Package in root directory

I am in a sub domain subdomain.site.com and there is a java package higher up in the root directory at /usr/share/sphinx/api/java.
The typical thing to do to import this package would be to write
import sphinx.api.java;
However when I just do that, I get a package does not exist error.
What's the solution to this? Some sort of path definition?
(Im on Linux CentOS)
That isn't a package, that is a directory structure. I seriously doubt that is a actual package definition. If a class is there, it probably is in the default package which in the newer JDKs can't be imported.
you're missing the semi-colon at the end of the line:
import sphinx.api.java;

Categories

Resources