Can't set main package
See original GitHub issueHi, I’ve a project where my uniquely mentioned source file in asconfig.json
defines the main class in a named package.
package com.hydroper.dsterminal
{
public class TmView extends Sprite implements IView
{
/* ... */
}
}
So, building the project as follows:
- Goto Run build task & ActionScript: compile debug build.
Just fails with the message:
Error: Unable to resolve root class of SWF: TmView
The project (FlashDevelop version) already built fine. So I wonder if it’s right now possible to set the main package w/ AS & MXML? I read the entire asconfig.json wiki, btw, but most related options serve only for setting library and source paths, andn’t the main namespace. Including classes won’t work, either (totally unrelated to “files”: […]).
Truth
I forgot I could use the source-path
option. It just made my build.
{
/* ... */
"compilerOptions": {
"source-path": [ "src" ],
"output": ".build/target/terminal.swf"
},
/* ... */
}
Issue Analytics
- State:
- Created 5 years ago
- Comments:10 (3 by maintainers)
Top Results From Across the Web
go run: cannot run non-main package - Stack Overflow
I am getting "go run: cannot run non-main package" error, if I run following code. package zsdfsdf import ( "fmt" ) func Main()...
Read more >"Cannot set package name for compiled files" when moving a ...
"Cannot set package name for compiled files" when moving a file to a package · Right click on a top-level declaration in the...
Read more >Cannot import main: a Go Module gotcha - Applied Go
The problem is that the test driver (_testmain.go) needs to import the package and if the import path is “main”, gc will refuse...
Read more >Java Guide: How to Fix "Could not find or load main class"
The Java “Could not find or load main class” error is thrown when the JVM fails to find or load the main class...
Read more >Fixing the “Declared package does not match the expected ...
In this article, we'll investigate the “Declared package does not match the expected package” error in a java project.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Some more info about your folder structure would be helpful. Is everything under a main src folder? Or is platforms a sibling of src? Does either of the classes have a package?
Ultimately, you’ll need exactly one entry in files, but you may need one or two entries in source-path too. What goes in source-path depends on your folder structure.
As I mentioned,
files
should almost always contain one file. In your case, for iOS, you’ll want this:Then, since you have multiple source paths, you’ll want
source-path
to look like this:However, I would recommend moving your core classes into a src folder, that is a sibling of platforms. Right now, you have two overlapping source paths (platforms/iOS is inside .), which could lead to unexpected issues (potentially including IDEs, or even the compiler, getting confused).