Reputation: 14296
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
Reputation: 1548
Select the required module from the drop down list in Use classpath of module(as answered by @Andrey)
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
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:
Upvotes: 23