英文:
Exception in thread "main" Syntax error: This module cannot be found. Java Alloy program not compiling
问题
我已经编写了一个Java程序,用于执行Alloy(.als)文件。当我在命令行中使用该程序时,它运行得很完美;但是当我尝试在NetBeans中运行它时,会显示以下错误:
> > Exception in thread "main" Syntax error: > This module cannot be found. > It is not a built-in library module, and it cannot be found at "C:\Users\brinto dibyendu\Documents\NetBeansProjects\Alloy\util\integer.als". >
我该怎么办?
英文:
I have written a Java program that will execute an Alloy (.als) file. When I am using the commandline the program works perfectly but when I try to run it using NetBeans, this error is shown:
>
> Exception in thread "main" Syntax error:
> This module cannot be found.
> It is not a built-in library module, and it cannot be found at "C:\Users\brinto dibyendu\Documents\NetBeansProjects\Alloy\util\integer.als".
>
What can I do?
答案1
得分: 0
Alloy是使用在Eclipse中运行的Bndtools构建和开发的。试图在Netbeans中运行它只会产生大量的问题,而通过采用默认路线可以避免这些问题。
在Eclipse中,所有设置以立即调试主应用程序。实际上,它确保解析是内联处理的,而不是在另一个进程中处理,因此更容易调试。然后只需对其进行调试。搜索“内置库模块”并查看正在发生的情况。
更好的是,在Eclipse中,即使对Java源代码进行微小的更改,也会立即在运行时反映出来。
英文:
Alloy is built & developed with Bndtools running in Eclipse. Trying to run it in Netbeans is just creating a huge amount of problems that you can avoid by taking the default route.
In Eclipse, all set up to immediately debug the main application is already done. It actually ensures resolves are handled inline instead of in another process so they are easier to debug. Then just debug it. Search for "built-in library module," and see what's happening there.
Even better, in Eclipse even the tiniest change you make to Java source code is immediately reflected in the runtime.
答案2
得分: 0
最快的修复方法是在文件系统中复制工具的 .als 文件。
假设您的模型(.als)文件位于文件夹 C:\Users\brinto dibyendu\Documents\NetBeansProjects\Alloy\
,您需要在该文件夹中创建一个 util\
子目录,并将整数工具模型(integer.als)的源代码复制到该子目录中。
您可以在这里获取工具模型文件。
英文:
The quickest way I've found to fix this is to duplicate the .als files for the utilities in your file system.
Assuming your model (.als) file is in folder C:\Users\brinto dibyendu\Documents\NetBeansProjects\Alloy\
, you'll need to create a util\
subdirectory in that folder and copy the source of the integer utility model (integer.als) into that subdirectory.
You can get the utility model files here.
专注分享java语言的经验与见解,让所有开发者获益!
评论