I like worksheets as an alternative to the REPL, but I keep implementing functions in the worksheet and then copying them back into the actual project. How do I import a package from the current project so that I can call those functions in the worksheet?
Is there a way to import packages from your current project into a worksheet
No, i tried the obvious, but overlooked a separate obvious mistake -- my worksheet was in a different project ( i had two worksheets and was using the wrong one, duuh) –
Japan
Answer wasn't obvious to me either. The "._" bit escaped me. –
Rebatement
There is nothing special to do. Just do regular import of the packages you need in the worksheet. For instance:
import com.acme.myproject._
The worksheet is a totally regular source file, that simply gets evaluated in a fancy manner on save.
This is not working for me. I keep getting a notFound type error, however y I press Command and click on the class the Class opens, so on one hand it seems to "know" which class im refering to, and on the other it just wont run because the Class is not found –
Cosset
same problem here - my not-yet-published package
com.myCompany.myPackage
. If I want to use: import com.myCompany.myPackage.MyPackage
: object myPackage
is not a member of package com.myCompany
–
Datnow © 2022 - 2024 — McMap. All rights reserved.