我正在学习Java,但我遇到了问题.我创建了6个不同的类,每个类都有自己的main()方法.我想.jar为每个类创建可执行文件,即6个可执行.jar文件.
到目前为止我试过了
java -jar cf myJar.jar myClass.class
Run Code Online (Sandbox Code Playgroud)
我得到'无法访问jarfile cf'.我做错了什么,但我不知道是什么.如果这意味着什么,我也在使用Eclipse IDE.
我有个问题.首先,我宣布了一张地图:
Map<TwoIntClass, Set<Integer>> m = new HashMap<TwoIntClass, Set<Integer>>();
Run Code Online (Sandbox Code Playgroud)
现在,我想把东西放在这个地图中,比如说
int num = 7;
m.put(new TwoIntClass(5, 3), ?? how to put num inside Set ??);
Run Code Online (Sandbox Code Playgroud)
我的问题是,如何将变量num放入Set中.谢谢.
我有以下问题.在我的解决方案中,我有2个控制器:主页和帐户.到目前为止一切都有效.但是当我在HomeController上面添加[Authorize]时,例如
[Authorize]
public class HomeController : Controller
{
...
Run Code Online (Sandbox Code Playgroud)
我明白了
System.InvalidOperationException: The partial view 'Repository' was not found or no view engine supports the searched locations. The following locations were searched:
~/Views/Account/Repository.aspx
~/Views/Account/Repository.ascx
~/Views/Shared/Repository.aspx
~/Views/Shared/Repository.ascx
~/Views/Account/Repository.cshtml
~/Views/Account/Repository.vbhtml
~/Views/Shared/Repository.cshtml
~/Views/Shared/Repository.vbhtml
Run Code Online (Sandbox Code Playgroud)
部分视图存储库位于HomeController内部,因此其View位于〜/ Views/Home/Repository.cshtml中,但它在Shared或Account文件夹中存在.正如我所说的,如果HomeController类之上没有[Authorize],那么一切都按预期工作.
发生错误的代码在_Layout.cshtml中
@Html.Partial("Repository")
Run Code Online (Sandbox Code Playgroud)
感谢帮助.