繁体   English   中英

如何制作新的主 class? 已经制作了一个,但不是自己的。java 文件,目前无法使用

[英]How do I make a new main class? There is already one made but its not its own .java file and currently does not work

I am using Lobo Browser in NetBeans 11.2 and I cant run the program because NetBeans cannot read which file has the Main class which is in the main browser file (main class of main browser code below) I would like to get this working because I need我想窃取一些代码,但我想先看看浏览器是如何运行的。

    public static void main(final String[] args) {

    // Detect if we are running on mac
    if (isMac()) {
      System.setProperty("apple.laf.useScreenMenuBar", "true");
      System.setProperty("dock.name", "LoboBrowser");
    }

    // Checking for stack allows us to call AccessController.doPrivileged()
    // which in turn allows us to reduce the permissions on Uno codesource
    final int stackDepth = Thread.currentThread().getStackTrace().length;
    if (stackDepth > 11) {
      System.err.println("Stack depth (" + stackDepth + ") is too deep! Quitting as a safety precaution");
      Thread.dumpStack();
      System.exit(1);
    } else {
      privilegedLaunch(args);
    } 
}
  private static void launch(final String[] args) {
    try {
      final SSLSocketFactory socketFactory = TrustManager.makeSSLSocketFactory(ReuseManager.class.getResourceAsStream("/trustStore.certs"));
      ReuseManager.getInstance().launch(args, socketFactory);
    } catch (final Exception err) {
      final StringWriter swriter = new StringWriter();
      final PrintWriter writer = new PrintWriter(swriter);
      err.printStackTrace(writer);
      writer.flush();
      JOptionPane.showMessageDialog(new JFrame(),
              "An unexpected error occurred during application startup:\r\n" + swriter.toString(),
              "ERROR", JOptionPane.ERROR_MESSAGE);
      System.err.println(swriter.toString());
      System.exit(1);
    }
  }

我相信您必须将主要方法放入 class 中,如此处所述http://tutorials.jenkov.com/java/main-method.html 我知道在 net beans 你可以告诉它要尝试运行什么 class 我认为右键单击运行然后选择要运行的文件,如果设置正确,它将运行该文件。

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM