• Empleos
  • Sobre nosotros
  • profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
  • empresas
    • Inicio
    • Publicar vacante
    • Nuestro proceso
    • Precios
    • Pruebas Online
    • Nómina
    • Blog
    • Comercial
    • Calculadora de salario

0

287
Vistas
Cannot resolve json import Intellij after adding dependency and library .jar

I cannot seem to resolve this issue after adding the json-lib-2.4-jdk15.jar from an online source to the project dependencies, screenshots provided to show walkthrough of what I am doing. (and yes I have repeatedly tried "Invalidate caches and restart")

The error: enter image description here

This is my Project Structure ("cmd + ;" or "File > Project Structure")

enter image description here It doesn't seem to work on "Scope" set to Compile either. Note that I added the .jar file as a library too because I'm just really unsure as to why I can't get this to work. Any help is greatly appreciated, thanks.

What do I seem to be doing incorrectly here?

almost 3 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

The jar you have downloaded from https://sourceforge.net/projects/json-lib/ doesn't contain the classes you need. This jar contains net.sf.json package which is a different implementation of JSON Java library.

You are trying to use org.json.* classes which are provided by another library. The library you want to use is this one: JSON-java. At the bottom you can find the link to the Maven repository where you can get the jar file.

The latest version (at the moment of this reply) direct download link for the jar is here: json-20160810.jar.

Add it to the module dependencies and your problem should resolve.

Next time you observe similar issue browse inside the library jar under External Libraries node of IntelliJ IDEA project view and see what classes it contains and under which packages. This way you would know if the issue is caused by the wrong jar you've added to the dependencies and which doesn't actually contain the classes you want to use.

almost 3 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recomiéndame algunas ofertas
Necesito ayuda