简体   繁体   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 some code that I want to steal but I would like to see how the browser runs first. 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);
    }
  }

I believe you have to put the main method with in a class as described here http://tutorials.jenkov.com/java/main-method.html .我相信您必须将主要方法放入 class 中,如此处所述http://tutorials.jenkov.com/java/main-method.html I know in net beans you can tell it what class to try to run by I think right clicking the run then selecting what file to run and if its set up correctly it will run the file.我知道在 net beans 你可以告诉它要尝试运行什么 class 我认为右键单击运行然后选择要运行的文件,如果设置正确,它将运行该文件。

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

相关问题 如何将main方法分成自己的类? - How do I seperate main method into its own class? 为什么Android有自己的DateFormat类,如果Java已经有了? - Why Does Android has its own DateFormat class if Java already has one? 如何检测Java类是由其自己的main()调用还是从另一个类调用? - How can I detect if a Java class is called by its own main() or from another class? 如何在不调用程序包的情况下调用用Java创建的变量? (同班) - How do I call a variable I made in Java without calling the package? (its in the same class) 如何从Java中自己的类返回类的枚举? - How do I return a class' enums from its own class in Java? 如何使用自己的类克隆基于对象的数组列表? - How do I clone a object based arraylist with its own class? 如何让程序用Java创建自己的变量? - How do I have a program create its own variables with Java? main 方法中使用的方法是否需要自己的类? - Does a method used in main method need its own class? 如何通过将方法添加到Java中已经存在的库类中来创建新类? - How do I make a new class by adding methods to an already existing library class in Java? 如何让“p:focus”在这个简单的应用程序中正常工作(它目前根本没有“聚焦”) - How do I get “p:focus” to work properly in this simple app (its currently not “focusing” at all)
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM