Michel Feinstein
Michel Feinstein

Reputation: 14296

"cannot find symbol" error in IntelliJ IDEA Scratch

I am trying to run some code in a Scratch java file, from IntelliJ IDEA, but once I add a class in my project and try to run it, I get the following error:

Error:(1, 45) package com.example does not exist
Error:(11, 9) cannot find symbol
  symbol:   class MyClass
  location: class Scratch

How can I use my project's classes in a Scratch file?

Upvotes: 9

Views: 4276

Answers (2)

Sakshi
Sakshi

Reputation: 1548

  1. Select the required module from the drop down list in Use classpath of module(as answered by @Andrey)

  2. Now got to Build then select Build Project or Rebuild Project.

These two steps helped me to resolve the issue.Hope it helps you too !

Upvotes: 2

Andrey
Andrey

Reputation: 16401

Make sure the Scratch Run configuraiton has the module, which has these classes defined, specified in Use classpath of module drop-down list: enter image description here

Upvotes: 23

Related Questions