首页
统计
邻居
留言
关于
Search
1
彩虹商城系统开发API文档
4,323 阅读
2
IntelliJ IDEA 报错TextMate bundle load error: Bundle kotlin can't be registered
3,743 阅读
3
使用RaiDrive将网盘映射为本地磁盘
2,174 阅读
4
谷歌浏览器 Google Chrome 69.0.3497.100 正式稳定版、测试版及开发版本大全
2,131 阅读
5
抖音、小红书、快手 免费三网解析去水印小工具
2,044 阅读
精选推荐
源码分享
软件下载
影视资源
经验教程
模板插件
Emlogo
Wordpress
浮夸小生。
情感杂文
趣味生活
影视后期
Java学习笔记
登录
Search
标签搜索
个人分享
Wordpress
浮夸小生。
Wordpress教程
Java
PHP
Wordpress优化
Java笔记
网络技巧
网站
CDN
Windows
又拍云
教程
浏览器
IntelliJ IDEA
html
建站教程
微信
情感杂文
浮夸小生。
累计撰写
83
篇文章
累计收到
220
条评论
首页
栏目
精选推荐
源码分享
软件下载
影视资源
经验教程
模板插件
Emlogo
Wordpress
浮夸小生。
情感杂文
趣味生活
影视后期
Java学习笔记
页面
统计
邻居
留言
关于
搜索到
13
篇与
Java
的结果
2023-06-19
MacOs利用Brew安装Jdk11
一:安装JDK171.安装openjdk172.把homebrew安装的openjdk17软链接到系统目录brew search jdk //搜索可以安装的jdk版本 brew install openjdk@11 //按自己需要选择 3.执行安装sudo ln -sfn $(brew --prefix)/opt/openjdk@11/libexec/openjdk.jdk /Library/Java/JavaVirtualMachines/openjdk-11.jdk 二:检查是否安装成功在Terminal中运行下面的命令查看Java安装版本,如正常显示Java版本信息则说明安装成功,如果显示command java not find 或者其它则说明没有安装成功java --version三:配置环境变量切到jdk的home文件cd /Library/Java/JavaVirtualMachines/openjdk-11.jdk/Contents/Home首次创建配置,可以使用这个命令创建配置文件~touch .bash_profile然后使用以下命令打开配置文件open -e .bash_profile添加配置内容:注意路径JAVA_HOME="/Library/Java/JavaVirtualMachines/openjdk-11.jdk/Contents/Home" export JAVA_HOME CLASS_PATH="$JAVA_HOME/lib" PATH=".$PATH:$JAVA_HOME/bin"四:完成配置1.完成配置:source .bash_profile2.输入echo $JAVA_HOME可以看到环境配置的路径 source .bash_profile //完成配置 echo $JAVA_HOME //检查配置
2023年06月19日
850 阅读
3 评论
0 点赞
2022-12-20
java知识点收录
{card-describe title="学习网址"}https://leetcode-cn.com/problemset/all/http://www.cyc2018.xyzhttps://www.nowcoder.com/ta/coding-interviewsJava 全栈知识体系https://www.pdai.tech/{/card-describe}永无止境深拷贝https://zhuanlan.zhihu.com/p/260117694https://github.com/lvminghui/Java-NotesHashmap https://zhuanlan.zhihu.com/p/21673805SpringBoot自动装配原理https://blog.csdn.net/qq_36986015/article/details/107488437b树和b+树的区别https://blog.csdn.net/login_sonata/article/details/75268075二叉树的四种遍历方式https://www.cnblogs.com/du001011/p/11229170.htmlMysql ACID https://www.jianshu.com/p/fc8a654f2205Mysql MVVC https://www.cnblogs.com/hirampeng/p/9944200.htmlMysql 覆盖索引 https://zhuanlan.zhihu.com/p/107125866JVM和JMM https://zhuanlan.zhihu.com/p/136623445,https://www.bilibili.com/video/BV12t411u726JDK1.7和JDK1.8的内存模型比较https://blog.csdn.net/Hollake/article/details/92762180Java中的常量池https://blog.csdn.net/zm13007310400/article/details/77534349接口和抽象类https://cloud.tencent.com/developer/article/1677833Spring实例化Bean三种方法https://www.cnblogs.com/liushiqiang123/p/11502986.htmlBean注入https://www.cnblogs.com/tuyang1129/p/12873492.html设计模式7大原则https://zhuanlan.zhihu.com/p/24614363OAuth2.0认证流程https://www.cnblogs.com/wudimanong/p/10821215.html线程池https://blog.csdn.net/ming1215919/article/details/114799184Listhttps://www.cnblogs.com/xiaobug/p/11606362.html解决--spring.profiles.active=prod设置的变量属性不起作用https://blog.csdn.net/shaojianjun521/article/details/102803303httputil https://www.cnblogs.com/i-tao/p/13638904.htmlConcurrentHashMaphttps://my.oschina.net/liboware/blog/5117011https://blog.csdn.net/qq_18300037/article/details/123795776nohup java -jar rjdataservice-1.0.0-SNAPSHOT.jar >logs.txt & --spring.profiles.active=test
2022年12月20日
267 阅读
2 评论
0 点赞
2022-05-02
java 随机生成验证码 思路
通过ASCII表生成大小写验证码 public static void main(String[] args) { System.out.println( createCode(6)); } public static String createCode(int n){ //int n 表示随机生成几位 Random r = new Random(); String code = ""; for (int i = 0; i < n; i++) { int type = r.nextInt(3); switch (type){ case 0: //大写字母 ASCII码 char ch = (char)(r.nextInt(25)+65); code += ch; break; case 1: //小写字母 ASCII码 char ch1 = (char)(r.nextInt(25)+97); code += ch1; break; case 2: //数字 code += r.nextInt(10); break; } } return code ; } }
2022年05月02日
408 阅读
3 评论
0 点赞
2022-04-10
tomcat 报错: A child container failed during start 解决方法
错误详情涓ラ��: A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].StandardContext[]] at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122) at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:800) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:264) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:834) Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost].StandardContext[]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) ... 7 more Caused by: java.lang.LinkageError: loader constraint violation: loader org.apache.catalina.loader.WebappClassLoader @53e582eb (instance of org.apache.catalina.loader.WebappClassLoader, child of org.codehaus.plexus.classworlds.realm.ClassRealm @257e0827 org.codehaus.plexus.classworlds.realm.ClassRealm) wants to load interface javax.servlet.ServletContext. A different interface with the same name was previously loaded by org.codehaus.plexus.classworlds.realm.ClassRealm @257e0827 (instance of org.codehaus.plexus.classworlds.realm.ClassRealm, child of 'bootstrap'). at java.base/java.lang.ClassLoader.defineClass1(Native Method) at java.base/java.lang.ClassLoader.defineClass(ClassLoader.java:1016) at java.base/java.security.SecureClassLoader.defineClass(SecureClassLoader.java:174) at java.base/java.net.URLClassLoader.defineClass(URLClassLoader.java:550) at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:458) at java.base/java.net.URLClassLoader$1.run(URLClassLoader.java:452) at java.base/java.security.AccessController.doPrivileged(Native Method) at java.base/java.net.URLClassLoader.findClass(URLClassLoader.java:451) at org.apache.catalina.loader.WebappClassLoader.findClass(WebappClassLoader.java:1191) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1669) at org.apache.catalina.loader.WebappClassLoader.loadClass(WebappClassLoader.java:1547) at org.springframework.web.SpringServletContainerInitializer.onStartup(SpringServletContainerInitializer.java:165) at org.apache.catalina.core.StandardContext.startInternal(StandardContext.java:5423) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ... 7 more 12�� 19, 2019 3:20:08 涓��� org.apache.catalina.core.ContainerBase startInternal 涓ラ��: A child container failed during start java.util.concurrent.ExecutionException: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost]] at java.base/java.util.concurrent.FutureTask.report(FutureTask.java:122) at java.base/java.util.concurrent.FutureTask.get(FutureTask.java:191) at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1123) at org.apache.catalina.core.StandardEngine.startInternal(StandardEngine.java:302) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.StandardService.startInternal(StandardService.java:443) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.core.StandardServer.startInternal(StandardServer.java:732) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) at org.apache.catalina.startup.Tomcat.start(Tomcat.java:341) at org.apache.tomcat.maven.plugin.tomcat7.run.AbstractRunMojo.startContainer(AbstractRunMojo.java:1238) at org.apache.tomcat.maven.plugin.tomcat7.run.AbstractRunMojo.execute(AbstractRunMojo.java:592) at org.apache.maven.plugin.DefaultBuildPluginManager.executeMojo(DefaultBuildPluginManager.java:134) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:208) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:154) at org.apache.maven.lifecycle.internal.MojoExecutor.execute(MojoExecutor.java:146) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:117) at org.apache.maven.lifecycle.internal.LifecycleModuleBuilder.buildProject(LifecycleModuleBuilder.java:81) at org.apache.maven.lifecycle.internal.builder.singlethreaded.SingleThreadedBuilder.build(SingleThreadedBuilder.java:51) at org.apache.maven.lifecycle.internal.LifecycleStarter.execute(LifecycleStarter.java:128) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:309) at org.apache.maven.DefaultMaven.doExecute(DefaultMaven.java:194) at org.apache.maven.DefaultMaven.execute(DefaultMaven.java:107) at org.apache.maven.cli.MavenCli.execute(MavenCli.java:955) at org.apache.maven.cli.MavenCli.doMain(MavenCli.java:290) at org.apache.maven.cli.MavenCli.main(MavenCli.java:194) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:566) at org.codehaus.plexus.classworlds.launcher.Launcher.launchEnhanced(Launcher.java:289) at org.codehaus.plexus.classworlds.launcher.Launcher.launch(Launcher.java:229) at org.codehaus.plexus.classworlds.launcher.Launcher.mainWithExitCode(Launcher.java:415) at org.codehaus.plexus.classworlds.launcher.Launcher.main(Launcher.java:356) at org.codehaus.classworlds.Launcher.main(Launcher.java:47) Caused by: org.apache.catalina.LifecycleException: Failed to start component [StandardEngine[Tomcat].StandardHost[localhost]] at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:154) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1559) at org.apache.catalina.core.ContainerBase$StartChild.call(ContainerBase.java:1549) at java.base/java.util.concurrent.FutureTask.run$$$capture(FutureTask.java:264) at java.base/java.util.concurrent.FutureTask.run(FutureTask.java) at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1128) at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:628) at java.base/java.lang.Thread.run(Thread.java:834) Caused by: org.apache.catalina.LifecycleException: A child container failed during start at org.apache.catalina.core.ContainerBase.startInternal(ContainerBase.java:1131) at org.apache.catalina.core.StandardHost.startInternal(StandardHost.java:800) at org.apache.catalina.util.LifecycleBase.start(LifecycleBase.java:150) ... 7 more 解决方法pom.xml文件中servlet-api和jsp-api的坐标中缺少scope,加载<scrop>就可以 <!--servlet和jsp--> <dependency> <groupId>javax.servlet</groupId> <artifactId>servlet-api</artifactId> <version>2.5</version> <scope>provided</scope> </dependency> <dependency> <groupId>javax.servlet.jsp</groupId> <artifactId>jsp-api</artifactId> <version>2.0</version> <scope>provided</scope> </dependency>
2022年04月10日
471 阅读
0 评论
0 点赞
2022-03-24
解决idea maven配置了Tomcat却在插件窗口不显示的问题
**注意看plugins标签所在的位置plugin的父标签plugins 可以直接放在build标签下也可以放在pluginManagement标签下而我们在创建maven项目的时候 默认存在的那个plugins标签是在pluginManagement标签下的而pluginManagement标签只是对插件的一种声明 而不会对插件进行加载所以解决办法如下:我们要在build标签下再写一个plugins标签然后再把plugin标签放进去下面是完整的pom.xml文件**<?xml version="1.0" encoding="UTF-8"?> <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> <modelVersion>4.0.0</modelVersion> <groupId>org.example</groupId> <artifactId>hello_web2</artifactId> <version>1.0-SNAPSHOT</version> <packaging>war</packaging> <name>hello_web2 Maven Webapp</name> <!-- FIXME change it to the project's website --> <url>http://www.example.com</url> <properties> <project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> <maven.compiler.source>1.8</maven.compiler.source> <maven.compiler.target>1.8</maven.compiler.target> </properties> <dependencies> <dependency> <groupId>junit</groupId> <artifactId>junit</artifactId> <version>4.11</version> <scope>test</scope> </dependency> </dependencies> <build> <finalName>hello_web2</finalName> <plugins> <plugin> <groupId>org.apache.tomcat.maven</groupId> <artifactId>tomcat7-maven-plugin</artifactId> <version>2.2</version> <configuration> <!--配置端口号--> <port>80</port> <!--配置项目路径--> <path>/</path> </configuration> </plugin> </plugins> <pluginManagement><!-- lock down plugins versions to avoid using Maven defaults (may be moved to parent pom) --> <plugins> <plugin> <artifactId>maven-clean-plugin</artifactId> <version>3.1.0</version> </plugin> <!-- see http://maven.apache.org/ref/current/maven-core/default-bindings.html#Plugin_bindings_for_war_packaging --> <plugin> <artifactId>maven-resources-plugin</artifactId> <version>3.0.2</version> </plugin> <plugin> <artifactId>maven-compiler-plugin</artifactId> <version>3.8.0</version> </plugin> <plugin> <artifactId>maven-surefire-plugin</artifactId> <version>2.22.1</version> </plugin> <plugin> <artifactId>maven-war-plugin</artifactId> <version>3.2.2</version> </plugin> <plugin> <artifactId>maven-install-plugin</artifactId> <version>2.5.2</version> </plugin> <plugin> <artifactId>maven-deploy-plugin</artifactId> <version>2.8.2</version> </plugin> </plugins> </pluginManagement> </build> </project>具体位置如下图所示
2022年03月24日
582 阅读
0 评论
1 点赞
2022-01-10
Java Cookie-设置/获取 判断用户是否为第一次访问 且记录访问时间 小Demo
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { //获取cookies response.setContentType("text/html;charset=utf-8"); Cookie[] cookies = request.getCookies(); boolean flag = false; //返回数组遍历数组 寻找 lastTime参数 if (cookies != null && cookies.length >0){ //遍历 for (Cookie cookie : cookies) { //获取 cookie 键 寻找 lastTime String name = cookie.getName(); if ("lastTime".equals(name)){ flag = true; //如果有 就不是第一次登录 Date date = new Date(); //设置时间戳格式 SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日HH:mm:ss"); //返回日期 String src_date = sdf.format(date); //设置 cookie cookie.setValue(src_date); //设置cookie 存活时间 cookie.setMaxAge( 60 * 60 * 24 * 30 ); //添加cookie response.addCookie(cookie); //获取 cookie String value = cookie.getValue(); //打印信息 response.getWriter().write("<h1>欢迎回来,您上次的访问时间为"+ value + "</h1>"); } } } if (cookies == null || cookies.length == 0 || flag == false) { Date date = new Date(); //设置时间戳格式 SimpleDateFormat sdf = new SimpleDateFormat("yyyy年MM月dd日HH:mm:ss"); //返回日期 String src_date = sdf.format(date); //设置 cookie Cookie cookie = new Cookie("lastTime",src_date); //设置cookie 存活时间 cookie.setMaxAge( 60 * 60 * 24 * 30 ); //获取 cookie response.addCookie(cookie); response.getWriter().write("欢迎用户,您是第一次访问登录!"); } }
2022年01月10日
380 阅读
0 评论
1 点赞
2021-11-22
Java反射学习 基础案例--小记
package cc.bltang.demo01; import java.io.IOException; import java.io.InputStream; import java.lang.reflect.Constructor; import java.lang.reflect.Method; import java.util.Properties; public class ReflectDemo02 { public static void main(String[] args) throws Exception { //反射 案例 Properties pro = new Properties(); //加载配置文件,转换为一个集合 //获取Class目录下的配置文件 ClassLoader classLoader = ReflectDemo02.class.getClassLoader(); InputStream is = classLoader.getResourceAsStream("pro.properties"); pro.load(is); //获取配置文件中定义的数据 String className = pro.getProperty("className"); String methodName = pro.getProperty("methodName"); //加载类进内存 Class<?> aClass = Class.forName(className); //创建对象 // Constructor<?> c = aClass.getConstructor(); // Object obj = c.newInstance(); Object obj = aClass.newInstance(); //获取方法对象 Method method = aClass.getMethod(methodName); //执行方法 method.invoke(obj); } }
2021年11月22日
297 阅读
0 评论
0 点赞
2021-10-29
JAVA_集合到文件数据排序
案例*需求:键盘录入5个学生信息(姓名,语文成绩,数学成绩英语成绩)。要求按照成绩总分从高到低写入文本文件 格式:姓名,语文成绩,数学成绩英语成绩 举例:林青霞98,99,100import java.io.BufferedWriter; import java.io.FileWriter; import java.io.IOException; import java.util.Comparator; import java.util.Scanner; import java.util.TreeSet; public class Demo05Scanner { public static void main(String[] args) throws IOException { TreeSet<Student> ts = new TreeSet<>(new Comparator<Student>() { @Override public int compare(Student st1, Student st2) { //成绩从高到底 int num = st2.getSum() - st1.getSum(); //次要条件 //语文成绩相同 int num2 = num ==0? st1.getChinese() -st2.getChinese() : num; //数学成绩相同 int num3 = num2 ==0 ? st1.getMath() - st2.getMath() : num2; int num4 = num3 == 0 ? st1.getName().compareTo(st2.getName()) : num3; return num4; } }); BufferedWriter bw = new BufferedWriter(new FileWriter("D:\\java\\成绩.txt")); Scanner sc = new Scanner(System.in); for (int i = 0; i < 5; i++) { Student stu = new Student(); System.out.println("请第"+(i + 1)+"次输入姓名:"); String name = sc.next(); stu.setName(name); System.out.println("请"+(i + 1)+"次输入语文成绩:"); int chinese = sc.nextInt(); stu.setChinese(chinese); System.out.println("请"+(i + 1)+"次输入数学成绩:"); int match = sc.nextInt(); stu.setMath(match); System.out.println("请"+(i + 1)+"次输入英语成绩:"); int english = sc.nextInt(); stu.setEnglish(english); ts.add(stu); } for (Student t : ts) { //格式:姓名,语文成绩,数学成绩,英语成绩 StringBuilder sb = new StringBuilder(); sb.append(t.getName()).append(",").append(t.getChinese()).append(",").append(t.getMath()).append(",").append(t.getEnglish()); bw.write(sb.toString()); bw.newLine(); bw.flush(); } bw.close(); // 释放资源 }
2021年10月29日
375 阅读
2 评论
0 点赞
2021-10-28
Java 字符输出流及拷贝视频无法播放问题 --注意
注意java流分为两种流:字节流:可以用于读写二进制文件及任何文件 byte字符流:可以用于读写文本文件,不能操作二进制文件{message type="error" content="因此拷贝视频文件必须用字节流操作。"/}以下为错误示范public static void main(String[] args) throws IOException { BufferedReader br = new BufferedReader(new FileReader("D:\\1\\10.27\\10.27-lly-6.mp4")); BufferedWriter bw = new BufferedWriter(new FileWriter("D:\\工作\\10.27-lly-6.mp4")); char[] chars = new char[1024]; int len =0; while ((len =br.read(chars))!=-1){ bw.write(chars,0,len); } bw.close(); br.close(); }
2021年10月28日
573 阅读
0 评论
0 点赞
2021-09-26
Java IO字节缓冲流实现复制文件。 -小记
package demo16; import java.io.*; public class Demo03CopyFor { public static void main(String[] args) throws IOException { long e = System.currentTimeMillis(); FileInputStream fis = new FileInputStream("D:\\C0103.MP4"); BufferedInputStream bis = new BufferedInputStream(fis); FileOutputStream fos = new FileOutputStream("E:\\C0103.MP4"); BufferedOutputStream bos = new BufferedOutputStream(fos); byte[] bytes = new byte[10240]; int len = 0; while ((len = bis.read(bytes))!= -1){ bos.write(bytes); } bis.close(); bos.close(); long s = System.currentTimeMillis(); System.out.println("系统总耗时:"+(s-e)+"毫秒~"); } } 系统总耗时:40毫秒~
2021年09月26日
339 阅读
1 评论
0 点赞
1
2