Exception in thread "main" java.awt.HeadlessException

請問解決以下報錯的方法:

Exception in thread "main" java.awt.HeadlessException
at java.awt.GraphicsEnvironment.checkHeadless(GraphicsEnvironment.java:204)
at java.awt.Window.(Window.java:536)
at java.awt.Frame.(Frame.java:420)
at java.awt.Frame.(Frame.java:385)
at javax.swing.JFrame.(JFrame.java:189)
at com.stepforward.Mirrorworld.P4_View.Thing_Manager_View.(Thing_Manager_View.java:68)
at com.stepforward.Mirrorworld.P2_Base_Bean.Thing_Manager_Service.Set_visible(Thing_Manager_Service.java:33)
at com.stepforward.Mirrorworld.MirrorworldApplication.main(MirrorworldApplication.java:24)

背景:

我計劃把已在開發的非web工程轉換成web工程,我打算分兩步實施:先將非web工程搬到spring boot架構上,然後再來開發表示層組件。

2个回答

在java的启动项里加上 -Djava.awt.headless=false;
或者在程序入口添加 System.setProperty("java.awt.headless", "false");

这是 awt 呢,普通 Java 的图形界面工程,是否有必要转换成 web 工程呢?
参考这个:https://blog.csdn.net/qq_32451699/article/details/52344581

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
其他相关推荐
java程序编译成功但运行不了(Exception in thread "main" java.lang.IllegalArgumentException

D:\work>javac JComboBoxDemo.java D:\work>java JComboBoxDemo Exception in thread "main" java.lang.IllegalArgumentException: adding container' s parent to itself at java.awt.Container.checkAddToSelf(Unknown Source) at java.awt.Container.addImpl(Unknown Source) at java.awt.Container.add(Unknown Source) at JComboBoxDemo.go(JComboBoxDemo.java:61) at JComboBoxDemo.main(JComboBoxDemo.java:12) D:\work> 以上是我的程序运行情况,如有你知道点什么,给我留言 附件是我的java程序

Exception in thread "main" java.lang.NullPointerException

import org.apache.commons.io.FileUtils; import org.json.JSONException; import org.json.JSONObject; public class ReadJSONSample { public static void main(String[] args) throws IOException, JSONException { File file = new File(ReadJSONSample.class.getResource("/wangxiaoer.json").toString()); String content = FileUtils.readFileToString(file); JSONObject jsonObject = new JSONObject(content); System.out.println("姓名是:"+jsonObject.getString("name")); } } 控制台运行后报错 Exception in thread "main" java.lang.NullPointerException at json.ReadJSONSample.main(ReadJSONSample.java:13)

Java中遇到的一个异常Exception in thread "main" java.lang.NullPointerException

import java.util.*; public class NewHashTest { public static void main(String[] args) { HashMap hash = new HashMap(); Emp emp1 = new Emp("laoda","111",123f); Emp emp2 = new Emp("laoer","222",234f); Emp emp3 = new Emp("laosan","333",5466f); hash.put(111,emp1); hash.put(222,emp2); hash.put(333,emp3); if(hash.containsKey(111)) { Emp em = (Emp)hash.get(111); em.info();//可以正常显示 } Iterator iter = hash.keySet().iterator(); while(iter.hasNext()) { String key = iter.next().toString(); Emp ems = (Emp)hash.get(key); ems.info();//这里会报错 } } } class Emp { String name; String number; float slary; public void info() { System.out.println("名字叫:"+name); System.out.println("编号为:"+number); System.out.println("薪水是:"+slary); } public Emp(String name,String number,float slary) { this.name = name; this.number = number; this.slary = slary; } } 会在ems.info();一行报一个Exception in thread "main" java.lang.NullPointerException的错误,是不是传入的KEY类型有问题,还是什么别的问题,求指点。

Exception in thread "main" 1java.lang.NullPointerException at Y.main(Y.java:14) 这是增么了 大神们

public class Y { public static void main(String[] args) { int Yh [][]=new int [10][]; for(int j=0;j<Yh.length;j++) { Yh [j]=new int[j+1]; Yh [j][0]=Yh[j][j]=1; if(j>1) { for(int i=1;i<Yh[j].length-1;i++) { Yh[j][i]=Yh[j-1][i-1]+Yh[j-1][i]; } } for(int k=0;k<Yh.length;k++) { for(int x=0;x<Yh[k].length;x++) { System.out.print(" "+Yh[k][x]); } System.out.println(" "); } } } }

Exception in thread "Thread-12" java.lang.RuntimeException: java.lang.NullPointerException

第一次着手项目,springboot+mybatis,项目搭建是跟着教程做的。项目搭建好之后项目能正常运行,但是启动后报: Exception in thread "Thread-12" java.lang.RuntimeException: java.lang.NullPointerException at com.mysql.jdbc.JDBC4Connection$1$1.run(JDBC4Connection.java:106) Caused by: java.lang.NullPointerException at com.mysql.jdbc.ConnectionImpl.abortInternal(ConnectionImpl.java:1240) at com.mysql.jdbc.JDBC4Connection$1$1.run(JDBC4Connection.java:104) 启动Console: 2019-08-05 10:29:12.921 INFO 7416 --- [ restartedMain] com.xintujiuzhang.aimanagement.App : Starting App on DESKTOP-J57CTN6 with PID 7416 (D:\JAVA\eclipse\TaxHandwritingRecognition\target\classes started by Administrator in D:\JAVA\eclipse\TaxHandwritingRecognition) 2019-08-05 10:29:12.921 INFO 7416 --- [ restartedMain] com.xintujiuzhang.aimanagement.App : No active profile set, falling back to default profiles: default 2019-08-05 10:29:12.958 INFO 7416 --- [ restartedMain] ConfigServletWebServerApplicationContext : Refreshing org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@6070b0bb: startup date [Mon Aug 05 10:29:12 CST 2019]; root of context hierarchy 2019-08-05 10:29:13.450 INFO 7416 --- [ restartedMain] o.s.b.f.xml.XmlBeanDefinitionReader : Loading XML bean definitions from class path resource [mybatis-config.xml] 2019-08-05 10:29:13.503 INFO 7416 --- [ restartedMain] o.s.b.f.s.DefaultListableBeanFactory : Overriding bean definition for bean 'sqlSessionFactory' with a different definition: replacing [Root bean: class [null]; scope=; abstract=false; lazyInit=false; autowireMode=3; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=app; factoryMethodName=sqlSessionFactoryBean; initMethodName=null; destroyMethodName=(inferred); defined in com.xintujiuzhang.aimanagement.App] with [Generic bean: class [org.mybatis.spring.SqlSessionFactoryBean]; scope=; abstract=false; lazyInit=false; autowireMode=0; dependencyCheck=0; autowireCandidate=true; primary=false; factoryBeanName=null; factoryMethodName=null; initMethodName=null; destroyMethodName=null; defined in class path resource [mybatis-config.xml]] 2019-08-05 10:29:13.599 WARN 7416 --- [ restartedMain] o.m.s.mapper.ClassPathMapperScanner : No MyBatis mapper was found in '[com.xintujiuzhang.aimanagement]' package. Please check your configuration. 2019-08-05 10:29:13.958 INFO 7416 --- [ restartedMain] trationDelegate$BeanPostProcessorChecker : Bean 'org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration' of type [org.springframework.transaction.annotation.ProxyTransactionManagementConfiguration$$EnhancerBySpringCGLIB$$b535b905] is not eligible for getting processed by all BeanPostProcessors (for example: not eligible for auto-proxying) 2019-08-05 10:29:14.332 INFO 7416 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat initialized with port(s): 8080 (http) 2019-08-05 10:29:14.348 INFO 7416 --- [ restartedMain] o.apache.catalina.core.StandardService : Starting service [Tomcat] 2019-08-05 10:29:14.349 INFO 7416 --- [ restartedMain] org.apache.catalina.core.StandardEngine : Starting Servlet Engine: Apache Tomcat/8.5.28 2019-08-05 10:29:14.355 INFO 7416 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener : Loaded APR based Apache Tomcat Native library [1.2.21] using APR version [1.6.5]. 2019-08-05 10:29:14.355 INFO 7416 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener : APR capabilities: IPv6 [true], sendfile [true], accept filters [false], random [true]. 2019-08-05 10:29:14.355 INFO 7416 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener : APR/OpenSSL configuration: useAprConnector [false], useOpenSSL [true] 2019-08-05 10:29:14.357 INFO 7416 --- [ost-startStop-1] o.a.catalina.core.AprLifecycleListener : OpenSSL successfully initialized [OpenSSL 1.1.1a 20 Nov 2018] 2019-08-05 10:29:14.418 INFO 7416 --- [ost-startStop-1] o.a.c.c.C.[Tomcat].[localhost].[/] : Initializing Spring embedded WebApplicationContext 2019-08-05 10:29:14.418 INFO 7416 --- [ost-startStop-1] o.s.web.context.ContextLoader : Root WebApplicationContext: initialization completed in 1462 ms 2019-08-05 10:29:14.514 INFO 7416 --- [ost-startStop-1] o.s.b.w.servlet.ServletRegistrationBean : Servlet dispatcherServlet mapped to [/] 2019-08-05 10:29:14.517 INFO 7416 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'characterEncodingFilter' to: [/*] 2019-08-05 10:29:14.517 INFO 7416 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'hiddenHttpMethodFilter' to: [/*] 2019-08-05 10:29:14.517 INFO 7416 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'httpPutFormContentFilter' to: [/*] 2019-08-05 10:29:14.517 INFO 7416 --- [ost-startStop-1] o.s.b.w.servlet.FilterRegistrationBean : Mapping filter: 'requestContextFilter' to: [/*] 2019-08-05 10:29:14.631 INFO 7416 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Starting... 2019-08-05 10:29:19.625 INFO 7416 --- [ restartedMain] com.zaxxer.hikari.pool.PoolBase : HikariPool-1 - Driver does not support get/set network timeout for connections. (com.mysql.jdbc.JDBC4Connection.getNetworkTimeout()I) 2019-08-05 10:29:19.629 INFO 7416 --- [ restartedMain] com.zaxxer.hikari.HikariDataSource : HikariPool-1 - Start completed. 2019-08-05 10:29:19.670 INFO 7416 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Building JPA container EntityManagerFactory for persistence unit 'default' 2019-08-05 10:29:19.684 INFO 7416 --- [ restartedMain] o.hibernate.jpa.internal.util.LogHelper : HHH000204: Processing PersistenceUnitInfo [ name: default ...] 2019-08-05 10:29:19.738 INFO 7416 --- [ restartedMain] org.hibernate.Version : HHH000412: Hibernate Core {5.2.10.Final} 2019-08-05 10:29:19.739 INFO 7416 --- [ restartedMain] org.hibernate.cfg.Environment : HHH000206: hibernate.properties not found 2019-08-05 10:29:19.770 INFO 7416 --- [ restartedMain] o.hibernate.annotations.common.Version : HCANN000001: Hibernate Commons Annotations {5.0.1.Final} 2019-08-05 10:29:19.874 INFO 7416 --- [ restartedMain] org.hibernate.dialect.Dialect : HHH000400: Using dialect: org.hibernate.dialect.MySQL5Dialect 2019-08-05 10:29:19.897 INFO 7416 --- [ restartedMain] o.h.e.j.e.i.LobCreatorBuilderImpl : HHH000423: Disabling contextual LOB creation as JDBC driver reported JDBC version [3] less than 4 2019-08-05 10:29:20.037 INFO 7416 --- [ restartedMain] j.LocalContainerEntityManagerFactoryBean : Initialized JPA EntityManagerFactory for persistence unit 'default' 10:29:20,543 INFO App:32-org.springframework.orm.jpa.JpaTransactionManager 2019-08-05 10:29:20.796 INFO 7416 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerAdapter : Looking for @ControllerAdvice: org.springframework.boot.web.servlet.context.AnnotationConfigServletWebServerApplicationContext@6070b0bb: startup date [Mon Aug 05 10:29:12 CST 2019]; root of context hierarchy 2019-08-05 10:29:20.824 WARN 7416 --- [ restartedMain] aWebConfiguration$JpaWebMvcConfiguration : spring.jpa.open-in-view is enabled by default. Therefore, database queries may be performed during view rendering. Explicitly configure spring.jpa.open-in-view to disable this warning 2019-08-05 10:29:20.846 INFO 7416 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/application/handwriting_authorization],methods=[GET]}" onto public java.lang.String com.xintujiuzhang.aimanagement.controller.ApplicationAuthorizationController.joinHWA(java.util.Map<java.lang.String, java.lang.Object>) 2019-08-05 10:29:20.847 INFO 7416 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/application/handwriting_information],methods=[GET]}" onto public java.lang.String com.xintujiuzhang.aimanagement.controller.ApplicationInformationController.joinHWI(java.util.Map<java.lang.String, java.lang.Object>) 2019-08-05 10:29:20.847 INFO 7416 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/log/background_management_login],methods=[GET]}" onto public java.lang.String com.xintujiuzhang.aimanagement.controller.BackgroundManagementLoginController.joinHWI(java.util.Map<java.lang.String, java.lang.Object>) 2019-08-05 10:29:20.847 INFO 7416 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/log/computer_login],methods=[GET]}" onto public java.lang.String com.xintujiuzhang.aimanagement.controller.ComputerLoginController.jumpDEM(java.util.Map<java.lang.String, java.lang.Object>) 2019-08-05 10:29:20.847 INFO 7416 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/authority/department_management],methods=[GET]}" onto public java.lang.String com.xintujiuzhang.aimanagement.controller.DepartmentManagementController.jumpDEM(java.util.Map<java.lang.String, java.lang.Object>) 2019-08-05 10:29:20.848 INFO 7416 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/authority/dictionary_management],methods=[GET]}" onto public java.lang.String com.xintujiuzhang.aimanagement.controller.DictionaryManagementController.jumpDM(java.util.Map<java.lang.String, java.lang.Object>) 2019-08-05 10:29:20.848 INFO 7416 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/equipment/hardware_devices],methods=[GET]}" onto public java.lang.String com.xintujiuzhang.aimanagement.controller.EquipmentManagementController.jumpDM(java.util.Map<java.lang.String, java.lang.Object>) 2019-08-05 10:29:20.848 INFO 7416 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/queryGetServerStatusInterface],methods=[GET]}" onto public java.util.Map<java.lang.String, java.lang.Object> com.xintujiuzhang.aimanagement.controller.GetServerStatusInterfaceController.queryGetServerStatus(java.lang.String,java.lang.String) 2019-08-05 10:29:20.848 INFO 7416 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/queryHandwritingInterface],methods=[GET]}" onto public java.util.Map<java.lang.String, java.lang.Object> com.xintujiuzhang.aimanagement.controller.HandwritingInterfaceController.queryHandwriting(java.lang.String,java.lang.String,java.lang.Integer,java.util.Date) 2019-08-05 10:29:20.849 INFO 7416 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/identity/identity_management],methods=[GET]}" onto public java.lang.String com.xintujiuzhang.aimanagement.controller.IdentityManagementController.jumpDM(java.util.Map<java.lang.String, java.lang.Object>) 2019-08-05 10:29:20.849 INFO 7416 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/queryInstallationRequest],methods=[GET]}" onto public java.util.Map<java.lang.String, java.lang.Object> com.xintujiuzhang.aimanagement.controller.InstallationRequestInterfaceController.queryInstallationRequest(java.lang.String,java.lang.String,java.lang.String) 2019-08-05 10:29:20.849 INFO 7416 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/queryLicenseInterface],methods=[GET]}" onto public java.util.Map<java.lang.String, java.lang.Object> com.xintujiuzhang.aimanagement.controller.LicenseInterfaceController.queryLicense(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.util.Date) 2019-08-05 10:29:20.851 INFO 7416 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/]}" onto public java.lang.String com.xintujiuzhang.aimanagement.controller.MainController.main(java.util.Map<java.lang.String, java.lang.Object>) 2019-08-05 10:29:20.851 INFO 7416 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/login],methods=[GET]}" onto public org.springframework.web.servlet.ModelAndView com.xintujiuzhang.aimanagement.controller.MainController.login() 2019-08-05 10:29:20.851 INFO 7416 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/login],methods=[POST]}" onto public java.lang.String com.xintujiuzhang.aimanagement.controller.MainController.login(java.lang.String,java.lang.String,java.util.Map<java.lang.String, java.lang.Object>) 2019-08-05 10:29:20.851 INFO 7416 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/main],methods=[GET]}" onto public java.lang.String com.xintujiuzhang.aimanagement.controller.MainController.jumpmain(java.util.Map<java.lang.String, java.lang.Object>) 2019-08-05 10:29:20.852 INFO 7416 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/authority/menu_management],methods=[GET]}" onto public java.lang.String com.xintujiuzhang.aimanagement.controller.MenuManagementController.jumpMM(java.util.Map<java.lang.String, java.lang.Object>) 2019-08-05 10:29:20.852 INFO 7416 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/log/module_browsing],methods=[GET]}" onto public java.lang.String com.xintujiuzhang.aimanagement.controller.ModuleBrowsingController.jumpTM(java.util.Map<java.lang.String, java.lang.Object>) 2019-08-05 10:29:20.852 INFO 7416 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/log/module_operation],methods=[GET]}" onto public java.lang.String com.xintujiuzhang.aimanagement.controller.ModuleOperationController.jumpMM(java.util.Map<java.lang.String, java.lang.Object>) 2019-08-05 10:29:20.852 INFO 7416 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/deletehandwriting],methods=[POST]}" onto public void com.xintujiuzhang.aimanagement.controller.NotesController.deletehandwriting(java.lang.String) 2019-08-05 10:29:20.852 INFO 7416 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/updatehandwriting],methods=[POST]}" onto public void com.xintujiuzhang.aimanagement.controller.NotesController.updatehandwriting(com.xintujiuzhang.aimanagement.pojo.Handwriting) 2019-08-05 10:29:20.852 INFO 7416 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/addhandwriting],methods=[POST]}" onto public void com.xintujiuzhang.aimanagement.controller.NotesController.addhandwriting(com.xintujiuzhang.aimanagement.pojo.Handwriting) 2019-08-05 10:29:20.853 INFO 7416 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/querynotes],methods=[GET]}" onto public com.xintujiuzhang.aimanagement.pojo.Handwriting com.xintujiuzhang.aimanagement.controller.NotesController.querynotes(java.lang.String) 2019-08-05 10:29:20.853 INFO 7416 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/authority/parameter_settings],methods=[GET]}" onto public java.lang.String com.xintujiuzhang.aimanagement.controller.parameterSettingsController.jumpPS(java.util.Map<java.lang.String, java.lang.Object>) 2019-08-05 10:29:20.853 INFO 7416 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/authority/role_authorization],methods=[GET]}" onto public java.lang.String com.xintujiuzhang.aimanagement.controller.RoleAuthorizationController.jumpRA(java.util.Map<java.lang.String, java.lang.Object>) 2019-08-05 10:29:20.853 INFO 7416 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/log/service_call],methods=[GET]}" onto public java.lang.String com.xintujiuzhang.aimanagement.controller.ServiceCallController.jumpRA(java.util.Map<java.lang.String, java.lang.Object>) 2019-08-05 10:29:20.853 INFO 7416 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/authority/task_management],methods=[GET]}" onto public java.lang.String com.xintujiuzhang.aimanagement.controller.TaskManagementController.jumpTM(java.util.Map<java.lang.String, java.lang.Object>) 2019-08-05 10:29:20.854 INFO 7416 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/authority/user_management]}" onto public java.lang.String com.xintujiuzhang.aimanagement.controller.UserController.jnmpUM(java.util.Map<java.lang.String, java.lang.Object>) 2019-08-05 10:29:20.854 INFO 7416 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/queryUserInterface],methods=[GET]}" onto public java.util.Map<java.lang.String, java.lang.Object> com.xintujiuzhang.aimanagement.controller.UserInterfaceController.queryLicense(java.lang.String,java.lang.String,java.lang.Integer,java.util.Date) 2019-08-05 10:29:20.854 INFO 7416 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/queryVersionCheckingInterface],methods=[GET]}" onto public java.util.Map<java.lang.String, java.lang.Object> com.xintujiuzhang.aimanagement.controller.VersionCheckingInterfaceController.queryVersionChecking(java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.String,java.lang.Integer,java.util.Date) 2019-08-05 10:29:20.854 INFO 7416 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/queryVersionupdateInterface],methods=[GET]}" onto public java.util.Map<java.lang.String, java.lang.Object> com.xintujiuzhang.aimanagement.controller.VersionUpdateInterfaceController.queryVersionupdate(java.lang.String,java.lang.String,java.lang.String,java.util.Date) 2019-08-05 10:29:20.857 INFO 7416 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error]}" onto public org.springframework.http.ResponseEntity<java.util.Map<java.lang.String, java.lang.Object>> org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.error(javax.servlet.http.HttpServletRequest) 2019-08-05 10:29:20.857 INFO 7416 --- [ restartedMain] s.w.s.m.m.a.RequestMappingHandlerMapping : Mapped "{[/error],produces=[text/html]}" onto public org.springframework.web.servlet.ModelAndView org.springframework.boot.autoconfigure.web.servlet.error.BasicErrorController.errorHtml(javax.servlet.http.HttpServletRequest,javax.servlet.http.HttpServletResponse) 2019-08-05 10:29:20.881 INFO 7416 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/webjars/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2019-08-05 10:29:20.881 INFO 7416 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2019-08-05 10:29:20.906 INFO 7416 --- [ restartedMain] o.s.w.s.handler.SimpleUrlHandlerMapping : Mapped URL path [/**/favicon.ico] onto handler of type [class org.springframework.web.servlet.resource.ResourceHttpRequestHandler] 2019-08-05 10:29:21.115 INFO 7416 --- [ restartedMain] o.s.b.d.a.OptionalLiveReloadServer : LiveReload server is running on port 35729 2019-08-05 10:29:21.164 INFO 7416 --- [ restartedMain] o.s.j.e.a.AnnotationMBeanExporter : Registering beans for JMX exposure on startup 2019-08-05 10:29:21.165 INFO 7416 --- [ restartedMain] o.s.j.e.a.AnnotationMBeanExporter : Bean with name 'dataSource' has been autodetected for JMX exposure 2019-08-05 10:29:21.170 INFO 7416 --- [ restartedMain] o.s.j.e.a.AnnotationMBeanExporter : Located MBean 'dataSource': registering with JMX server as MBean [com.zaxxer.hikari:name=dataSource,type=HikariDataSource] 2019-08-05 10:29:21.196 INFO 7416 --- [ restartedMain] o.s.b.w.embedded.tomcat.TomcatWebServer : Tomcat started on port(s): 8080 (http) with context path '' 2019-08-05 10:29:21.198 INFO 7416 --- [ restartedMain] com.xintujiuzhang.aimanagement.App : Started App in 8.458 seconds (JVM running for 8.828) Exception in thread "Thread-12" java.lang.RuntimeException: java.lang.NullPointerException at com.mysql.jdbc.JDBC4Connection$1$1.run(JDBC4Connection.java:106) Caused by: java.lang.NullPointerException at com.mysql.jdbc.ConnectionImpl.abortInternal(ConnectionImpl.java:1240) at com.mysql.jdbc.JDBC4Connection$1$1.run(JDBC4Connection.java:104) **在执行一些方法后“Thread-12”会不断增加** **ps:“Thread-668"**

Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException

我的代码如下: JTabbedDemo.java import javax.swing.*; import java.awt.*; public class JTabbedDemo { public static void main(String[] args) throws Exception { //显示外观风格 UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName()); JFrame jframe=new JFrame("奖金状况"); jframe.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); jframe.setVisible(true); JTabbedPane tp=new JTabbedPane();//创建一个选项卡容器,将之添加到顶层容器内 jframe.setContentPane(tp); JPanel panel1=new JPanel(); JPanel panel2=new JPanel(); JPanel panel3=new JPanel(); JPanel panel4=new JPanel(); JPanel panel5=new JPanel(); //添加选项卡容器,并且设置其中每个选项卡的标签以及其是否可启用。 tp.addTab("panel1",panel1); tp.setEnabledAt(0,true); tp.setTitleAt(0,"个人收入状况"); tp.addTab("panel2",panel2); tp.setEnabledAt(1,true); tp.setTitleAt(1,"工资"); tp.addTab("panel2",panel3); tp.setEnabledAt(2,true); tp.setTitleAt(2,"奖金"); tp.addTab("panel3",panel4); tp.setEnabledAt(3,true); tp.setTitleAt(3,"津贴"); tp.addTab("panel4",panel5); tp.setEnabledAt(4,true); tp.setTitleAt(4,"社保"); //设置其大小以及其选项卡的位置方向 tp.setPreferredSize(new Dimension(800,600)); tp.setTabPlacement(JTabbedPane.TOP); //设置选项卡在容器内的显示形式 tp.setTabLayoutPolicy(JTabbedPane.SCROLL_TAB_LAYOUT); jframe.pack(); //创建8个标签组件,将5个中间窗口设置为流布局,并且将标签组件分别放入到其中 JLabel l1=new JLabel("工资状况"); JLabel l2=new JLabel("3000元/月"); JLabel l3=new JLabel("奖金状况"); JLabel l4=new JLabel("1500元/月"); JLabel l5=new JLabel("津贴状况"); JLabel l6=new JLabel("500元/月"); JLabel l7=new JLabel("社保状况"); JLabel l8=new JLabel("200元/月"); panel2.setLayout(new FlowLayout()); panel3.setLayout(new FlowLayout()); panel4.setLayout(new FlowLayout()); panel5.setLayout(new FlowLayout()); panel2.add(l1); panel2.add(l2); panel3.add(l3); panel3.add(l4); panel4.add(l5); panel4.add(l6); panel5.add(l7); panel5.add(l8); jframe.pack(); } } 错误信息如下: Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at javax.swing.plaf.basic.BasicTabbedPaneUI.calculateTabWidth(Unknown So urce) at javax.swing.plaf.basic.BasicTabbedPaneUI$TabbedPaneLayout.calculateTa bRects(Unknown Source) at javax.swing.plaf.basic.BasicTabbedPaneUI$TabbedPaneLayout.calculateLa youtInfo(Unknown Source) at javax.swing.plaf.basic.BasicTabbedPaneUI$TabbedPaneLayout.layoutConta iner(Unknown Source) at java.awt.Container.layout(Unknown Source) at java.awt.Container.doLayout(Unknown Source) at java.awt.Container.validateTree(Unknown Source) at java.awt.Container.validateTree(Unknown Source) at java.awt.Container.validateTree(Unknown Source) at java.awt.Container.validate(Unknown Source) at javax.swing.RepaintManager.validateInvalidComponents(Unknown Source) at javax.swing.RepaintManager$ProcessingRunnable.run(Unknown Source) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$000(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Sour ce) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source)

Exception in thread "main"

Exception in thread "main" java.lang.NullPointerException 老是出现这个错误,是为什么呢

Exception in thread "Timer-0" java.lang.IllegalStateException: No thread-bound request found

@RequestMapping("/sendVericationCode.action") @ResponseBody public AjaxJson sendVericationCode(){ String mobile = (String)session.getAttribute("mobile"); AjaxJson ajaxJson = JuheDemo.getRequest2(mobile); if(ajaxJson.isSuccess()==true) { session.setAttribute("vericationcode",ajaxJson.getMsg()); request.setAttribute("mobile",mobile); //timer定时任务加一个定时器,2分钟后删除session try {final Timer timer = new Timer(); timer.schedule(new TimerTask() { @Override public void run() { // TODO Auto-generated method stub session.removeAttribute("vericationcode"); timer.cancel(); System.out.println("显示"+session.getAttribute("vericationcode")); } }, 2*60*1000); } catch (Exception e) { // TODO: handle exception e.printStackTrace(); } } ajaxJson.setMsg("错误啦!!!!"); return ajaxJson; }**** ``` ``` 报错:Exception in thread "Timer-0" java.lang.IllegalStateException: No thread-bound request found: Are you referring to request attributes outside of an actual web request, or processing a request outside of the originally receiving thread? If you are actually operating within a web request and still receive this message, your code is probably running outside of DispatcherServlet/DispatcherPortlet: In this case, use RequestContextListener or RequestContextFilter to expose the current request

运行结果说是Exception in thread "main" java.NoClassDeFoundError:Example

import java.awt.event.ActionEvent; import java.awt.event.ActionListener; import java.awt.event.MouseEvent; import java.awt.event.MouseListener; import javax.swing.*; import java.awt.*; public class Example2 extends JFrame implements MouseListener,ActionListener { private ExamplePanel2[] panel=new ExamplePanel2[100]; private JButton jbStart=new JButton ("开始游戏"); private JButton jbBlack=new JButton ("黑方"); private JButton jbWhite=new JButton ("白方"); private int colorFlag=0; Example2() { Container c=this.getContentPane(); c.setLayout(new BorderLayout()); JPanel pc=new JPanel(); JPanel ps=new JPanel(); c.add(pc,BorderLayout.CENTER); c.add(ps,BorderLayout.SOUTH); pc.setLayout(new GridLayout(10,10)); for(int i=0;i<panel.length;i++) { panel[i]=new ExamplePanel2(); panel[i].setNumber(i+1); panel[i].addMouseListener(this); pc.add(panel[i]); } ps.setLayout(new FlowLayout(FlowLayout.CENTER)); ps.add(jbStart); ps.add(jbBlack); ps.add(jbWhite); jbStart.addActionListener(this); jbBlack.addActionListener(this); jbWhite.addActionListener(this); this.setTitle("五子棋游戏"); this.setSize(500,500); this.setVisible(true); this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); } public void mouseClicked(MouseEvent arg0) { } public void mouseEntered(MouseEvent arg0) { } public void mouseExited(MouseEvent arg0) { } public void mousePressed(MouseEvent arg0) { for(int i=0;i<panel.length;i++) { if(arg0.getSource()==panel[i]) { if(colorFlag==0) { panel[i].setColor(0); panel[i].repaint(); } else { panel[i].setColor(1); panel[i].repaint(); } } } } public void mouseReleased(MouseEvent arg0) { } public void actionPerformed(ActionEvent arg0) { if(arg0.getSource()==jbBlack) {colorFlag=0;} else if(arg0.getSource()==jbWhite) {colorFlag=1;} else if(arg0.getSource()==jbStart) { for(int i=0;i<panel.length;i++) panel[i].setStartFlag(1); } } public static void main(String args[]) { Example2 ex=new Example2(); } } import javax.swing.*; import javax.swing.border.LineBorder; import java.awt.*; public class ExamplePanel2 extends JPanel { private int color=0; private int number=0; private int startFlag=0; private int lock=0; ExamplePanel2 () { this.setBorder(new LineBorder(Color.black,1)); this.setBackground(new Color(255,205,255)); } public void paintComponent(Graphics g) { super.paintComponent(g); if(startFlag==1) { if(lock==0) { if(color==0) g.setColor(Color.black); else g.setColor(Color.white); g.fillOval(10,10,30,30); lock=1; } } } public int getColor() { return color; } public void setColor(int color) { this.color=color; } public int getNumber() { return number; } public void setNumber(int number) { this.number=number; } public int getStartFlag() { return startFlag; } public void setStartFlag(int startFlag) { this.startFlag=startFlag; } }

java运行出现Exception in thread "AWT-EventQueue-0"

用eclipse运行如下程序,没有错误可以正常运行,这是一个两张照片融合的程序,但是运行后无法得到结果,出现错误“Exception in thread "AWT-EventQueue-0" java.lang.ArrayIndexOutOfBoundsException: -1”如图 ![图片说明](https://img-ask.csdn.net/upload/201606/02/1464873949_766152.png)

Exception in thread "AWT-EventQueue-0"

``` import javax.swing.*; import java.awt.event.*; import java.awt.*; import java.io.File; import java.io.IOException; public class PipeFilterTestGui extends JPanel { private JScrollPane btnPane; private JSplitPane splitPane; private JSplitPane rightSplitPane; private JTextArea originalTxt; private JTextArea resultTxt; private JScrollPane originPane; private JScrollPane resultPane; private JLabel filelbl; private JPanel buttonPanel; private JComboBox cmbFileList; static final String PROCESS = "Process"; static final String EXIT = "Exit"; static final String ORIGINALFILES = "OriginalFiles/"; static final Dimension minimumSize = new Dimension(230, 200); public PipeFilterTestGui() { super(new GridLayout(1, 0)); resultTxt = new JTextArea("Encrypted File Text\n\n", 6, 20); originalTxt = new JTextArea("Original File Text: \n\n", 6, 20); buildUpScrollGUI(); } private void buildUpScrollGUI() { // Setup buttonPanel, which contains all buttons and // will be used in btnPane below setUpButtonPanel(); btnPane = new JScrollPane(buttonPanel); btnPane.setMinimumSize(minimumSize); resultPane = new JScrollPane(resultTxt); originPane = new JScrollPane(originalTxt); rightSplitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); rightSplitPane.setLeftComponent(originPane); rightSplitPane.setRightComponent(resultPane); rightSplitPane.setDividerLocation(190); splitPane = new JSplitPane(JSplitPane.HORIZONTAL_SPLIT); splitPane.setLeftComponent(btnPane); splitPane.setRightComponent(rightSplitPane); splitPane.setDividerLocation(220); splitPane.setPreferredSize(new Dimension(600, 250)); add(splitPane); setSize(new Dimension(600, 400)); setVisible(true); } private void setUpButtonPanel() { cmbFileList = new JComboBox(); String[] cl = extractFileList(); setupFileList(cmbFileList, cl); filelbl = new JLabel("Files:"); // Create buttons JButton srchButton = new JButton(PROCESS); srchButton.setMnemonic(KeyEvent.VK_S); JButton exitButton = new JButton(EXIT); exitButton.setMnemonic(KeyEvent.VK_X); ButtonListener btnListener = new ButtonListener(); // add action Listener srchButton.addActionListener(btnListener); exitButton.addActionListener(btnListener); buttonPanel = new JPanel(); GridBagLayout gridbag = new GridBagLayout(); buttonPanel.setLayout(gridbag); GridBagConstraints gbc = new GridBagConstraints(); buttonPanel.add(filelbl); buttonPanel.add(cmbFileList); buttonPanel.add(srchButton); buttonPanel.add(exitButton); gbc.insets.top = 5; gbc.insets.bottom = 5; gbc.insets.left = 5; gbc.insets.right = 5; gbc.anchor = GridBagConstraints.EAST; gbc.gridx = 0; gbc.gridy = 0; gridbag.setConstraints(filelbl, gbc); gbc.anchor = GridBagConstraints.WEST; gbc.gridx = 1; gbc.gridy = 0; gridbag.setConstraints(cmbFileList, gbc); gbc.anchor = GridBagConstraints.EAST; gbc.gridx = 0; gbc.gridy = 1; gbc.insets.left = 2; gbc.insets.right = 2; gbc.insets.top = 25; gbc.anchor = GridBagConstraints.EAST; gbc.gridx = 0; gbc.gridy = 3; gridbag.setConstraints(srchButton, gbc); gbc.anchor = GridBagConstraints.WEST; gbc.gridx = 1; gbc.gridy = 3; gridbag.setConstraints(exitButton, gbc); } /* ========================================= */ /* Get a selected file name from User GUI */ /* ========================================= */ public String getSelectedFile() { return (String) cmbFileList.getSelectedItem(); } /* ================================================ */ /* Extract file names from a diectory on your */ /* computer */ /* ================================================ */ public String[] extractFileList() { File f = new File(ORIGINALFILES); String[] fileNames = f.list(); return fileNames; } /* ============================================== */ /* Add car list to combox cmbFileList. Both */ /* objects cmbFileList and files are passed */ /* in from parameters. */ /* ============================================== */ public void setupFileList(JComboBox cmbFileList, String[] files) { for (int k = 0; k < files.length; k++) { cmbFileList.addItem(files[k]); } } class ButtonListener implements ActionListener { String carPrice; public void actionPerformed(ActionEvent e) { String searchResult = null; if (e.getActionCommand().equals(EXIT)) { System.exit(1); } if (e.getActionCommand().equals(PROCESS)) { String selectedFile = getSelectedFile(); try { originalTxt.append("File Name: " + selectedFile + "\n\n"); resultTxt.append("From file: " + selectedFile + "\n"); AssemblyOfPipeLines apline = new AssemblyOfPipeLines(); apline.assembly(selectedFile, originalTxt, resultTxt); } catch (IOException ex) { } } } } // End of class ButtonListener private static void createAndShowGUI() { JFrame.setDefaultLookAndFeelDecorated(true); JFrame frame = new JFrame("Pipes and Filters Architecture demo- Legacy File Update"); frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); PipeFilterTestGui newContentPane = new PipeFilterTestGui(); newContentPane.setOpaque(true); frame.setContentPane(newContentPane); frame.pack(); frame.setVisible(true); } static public void main(String argv[]) { javax.swing.SwingUtilities.invokeLater(new Runnable() { public void run() { createAndShowGUI(); } }); } } ``` Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at PipeFilterTestGui.setupFileList(PipeFilterTestGui.java:150) at PipeFilterTestGui.setUpButtonPanel(PipeFilterTestGui.java:67) at PipeFilterTestGui.buildUpScrollGUI(PipeFilterTestGui.java:37) at PipeFilterTestGui.<init>(PipeFilterTestGui.java:30) at PipeFilterTestGui.createAndShowGUI(PipeFilterTestGui.java:191) at PipeFilterTestGui.access$2(PipeFilterTestGui.java:185) at PipeFilterTestGui$1.run(PipeFilterTestGui.java:205) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$500(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) 还有其他几个类。 需要上传吗?

springboot项目在Tomcat中抛异常:Exception in thread "AWT-EventQueue-0" java.lang.ClassCastException: sun.java2d.HeadlessGraphicsEnvironment cannot be cast to sun.awt.Win32GraphicsEnvironment

![图片说明](https://img-ask.csdn.net/upload/201910/09/1570586773_810233.png) 在tomcat中运行抛出这个异常,不知道怎么解决掉,请各位大佬帮我看下,谢谢

新手在线等~Exception in thread ~

package banking; public class Account { protected double balance; public Account(double balance) { super(); this.balance = balance; } public double getBalance() { return balance; } public void setBalance(double balance) { this.balance = balance; } public boolean deposit(double amt) { balance+=amt; return true; } public boolean withdraw(double amt) { if(amt<=balance) { balance -= amt; }else { return false; } return true; } } package banking; public class SavingAccount extends Account { private double interestRate; public SavingAccount(double balance, double interestRate) { super(balance); this.interestRate = interestRate; } public double getInterestRate() { return interestRate; } } package banking; public class CheckingAccount extends Account { private double overdraftProtection; public CheckingAccount(double balance) { super(balance); } public CheckingAccount(double balance, double overdraftProtection) { super(balance); this.overdraftProtection = overdraftProtection; } public boolean withdraw(double amt) { if(amt<=balance) { balance -= amt; return true; }else { if(overdraftProtection>= amt - balance) { overdraftProtection -= amt - balance; balance = 0; }else { return false; } } return true; } } package banking; public class Customer { private String lastName; public String getLastName() { return lastName; } public String getFirstName() { return firstName; } private String firstName; Account[] accounts; int numberOfAccounts; public Customer(String L,String F) { lastName = L; firstName =F; } public Customer() { accounts = new Account[2]; } public void addAccount(Account account) { accounts[numberOfAccounts++]=account; } public Account getAccounts(int index) { return accounts [index]; } public int getNumberOfAccounts() { return numberOfAccounts; } } package banking; public class Bank { private Customer[] customers; private int numberOfCustomers; public Bank() { customers = new Customer[5]; } public Customer getCustomers(int index) { return customers[index]; } public int getNumberOfCustomers() { return numberOfCustomers; } public void addCustomer(String L,String F) { Customer customer = new Customer(L,F); customers[numberOfCustomers]=customer; numberOfCustomers++; } } package banking; public class TestBanking { public static void main(String[] args) { Bank bank = new Bank(); Customer customer; bank.addCustomer("Jane", "Smith"); customer = bank.getCustomers(0); customer.addAccount(new SavingAccount(500,0.05)); customer.addAccount(new CheckingAccount(200,400)); bank.addCustomer("oven", "Bryant"); customer = bank.getCustomers(1); customer.addAccount(new CheckingAccount(200)); bank.addCustomer("Tim", "Soley"); customer=bank.getCustomers(2); customer.addAccount(new SavingAccount(1500,0.05)); customer.addAccount(new CheckingAccount(200)); bank.addCustomer("Maria", "Soley"); customer = bank.getCustomers(3); customer.addAccount(bank.getCustomers(2).getAccounts(1)); customer.addAccount(new SavingAccount(150,0.05)); for(int i = 0;i<bank.getNumberOfCustomers();i++) { customer = bank.getCustomers(i); System.out.println(); System.out.println("Customer "+customer.getLastName()+customer.getFirstName()); } } } 错误是Exception in thread "main" java.lang.NullPointerException at banking.Customer.addAccount(Customer.java:28) at banking.TestBanking.main(TestBanking.java:13) 不明白哪里错了,刚刚自学JAVA的小萌新,希望能够详细解答,并给出修改方案~

启动tomcat时报exception in thread awt-shutdown异常

``` 2017-08-24 17:21:14,377 INFO [localhost-startStop-1] com.mossle.user.support.UserRepoPopulator:28 - skip userRepo populator 2017-08-24 17:21:14,556 INFO [localhost-startStop-1] org.activiti.engine.impl.bpmn.deployer.BpmnDeployer:82 - Processing resource E:\eahsoft_201708\.metadata\.plugins\org.eclipse.wst.server.core\tmp0\wtpwebapps\dybzgk\WEB-INF\classes\bpmn2\permission.bpmn20.xml Exception in thread "AWT-Shutdown" 2017-08-24 17:21:20,028 INFO [localhost-startStop-1] com.mossle.core.hibernate.ReadOnlyTransactionManager:44 - transaction rollback at : org.springframework.transaction.support.DefaultTransactionStatus@2a04d99b Exception in thread "main" ``` 项目是从svn导过来的,同事的电脑可以正常启动,到我这就报这两个异常。 环境跟同事是一样的 jdk7 tomcat7

java小问题,百度了好久也没解决。。

错误代码:Exception in thread "AWT-EventQueue-0" java.lang.NullPointerException at z.TextEdit.actionPerformed(jishiben.java:110) at java.awt.MenuItem.processActionEvent(Unknown Source) at java.awt.MenuItem.processEvent(Unknown Source) at java.awt.MenuComponent.dispatchEventImpl(Unknown Source) at java.awt.MenuComponent.dispatchEvent(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$200(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.awt.EventQueue$4.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) 源代码 package z; import java.awt.*; import java.awt.event.*; import java.io.*; import javax.swing.*; import javax.swing.event.*; import javax.swing.filechooser.FileFilter; import static java.awt.event.InputEvent.*; import java.awt.datatransfer.*; import java.util.Enumeration; import java.util.Hashtable; class jishiben { public static void main(String args[]) { TextEdit main = new TextEdit("记事本"); } } class TextEdit extends Frame implements ActionListener { MenuBar m; Menu m1, m2; MenuItem xinjian, dakai, baocun, tuichu, jianqie, fuzhi, zhantie, chazhao; TextArea text;// 文本区 JTextField searchtext;// 搜索文字 JTextField changetext;// 替换文字 String filename; BufferedReader in;// 缓冲字符输入流 BufferedWriter out; FileReader read; FileWriter writer; Clipboard cb;// 创建剪贴板对象 TextEdit(String s) { super(s); m = new MenuBar(); m1 = new Menu("文件"); xinjian = new MenuItem("新建"); dakai = new MenuItem("打开"); baocun = new MenuItem("保存"); tuichu = new MenuItem("退出"); m2 = new Menu("编辑"); jianqie = new MenuItem("剪切"); fuzhi = new MenuItem("复制"); zhantie = new MenuItem("粘贴"); chazhao = new MenuItem("查找与替换"); text = new TextArea(); filename = "NoName"; m1.add(xinjian); m1.addSeparator(); m1.add(dakai); m1.addSeparator(); m1.add(baocun); m1.addSeparator(); m1.add(tuichu); m2.add(jianqie); m2.addSeparator(); m2.add(fuzhi); m2.addSeparator(); m2.add(zhantie); m2.addSeparator(); m2.add(chazhao); m.add(m1); m.add(m2); // 剪切 cb = new Clipboard("nothing"); setMenuBar(m); setSize(300, 400); setVisible(true); setLocation(400, 200); add(text, "Center"); xinjian.addActionListener(this); dakai.addActionListener(this); baocun.addActionListener(this); tuichu.addActionListener(this); jianqie.addActionListener(this); fuzhi.addActionListener(this); zhantie.addActionListener(this); chazhao.addActionListener(this); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { System.exit(0); } }); } public void actionPerformed(ActionEvent e) { if (e.getSource() == xinjian) { text.setText(" "); } if (e.getSource() == dakai) { // 文件选择组件使用 JFileChooser jfc1 = new JFileChooser(); // 设置名字 jfc1.setDialogTitle("请选择文件......"); // 默认方式 jfc1.showOpenDialog(null); // 显示 jfc1.setVisible(true); // 得到用户选择的文件路径 String filename = jfc1.getSelectedFile().getAbsolutePath(); FileReader fr = null; BufferedReader br = null; try { fr = new FileReader(filename); br = new BufferedReader(fr); // 从文件中读取的文件,显示到text上, String s = ""; String all = ""; while ((s = br.readLine()) != null) { all += s + "\r\n"; } // 放到text text.setText(all); } catch (Exception e2) { // TODO: handle exception e.paramString(); } finally { try { br.close(); fr.close(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } } if (e.getSource() == baocun) { // 出现保存对话框 JFileChooser jfc = new JFileChooser(); jfc.setDialogTitle("另存为..."); // 按照默认的方式显示 jfc.showSaveDialog(null); jfc.setVisible(true); String file = jfc.getSelectedFile().getAbsolutePath(); // 准备写入到指定的文件中 FileWriter fw = null; BufferedWriter bw = null; try { fw = new FileWriter(file); bw = new BufferedWriter(fw); bw.write(this.text.getText()); } catch (Exception e2) { e.paramString(); // TODO: handle exception } finally { try { bw.close(); fw.close(); } catch (IOException e1) { // TODO Auto-generated catch block e1.printStackTrace(); } } } if (e.getSource() == tuichu) { System.exit(0); } if (e.getSource() == jianqie) { String s = text.getSelectedText(); // 创建能传输指定 String 的 Transferable。 StringSelection select = new StringSelection(s); // 把selecct内容放到剪贴板中 cb.setContents(select, null); // 清零 text.replaceRange("", text.getSelectionStart(), text.getSelectionEnd()); } if (e.getSource() == fuzhi) { String s = text.getSelectedText(); StringSelection select = new StringSelection(s); cb.setContents(select, null); } if (e.getSource() == zhantie) { String s = ""; // 得到剪贴板的内容 Transferable t = cb.getContents(null); try { if (t != null// isDataFlavorSupported返回此对象是否支持指定的数据 flavor && t.isDataFlavorSupported(DataFlavor.stringFlavor)) { // 因为原系的剪贴板里有多种信息, 如文字, 图片, 文件等 // 先判断开始取得的可传输的数据是不是文字, 如果是, 取得这些文字 s = (String) t.getTransferData(DataFlavor.stringFlavor); // 同样, 因为Transferable中的DataFlavor是多种类型的, // 所以传入DataFlavor这个参数, 指定要取得哪种类型的Data. } } catch (UnsupportedFlavorException ex) { ex.printStackTrace(); } catch (IOException ex) { ex.printStackTrace(); } text.insert(s, text.getCaretPosition()); } if (e.getSource() == chazhao) { new chaz(text); } } } class chaz extends Dialog implements ActionListener { String wenben; TextArea ta; boolean flg = false; int len; int start = 0; int k = 0; Label find1 = new Label("查找的字符串"); Label replace1 = new Label("替代的字符串"); TextField find2 = new TextField(10); TextField replace2 = new TextField(10); Button find3 = new Button("查找"); Button replace3 = new Button("替换"); public chaz(TextArea ta) { super(new Frame(), "查找或替换"); this.ta = ta; Panel pan1 = new Panel(); Panel pan2 = new Panel(); pan1.add(find1); pan1.add(find2); pan1.add(find3); pan2.add(replace1); pan2.add(replace2); pan2.add(replace3); setResizable(false); setBounds(200, 200, 300, 100); add(pan1, BorderLayout.NORTH); add(pan2, BorderLayout.SOUTH); find3.addActionListener(this); replace3.addActionListener(this); addWindowListener(new WindowAdapter() { public void windowClosing(WindowEvent e) { chaz.this.dispose(); } }); setVisible(true); } public void actionPerformed(ActionEvent e) { // 查找替换事件处理方法 String ske = find2.getText();// 要查询的文字 wenben = ta.getText(); String tke = replace2.getText();// 要替换的文字 if (e.getSource() == find3) { find3.setLabel("完毕!"); if (ske != null) { len = ske.length(); start = wenben.indexOf(ske, k); k = start + len; ta.select(start, start + len); flg = true; if (start == -1) { JOptionPane.showMessageDialog(null, "已到文件尾部!", "提示", JOptionPane.INFORMATION_MESSAGE); start = 0; k = 0; flg = false; } } } else if (e.getSource() == replace3) { if (flg) { ta.replaceRange(tke, start, start + len); flg = false; } } } }

利用java开发ARCGIS 搭建好后创建了一个示例程序,运行后出错,求大神解答

java.lang.RuntimeException: Unable to find runtime installation. Searched following places: E:\MyProjects\Java\Test\MyFirstProject E:\Java\JavaTools\ArcObject_SDK_JAVA\ArcGIS_SDKS\java10.2.4\arcgisruntime10.2.4\client64 at com.esri.runtime.ArcGISRuntime.getInstallDirectory(Unknown Source) at com.esri.runtime.ArcGISRuntime.a(Unknown Source) at com.esri.runtime.ArcGISRuntime.getClientLibPath(Unknown Source) at com.esri.runtime.ArcGISRuntime.f(Unknown Source) at com.esri.runtime.ArcGISRuntime.initialize(Unknown Source) at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.esri.core.internal.util.f.b(Unknown Source) at com.esri.core.internal.util.f.a(Unknown Source) at com.esri.core.internal.util.f$2.initialize(Unknown Source) at com.esri.core.geometry.GeometryEngine.a(Unknown Source) at com.esri.core.geometry.GeometryEngine.<clinit>(Unknown Source) at com.esri.core.geometry.SpatialReference.<clinit>(Unknown Source) at com.esri.map.MapOptions.<clinit>(Unknown Source) at test.NewClass.<init>(NewClass.java:44) at test.NewClass$2.run(NewClass.java:68) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$500(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) java.lang.reflect.InvocationTargetException at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source) at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source) at java.lang.reflect.Method.invoke(Unknown Source) at com.esri.core.internal.util.f.b(Unknown Source) at com.esri.core.internal.util.f.a(Unknown Source) at com.esri.core.internal.util.f$2.initialize(Unknown Source) at com.esri.core.geometry.GeometryEngine.a(Unknown Source) at com.esri.core.geometry.SpatialReference.<clinit>(Unknown Source) at com.esri.map.MapOptions.<clinit>(Unknown Source) at test.NewClass.<init>(NewClass.java:44) at test.NewClass$2.run(NewClass.java:68) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$500(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) Caused by: java.lang.UnsatisfiedLinkError: Expecting an absolute path of the library: at java.lang.Runtime.load0(Unknown Source) at java.lang.System.load(Unknown Source) at com.esri.runtime.ArcGISRuntime.f(Unknown Source) at com.esri.runtime.ArcGISRuntime.initialize(Unknown Source) ... 26 more Exception in thread "AWT-EventQueue-0" java.lang.UnsatisfiedLinkError: Expecting an absolute path of the library: at java.lang.Runtime.load0(Unknown Source) at java.lang.System.load(Unknown Source) at com.esri.runtime.ArcGISRuntime.f(Unknown Source) at com.esri.runtime.ArcGISRuntime.initialize(Unknown Source) at com.esri.map.JMap.<clinit>(Unknown Source) at test.NewClass.<init>(NewClass.java:45) at test.NewClass$2.run(NewClass.java:68) at java.awt.event.InvocationEvent.dispatch(Unknown Source) at java.awt.EventQueue.dispatchEventImpl(Unknown Source) at java.awt.EventQueue.access$500(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.awt.EventQueue$3.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.security.ProtectionDomain$JavaSecurityAccessImpl.doIntersectionPrivilege(Unknown Source) at java.awt.EventQueue.dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source)

centos7 静默安装oracle10g,启动监听时报错,怎么整呀,大神帮帮忙!!

执行 $ORACLE_HOME/bin/netca /silent /responseFile /home/oracle/database/response/netca.rsp静默安装监听 Exception in thread "main" java.lang.UnsatisfiedLinkError: /usr/oracle/product/10.2.0/db_1/jdk/jre/lib/i386/libawt.so: /lib/tls/i686/libc.so.6: version `GLIBC_2.4' not found (required by /lib/libXp.so.6) at java.lang.ClassLoader$NativeLibrary.load(Native Method) at java.lang.ClassLoader.loadLibrary0(ClassLoader.java:1586) at java.lang.ClassLoader.loadLibrary(ClassLoader.java:1503) at java.lang.Runtime.loadLibrary0(Runtime.java:788) at java.lang.System.loadLibrary(System.java:834) at sun.security.action.LoadLibraryAction.run(LoadLibraryAction.java:50) at java.security.AccessController.doPrivileged(Native Method) at sun.awt.NativeLibLoader.loadLibraries(NativeLibLoader.java:38) at sun.awt.DebugHelper.<clinit>(DebugHelper.java:29) at java.awt.Component.<clinit>(Component.java:506)

出现了java.lang.NoClassDefFoundError错误但是我用的是idea软件编写的

``` <?xml version="1.0" encoding="UTF-8"?> <beans xmlns="http://www.springframework.org/schema/beans" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:p="http://www.springframework.org/schema/p" xmlns:context="http://www.springframework.org/schema/context" xsi:schemaLocation="http://www.springframework.org/schema/beans http://www.springframework.org/schema/beans/spring-beans.xsd http://www.springframework.org/schema/context http://www.springframework.org/schema/context/spring-context.xsd"> <!-- 业务层--> <bean id="userService" class="com.cwj.Service.UserServiceImpl"/> <!-- 切面层--> <bean id="myAscpect" class="com.cwj.Service.MyAspect"/> <bean id="proxyService" class="org.springframework.aop.framework.ProxyFactoryBean"> <property name="interfaces" value="com.cwj.Service.UserService"/> <property name="target" ref="userService"/> <property name="interceptorNames" value="proxyService"/> <!--使用cglib创建代理 --> <property name="optimize" value="true"></property> </bean> </beans> ``` ``` 五月 10, 2019 12:15:19 上午 org.springframework.context.support.ClassPathXmlApplicationContext prepareRefresh 信息: Refreshing org.springframework.context.support.ClassPathXmlApplicationContext@66cd51c3: startup date [Fri May 10 00:15:19 CST 2019]; root of context hierarchy 五月 10, 2019 12:15:19 上午 org.springframework.beans.factory.xml.XmlBeanDefinitionReader loadBeanDefinitions 信息: Loading XML bean definitions from class path resource [com/cwj/beans3.xml] Exception in thread "main" java.lang.NoClassDefFoundError: Could not initialize class org.springframework.beans.factory.BeanCreationException ``` ```at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.doGetObjectFromFactoryBean(FactoryBeanRegistrySupport.java:185) at org.springframework.beans.factory.support.FactoryBeanRegistrySupport.getObjectFromFactoryBean(FactoryBeanRegistrySupport.java:103) at org.springframework.beans.factory.support.AbstractBeanFactory.getObjectForBeanInstance(AbstractBeanFactory.java:1640) at org.springframework.beans.factory.support.AbstractBeanFactory.doGetBean(AbstractBeanFactory.java:254) at org.springframework.beans.factory.support.AbstractBeanFactory.getBean(AbstractBeanFactory.java:197) at org.springframework.context.support.AbstractApplicationContext.getBean(AbstractApplicationContext.java:1080) at com.cwj.Text.Text4.main(Text4.java:28) ``` ``` public class Text4 { public static void main(String[] args) { ApplicationContext context=new ClassPathXmlApplicationContext("com/cwj/beans3.xml"); UserService service= (UserService) context.getBean("proxyService"); service.addUser(); service.deletUser(); } } ``` 来个大佬看看,这个错误第二次了,第一次的时候我发现了是jar包的版本太低,导入版本的Jar包,问题解决了,现在又出现了这个问题,求大佬帮忙

最好运行结果说是Exception in thread "main" java.NoSuchMethordError:main

> import java.applet.*; import java.awt.*; import javax.swing.*; import java.awt.event.*; //import java.Math.*; public class cal extends Applet { //定义所有需要使用的全局变量 String str="0";//暂存显示屏数据 String sign="null";//暂存符号数据 double num=0;//暂存内部运算数据 boolean change=false;//暂存内部四则运算起用 GridLayout g0,g1;//定义AWT布局部件 JTextField number; Button num_p,num_0,num_1,num_2,num_3,num_4,num_5,num_6,num_7,num_8,num_9; Button act_add,act_mul,act_div,act_sub; Button mat_sin,mat_cos,mat_tan; Button do_ans,do_del; Panel p0,p1; public void init()//主程序部分 { //定义各个控件的样式 number=new JTextField(20);//显示屏 number.setHorizontalAlignment(JTextField.RIGHT); number.setEnabled(false); number.setText("0"); num_p=new Button(".");//小数点的按钮 num_p.setForeground(Color.red); num_p.addActionListener(new getbt()); num_0=new Button("0");//数字0的按钮 num_0.setForeground(Color.red); num_0.addActionListener(new getbt()); num_1=new Button("1");//数字1的按钮 num_1.setForeground(Color.red); num_1.addActionListener(new getbt()); num_2=new Button("2");//数字2的按钮 num_2.setForeground(Color.red); num_2.addActionListener(new getbt()); num_3=new Button("3");//数字3的按钮 num_3.setForeground(Color.red); num_3.addActionListener(new getbt()); num_4=new Button("4");//数字4的按钮 num_4.setForeground(Color.red); num_4.addActionListener(new getbt()); num_5=new Button("5");//数字5的按钮 num_5.setForeground(Color.red); num_5.addActionListener(new getbt()); num_6=new Button("6");//数字6的按钮 num_6.setForeground(Color.red); num_6.addActionListener(new getbt()); num_7=new Button("7");//数字7的按钮 num_7.setForeground(Color.red); num_7.addActionListener(new getbt()); num_8=new Button("8");//数字8的按钮 num_8.setForeground(Color.red); num_8.addActionListener(new getbt()); num_9=new Button("9");//数字9的按钮 num_9.setForeground(Color.red); num_9.addActionListener(new getbt()); act_add=new Button("+");//加法的按钮 act_add.setForeground(Color.red); act_add.addActionListener(new getbt()); act_sub=new Button("-");//减法的按钮 act_sub.setForeground(Color.red); act_sub.addActionListener(new getbt()); act_mul=new Button("*");//乘法的按钮 act_mul.setForeground(Color.red); act_mul.addActionListener(new getbt()); act_div=new Button("/");//除法的按钮 act_div.setForeground(Color.red); act_div.addActionListener(new getbt()); do_ans=new Button("=");//等于的按钮 do_ans.setForeground(Color.red); do_ans.addActionListener(new getbt()); do_del=new Button("del");//删除的按钮 do_del.setForeground(Color.red); do_del.addActionListener(new getbt()); mat_sin=new Button("sin");//sin的按钮 mat_sin.setForeground(Color.red); mat_sin.addActionListener(new getbt()); mat_cos=new Button("cos");//cos的按钮 mat_cos.setForeground(Color.red); mat_cos.addActionListener(new getbt()); mat_tan=new Button("tan");//tan的按钮 mat_tan.setForeground(Color.red); mat_tan.addActionListener(new getbt()); //布局整个计算器 g0=new GridLayout(1,1,10,10);//布局输入输出大体位置 g1=new GridLayout(4,5,10,10); p0=new Panel(); //显示屏的布局 p0.setLayout(g0); p0.add(number); p0.setBounds(0,0,100,50); //按纽的布局 p1=new Panel(); p1.setLayout(g1); p1.add(num_1);//第一排按纽 p1.add(num_2); p1.add(num_3); p1.add(act_add); p1.add(act_sub); p1.add(num_4);//第二排按纽 p1.add(num_5); p1.add(num_6); p1.add(act_mul); p1.add(act_div); p1.add(num_7);//第三排按纽 p1.add(num_8); p1.add(num_9); p1.add(mat_sin); p1.add(mat_cos); p1.add(num_0);//第四排按钮 p1.add(num_p); p1.add(do_ans); p1.add(do_del); p1.add(mat_tan); p1.setBounds(5,60,400,250); p1.setBackground(Color.cyan);//设置按钮背景颜色 setLayout(null); add(p0); add(p1); this.setBackground(Color.cyan);//设置背景整体颜色 } class getbt implements ActionListener //监听作出反应的类 { public void actionPerformed(ActionEvent e)//对每个每个按钮做出响应 { if(e.getSource()==num_0) press0(); else if(e.getSource()==num_1) press1(); else if(e.getSource()==num_2) press2(); else if(e.getSource()==num_3) press3(); else if(e.getSource()==num_4) press4(); else if(e.getSource()==num_5) press5(); else if(e.getSource()==num_6) press6(); else if(e.getSource()==num_7) press7(); else if(e.getSource()==num_8) press8(); else if(e.getSource()==num_9) press9(); else if(e.getSource()==num_p) pressp(); else if(e.getSource()==act_add) pressadd(); else if(e.getSource()==act_mul) pressmul(); else if(e.getSource()==act_div) pressdiv(); else if(e.getSource()==act_sub) presssub(); else if(e.getSource()==mat_sin) presssin(); else if(e.getSource()==mat_tan) presstan(); else if(e.getSource()==mat_cos) presscos(); else if(e.getSource()==do_ans) pressans(); else if (e.getSource()==do_del) pressdel(); } } public void press0()//对按0作出反应 { if(str.length()<16 && str!="0" && change==false) { str+="0"; } else if(str=="0" || sign!="null") { str="0"; } number.setText(str); } public void press1()//对按1作出反应 { if(str.length()<16 && str!="0" && change==false) { str+="1"; } else if(str=="0"|| sign!="null") { str="1"; change=false; } number.setText(str); } public void press2()//对按2作出反应 { if(str.length()<16 && str!="0" && change==false) { str+="2"; } else if(str=="0" || sign!="null") { str="2"; change=false; } number.setText(str); } public void press3()//对按3作出反应 { if(str.length()<16 && str!="0" && change==false) { str+="3"; } else if(str=="0" || sign!="null") { str="3"; change=false; } number.setText(str); } public void press4()//对按4作出反应 { if(str.length()<16 && str!="0" && change==false) { str+="4"; } else if(str=="0" || sign!="null") { str="4"; change=false; } number.setText(str); } public void press5()//对按5作出反应 { if(str.length()<16 && str!="0" && change==false) { str+="5"; } else if(str=="0" || sign!="null") { str="5"; change=false; } number.setText(str); } public void press6()//对按6作出反应 { if(str.length()<16 && str!="0" && change==false) { str+="6"; } else if(str=="0" || sign!="null") { str="6"; change=false; } number.setText(str); } public void press7()//对按7作出反应 { if(str.length()<16 && str!="0" && change==false) { str+="7"; } else if(str=="0" || sign!="null") { str="7"; change=false; } number.setText(str); } public void press8()//对按8作出反应 { if(str.length()<16 && str!="0" && change==false) { str+="8"; } else if(str=="0" || sign!="null") { str="8"; change=false; } number.setText(str); } public void press9()//对按9作出反应 { if(str.length()<16 && str!="0" && change==false) { str+="9"; } else if(str=="0" || sign!="null") { str="9"; change=false; } number.setText(str); } public void pressp()//对按.作出反应 { boolean p=false; for(int i=0;i<str.length();i++) if(str.charAt(i)=='.') p=true; if(str.length()<16 && str!="0" && sign=="null" && p==false) { str+="."; } else if((str=="0" || sign!="null")&& p==false) { str="0."; } number.setText(str); } public void pressadd()//对按+作出反应 { sign="add"; num=Double.parseDouble(str); change=true; } public void presssub()//对按-作出反应 { sign="sub"; num=Double.parseDouble(str); change=true; } public void pressmul()//对按*作出反应 { sign="mul"; num=Double.parseDouble(str); change=true; } public void pressdiv()//对按/作出反应 { sign="div"; num=Double.parseDouble(str); change=true; } public void presssin()//对按sin作出反应 { if(str!="0." && str!="-0" && str!="-0." && str!="0") { sign="null"; num=Double.parseDouble(str); num=Math.sin(num); str=Double.toString(num); if(str.length()>16) str=str.substring(0,16); num=0; } if(str=="0") { sign="null"; num=0; } number.setText(str); } public void presstan()//对按tan作出反应 { if(str!="0." && str!="-0" && str!="-0."&& str!="0") { sign="null"; num=Double.parseDouble(str); num=Math.tan(num); str=Double.toString(num); if(str.length()>16) str=str.substring(0,16); num=0; } number.setText(str); } public void presscos()//对按cos作出反应 { if(str!="0." && str!="-0" && str!="-0.") { sign="null"; num=Double.parseDouble(str); num=Math.cos(num); str=Double.toString(num); if(str.length()>16) str=str.substring(0,16); num=0; } number.setText(str); } public void pressans()//对按=作出反应 { if(sign=="null") number.setText(str); else if(sign=="add") { num+=Double.parseDouble(str); str=Double.toString(num); number.setText(str); } else if(sign=="sub") { num-=Double.parseDouble(str); str=Double.toString(num); number.setText(str); } else if(sign=="mul") { num*=Double.parseDouble(str); str=Double.toString(num); number.setText(str); } else if(sign=="div") { if(num!=0) { num/=Double.parseDouble(str); str=Double.toString(num); number.setText(str); } else { str="0"; number.setText(str); } } sign="null"; } public void pressdel()//对按del作出反应 { if(str.length()>1) { str=str.substring(0,str.length()-1); number.setText(str); } else if(str.length()==1) { str="0"; number.setText(str); } } }

在中国程序员是青春饭吗?

今年,我也32了 ,为了不给大家误导,咨询了猎头、圈内好友,以及年过35岁的几位老程序员……舍了老脸去揭人家伤疤……希望能给大家以帮助,记得帮我点赞哦。 目录: 你以为的人生 一次又一次的伤害 猎头界的真相 如何应对互联网行业的「中年危机」 一、你以为的人生 刚入行时,拿着傲人的工资,想着好好干,以为我们的人生是这样的: 等真到了那一天,你会发现,你的人生很可能是这样的: ...

程序员请照顾好自己,周末病魔差点一套带走我。

程序员在一个周末的时间,得了重病,差点当场去世,还好及时挽救回来了。

和黑客斗争的 6 天!

互联网公司工作,很难避免不和黑客们打交道,我呆过的两家互联网公司,几乎每月每天每分钟都有黑客在公司网站上扫描。有的是寻找 Sql 注入的缺口,有的是寻找线上服务器可能存在的漏洞,大部分都...

搜狗输入法也在挑战国人的智商!

故事总是一个接着一个到来...上周写完《鲁大师已经彻底沦为一款垃圾流氓软件!》这篇文章之后,鲁大师的市场工作人员就找到了我,希望把这篇文章删除掉。经过一番沟通我先把这篇文章从公号中删除了...

总结了 150 余个神奇网站,你不来瞅瞅吗?

原博客再更新,可能就没了,之后将持续更新本篇博客。

副业收入是我做程序媛的3倍,工作外的B面人生是怎样的?

提到“程序员”,多数人脑海里首先想到的大约是:为人木讷、薪水超高、工作枯燥…… 然而,当离开工作岗位,撕去层层标签,脱下“程序员”这身外套,有的人生动又有趣,马上展现出了完全不同的A/B面人生! 不论是简单的爱好,还是正经的副业,他们都干得同样出色。偶尔,还能和程序员的特质结合,产生奇妙的“化学反应”。 @Charlotte:平日素颜示人,周末美妆博主 大家都以为程序媛也个个不修边幅,但我们也许...

MySQL数据库面试题(2020最新版)

文章目录数据库基础知识为什么要使用数据库什么是SQL?什么是MySQL?数据库三大范式是什么mysql有关权限的表都有哪几个MySQL的binlog有有几种录入格式?分别有什么区别?数据类型mysql有哪些数据类型引擎MySQL存储引擎MyISAM与InnoDB区别MyISAM索引与InnoDB索引的区别?InnoDB引擎的4大特性存储引擎选择索引什么是索引?索引有哪些优缺点?索引使用场景(重点)...

如果你是老板,你会不会踢了这样的员工?

有个好朋友ZS,是技术总监,昨天问我:“有一个老下属,跟了我很多年,做事勤勤恳恳,主动性也很好。但随着公司的发展,他的进步速度,跟不上团队的步伐了,有点...

我入职阿里后,才知道原来简历这么写

私下里,有不少读者问我:“二哥,如何才能写出一份专业的技术简历呢?我总感觉自己写的简历太烂了,所以投了无数份,都石沉大海了。”说实话,我自己好多年没有写过简历了,但我认识的一个同行,他在阿里,给我说了一些他当年写简历的方法论,我感觉太牛逼了,实在是忍不住,就分享了出来,希望能够帮助到你。 01、简历的本质 作为简历的撰写者,你必须要搞清楚一点,简历的本质是什么,它就是为了来销售你的价值主张的。往深...

优雅的替换if-else语句

场景 日常开发,if-else语句写的不少吧??当逻辑分支非常多的时候,if-else套了一层又一层,虽然业务功能倒是实现了,但是看起来是真的很不优雅,尤其是对于我这种有强迫症的程序"猿",看到这么多if-else,脑袋瓜子就嗡嗡的,总想着解锁新姿势:干掉过多的if-else!!!本文将介绍三板斧手段: 优先判断条件,条件不满足的,逻辑及时中断返回; 采用策略模式+工厂模式; 结合注解,锦...

离职半年了,老东家又发 offer,回不回?

有小伙伴问松哥这个问题,他在上海某公司,在离职了几个月后,前公司的领导联系到他,希望他能够返聘回去,他很纠结要不要回去? 俗话说好马不吃回头草,但是这个小伙伴既然感到纠结了,我觉得至少说明了两个问题:1.曾经的公司还不错;2.现在的日子也不是很如意。否则应该就不会纠结了。 老实说,松哥之前也有过类似的经历,今天就来和小伙伴们聊聊回头草到底吃不吃。 首先一个基本观点,就是离职了也没必要和老东家弄的苦...

2020阿里全球数学大赛:3万名高手、4道题、2天2夜未交卷

阿里巴巴全球数学竞赛( Alibaba Global Mathematics Competition)由马云发起,由中国科学技术协会、阿里巴巴基金会、阿里巴巴达摩院共同举办。大赛不设报名门槛,全世界爱好数学的人都可参与,不论是否出身数学专业、是否投身数学研究。 2020年阿里巴巴达摩院邀请北京大学、剑桥大学、浙江大学等高校的顶尖数学教师组建了出题组。中科院院士、美国艺术与科学院院士、北京国际数学...

男生更看重女生的身材脸蛋,还是思想?

往往,我们看不进去大段大段的逻辑。深刻的哲理,往往短而精悍,一阵见血。问:产品经理挺漂亮的,有点心动,但不知道合不合得来。男生更看重女生的身材脸蛋,还是...

程序员为什么千万不要瞎努力?

本文作者用对比非常鲜明的两个开发团队的故事,讲解了敏捷开发之道 —— 如果你的团队缺乏统一标准的环境,那么即使勤劳努力,不仅会极其耗时而且成果甚微,使用...

为什么程序员做外包会被瞧不起?

二哥,有个事想询问下您的意见,您觉得应届生值得去外包吗?公司虽然挺大的,中xx,但待遇感觉挺低,马上要报到,挺纠结的。

当HR压你价,说你只值7K,你该怎么回答?

当HR压你价,说你只值7K时,你可以流畅地回答,记住,是流畅,不能犹豫。 礼貌地说:“7K是吗?了解了。嗯~其实我对贵司的面试官印象很好。只不过,现在我的手头上已经有一份11K的offer。来面试,主要也是自己对贵司挺有兴趣的,所以过来看看……”(未完) 这段话主要是陪HR互诈的同时,从公司兴趣,公司职员印象上,都给予对方正面的肯定,既能提升HR的好感度,又能让谈判气氛融洽,为后面的发挥留足空间。...

面试:第十六章:Java中级开发(16k)

HashMap底层实现原理,红黑树,B+树,B树的结构原理 Spring的AOP和IOC是什么?它们常见的使用场景有哪些?Spring事务,事务的属性,传播行为,数据库隔离级别 Spring和SpringMVC,MyBatis以及SpringBoot的注解分别有哪些?SpringMVC的工作原理,SpringBoot框架的优点,MyBatis框架的优点 SpringCould组件有哪些,他们...

面试阿里p7,被按在地上摩擦,鬼知道我经历了什么?

面试阿里p7被问到的问题(当时我只知道第一个):@Conditional是做什么的?@Conditional多个条件是什么逻辑关系?条件判断在什么时候执...

面试了一个 31 岁程序员,让我有所触动,30岁以上的程序员该何去何从?

最近面试了一个31岁8年经验的程序猿,让我有点感慨,大龄程序猿该何去何从。

大三实习生,字节跳动面经分享,已拿Offer

说实话,自己的算法,我一个不会,太难了吧

程序员垃圾简历长什么样?

已经连续五年参加大厂校招、社招的技术面试工作,简历看的不下于万份 这篇文章会用实例告诉你,什么是差的程序员简历! 疫情快要结束了,各个公司也都开始春招了,作为即将红遍大江南北的新晋UP主,那当然要为小伙伴们做点事(手动狗头)。 就在公众号里公开征简历,义务帮大家看,并一一点评。《启舰:春招在即,义务帮大家看看简历吧》 一石激起千层浪,三天收到两百多封简历。 花光了两个星期的所有空闲时...

《Oracle Java SE编程自学与面试指南》最佳学习路线图2020年最新版(进大厂必备)

正确选择比瞎努力更重要!

《Oracle Java SE编程自学与面试指南》最佳学习路线图(2020最新版)

正确选择比瞎努力更重要!

都前后端分离了,咱就别做页面跳转了!统统 JSON 交互

文章目录1. 无状态登录1.1 什么是有状态1.2 什么是无状态1.3 如何实现无状态1.4 各自优缺点2. 登录交互2.1 前后端分离的数据交互2.2 登录成功2.3 登录失败3. 未认证处理方案4. 注销登录 这是本系列的第四篇,有小伙伴找不到之前文章,松哥给大家列一个索引出来: 挖一个大坑,Spring Security 开搞! 松哥手把手带你入门 Spring Security,别再问密...

字节跳动面试官竟然问了我JDBC?

轻松等回家通知

面试官:你连SSO都不懂,就别来面试了

大厂竟然要考我SSO,卧槽。

阿里面试官让我用Zk(Zookeeper)实现分布式锁

他可能没想到,我当场手写出来了

终于,月薪过5万了!

来看几个问题想不想月薪超过5万?想不想进入公司架构组?想不想成为项目组的负责人?想不想成为spring的高手,超越99%的对手?那么本文内容是你必须要掌握的。本文主要详解bean的生命...

自从喜欢上了B站这12个UP主,我越来越觉得自己是个废柴了!

不怕告诉你,我自从喜欢上了这12个UP主,哔哩哔哩成为了我手机上最耗电的软件,几乎每天都会看,可是吧,看的越多,我就越觉得自己是个废柴,唉,老天不公啊,不信你看看…… 间接性踌躇满志,持续性混吃等死,都是因为你们……但是,自己的学习力在慢慢变强,这是不容忽视的,推荐给你们! 都说B站是个宝,可是有人不会挖啊,没事,今天咱挖好的送你一箩筐,首先啊,我在B站上最喜欢看这个家伙的视频了,为啥 ,咱撇...

代码注释如此沙雕,会玩还是你们程序员!

某站后端代码被“开源”,同时刷遍全网的,还有代码里的那些神注释。 我们这才知道,原来程序员个个都是段子手;这么多年来,我们也走过了他们的无数套路… 首先,产品经理,是永远永远吐槽不完的!网友的评论也非常扎心,说看这些代码就像在阅读程序员的日记,每一页都写满了对产品经理的恨。 然后,也要发出直击灵魂的质问:你是尊贵的付费大会员吗? 这不禁让人想起之前某音乐app的穷逼Vip,果然,穷逼在哪里都是...

立即提问
相关内容推荐