Error: JAVA_HOME is set to an invalid directory

Solution:
Change JAVA_HOME = "D:/Java/jdk1.6.0_12/bin" to JAVA_HOME = “D:/Java/jdk1.6.0_12”
Change %JAVA_HOME% in the path environment variable to %JAVA_HOME%/bin
Then restart cmd

Tag Archives: java
[Solved] Java 9 reflection error: java.lang.reflect.InaccessibleObjectException
Java 9 reflection error
Problem solving
Question
when writing JavaFX, perform the HTTP request database login operation, and convert the returned JSON string into a class object. The following code always reports an error.
// json string to class object
JavaType javaType;
ResponseBean<T> data = new ObjectMapper().readValue(json, javaType);
the following errors are reported:
java.lang.reflect.InaccessibleObjectException: Unable to make protected cc.nsurl.bean.ResponseBean() accessible: module cc.nsurl.controllers does not "opens cc.nsurl.bean" to module com.fasterxml.jackson.databind
if you can’t open the class, you can’t reflect.
Solution:
Add the file module-info.java to the JavaFX project. The overall project structure is as follows:
-- src
-- main
-- java
-- module-info.java
Configure in this java file:
module cc.nsurl.controllers {
// Classes that require reflection opens Self-written classes to third-party libraries
opens cc.nsurl.controllers to javafx.fxml;
opens cc.nsurl.bean to com.fasterxml.jackson.databind;
exports cc.nsurl.controllers;
}
Rabbitmq reported an error installing the web interface plug-in
Rabbitmq reported an error installing the web interface plug-in
Recently, when installing rabbitmq plugins, I reported the following errors. I don’t know why. I have been online Baidu a lot and tried a lot. These steps are summarized. I hope I can help you:
Error:
[ root@sa software]# rabbitmq-plugins enable rabbitmq_ management
Enabling plugins on node rabbit@sa :
rabbitmq_ management
Error:
{:query, : rabbit@sa , {: badrpc,: timeout}}
solution:
- first enter: “hostnamectl” to view your own hostname
, then enter “VI/etc/hosts” to set your own hostname (Note: here is your own IP address + hostname, for example: 172.12.1.68 admin)
, and finally run again: rabbitmq plugins enable rabbitmq_ management
Come on, come on, work together!!!
Zeppelin starts successfully, but an error is reported
Error message
The Zeppelin service was started successfully, and the UI interface was accessed normally, but the running code reported an error.
org.apache.thrift.transport.TTransportException
at org.apache.thrift.transport.TIOStreamTransport.read(TIOStreamTransport.java:132)
at org.apache.thrift.transport.TTransport.readAll(TTransport.java:86)
at org.apache.thrift.protocol.TBinaryProtocol.readAll(TBinaryProtocol.java:429)
at org.apache.thrift.protocol.TBinaryProtocol.readI32(TBinaryProtocol.java:318)
at org.apache.thrift.protocol.TBinaryProtocol.readMessageBegin(TBinaryProtocol.java:219)
at org.apache.thrift.TServiceClient.receiveBase(TServiceClient.java:69)
at org.apache.zeppelin.interpreter.thrift.RemoteInterpreterService$Client.recv_interpret(RemoteInterpreterService.java:241)
at org.apache.zeppelin.interpreter.thrift.RemoteInterpreterService$Client.interpret(RemoteInterpreterService.java:225)
at org.apache.zeppelin.interpreter.remote.RemoteInterpreter.interpret(RemoteInterpreter.java:229)
at org.apache.zeppelin.interpreter.LazyOpenInterpreter.interpret(LazyOpenInterpreter.java:93)
at org.apache.zeppelin.notebook.Paragraph.jobRun(Paragraph.java:229)
at org.apache.zeppelin.scheduler.Job.run(Job.java:171)
at org.apache.zeppelin.scheduler.RemoteScheduler$JobRunner.run(RemoteScheduler.java:328)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:471)
at java.util.concurrent.FutureTask.run(FutureTask.java:262)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:178)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:292)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615)
at java.lang.Thread.run(Thread.java:745)
Cause of error reporting: this error is caused by the failure to connect to the corresponding spark and other related service parsers. If the spark and Hadoop services run normally, it is the cause of version incompatibility.
Solution
Replace with a compatible Zeppelin version.
The springboot test class reported an error NullPointerException
The test class should be annotated @ runwith (springrunner. Class)
the significance of the annotation is that the test class should use the injected class, such as the class injected by @ Autowired,
With @ runwith (springrunner. Class), these classes can be instantiated into the spring container, and automatic injection can take effect,
Otherwise, just a NullPointerException
@SpringBootTest
@RunWith(SpringRunner.class)
public class AppTest
{
@Autowired
private Sender sender;
@Test
public void Sendtest(){
System.out.println(Sender.class+""+sender);
sender.send();
}
}
You can still run without @ runwith in the idea because it is recognized as a JUnit running environment in the idea, which is equivalent to a self recognized runwidth environment configuration. But not in other ides. Therefore, in order that your code can run normally in other ides, it is recommended to add @ runwith (springrunner. Class)
[Solved] java.lang.noclassdeffounderror when idea runs Flink: org/Apache/flick/API/common/executionconfig
Solution:
change provided to compile ,for example:
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-java</artifactId>
<version>${flink.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-streaming-java_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
<scope>compile</scope>
</dependency>
<dependency>
<groupId>org.apache.flink</groupId>
<artifactId>flink-clients_${scala.binary.version}</artifactId>
<version>${flink.version}</version>
<scope>compile</scope>
</dependency>
Click POM. XML refresh in idea to refresh
![]()
[Solved] Error:Cannot determine path to ‘tools.jar‘ library for 17
Error: cannot determine path to ‘tools. Jar’ library for 17 solution
The error shown above occurs when running a java project. The essence is that the current idea version does not support Java 17.
Solution:
1. Download the JDK supported by the current idea version, such as 14
2. Uninstall the current version of idea and download the latest version of idea
I choose 2.
go to the official website of idea to download the latest version of idea
running the project again succeeds

CreateProcess error = 5, access denied. [How to Solve]
CreateProcess error = 5, access denied.
Bugs encountered using java runtime. Getruntime(). Exec()
Bugs encountered using java runtime. Getruntime(). Exec()
Today, when using a wkhtmltopdf tool, you need to use a Java method, * runtime. Getruntime() returns the runtime object of the current application, and the exec() method of the object instructs the Java virtual machine to create a child process, execute the specified executable program, and return the process object instance corresponding to the child process. Through process, you can control the execution of the sub process or obtain the information of the sub process* An introduction link to this function is attached: runtime. Getruntime(). Exec()
when an error code is reported, guess that the reason is that the folder cannot be accessed or the command cannot be called.
public class WKTest {
public static void main(String[] args) {
String cmd = "D:/programfiles/wkhtmltopdf/bin --quality 75 https://www.nowcoder.com D:\\work\\wk-images/3.png";
try{
Runtime.getRuntime().exec(cmd);
System.out.println("ok");
}catch(IOException e){
e.printStackTrace();
}
}
}
java.io.IOException: Cannot run program "D:/programfiles/wkhtmltopdf/bin": CreateProcess error=5,Denied to access.
at java.lang.ProcessBuilder.start(ProcessBuilder.java:1048)
at java.lang.Runtime.exec(Runtime.java:620)
at java.lang.Runtime.exec(Runtime.java:450)
at java.lang.Runtime.exec(Runtime.java:347)
at com.nowcoder.community.WKTest.main(WKTest.java:15)
Caused by: java.io.IOException: CreateProcess error=5, Denied to access.
In Java, runtime. Getruntime().Exec() implements calling the server command script to execute the required functions. In other words, this line of code cannot be operated on the folder. You must access the script in the folder. Here I mainly call an. EXE file, which is modified as follows:
public class WKTest {
public static void main(String[] args) {
String cmd = "D:/programfiles/wkhtmltopdf/bin/wkhtmltoimage.exe --quality 75 https://www.nowcoder.com D:\\work\\wk-images/3.png";
try{
Runtime.getRuntime().exec(cmd);
System.out.println("ok");
}catch(IOException e){
e.printStackTrace();
}
}
}
Normal test:
ok
Process finished with exit code 0
Weibo API api Called Error: error:appkey not bind domain! error_code:10017/2/statuses/share.json
Error message:
weibo4j.model.WeiboException: 400:The request was invalid. An accompanying error message will explain why. This is the status code will be returned during rate limiting.
error:appkey not bind domain! error_code:10017/2/statuses/share.json
at weibo4j.http.HttpClient.httpRequest(HttpClient.java:404)
at weibo4j.http.HttpClient.post(HttpClient.java:293)
at weibo4j.http.HttpClient.post(HttpClient.java:279)
at weibo4j.Timeline.updateStatus(Timeline.java:953)
at weibo4j.examples.timeline.UpdateStatus.main(UpdateStatus.java:15)
Reason: the security domain name is not configured. The configured security domain name is attached to the status parameter

[Solved] Git Clone Error: “error: RPC failed; curl 56 GnuTLS recv error (-9): A TLS packet with unexpected length …
1. When git pull is used for several large projects recently, the following errors always appear: </ font>
error: RPC failed; curl 56 GnuTLS recv error (-9): A TLS packet with unexpected length was received.
fatal: The remote end hung up unexpectedly
fatal: early EOF
fatal: index-pack failed
2. According to the online method, there are still problems</ font>
// set proxy
git config --global http.proxy socks5://127.0.0.1:1081
git config --global https.proxy socks5://127.0.0.1:1081
// add cache
git config --global http.postBuffer 1048576000
3. Finally, add the following operations to solve the problem
//Change this value to a larger value, the perfect solution, the default is 1500.
ifconfig eth0 mtu 14000
JAVA Connect Redis Error: stop-writes-on-bgsave-error option
(error) MISCONF Redis is configured to save RDB snapshots, but it is currently not able to persist on disk. Commands that may modify the data set are disabled, because this instance is configured to report errors during writes if RDB snapshotting fails (stop-writes-on-bgsave-error option). Please check the Redis logs for details about the RDB error.
Go to the redis installation directory and find src
./redis-cli -a redis password
Then execute
127.0.0.1:6379> config set stop-writes-on-bgsave-error no
That’s it
However, this method will fail after restarting
Error creating bean with name ‘helloController‘: Injection of autowired dependencies failed;
Error content:
when using the automatic injection of springboot, the configuration file in yaml format is used for injection, but the error is always reported and cannot be injected.
org.springframework.beans.factory.BeanCreationException: Error creating bean with name ‘helloController’: Injection of autowired dependencies failed; nested exception is java.lang.IllegalArgumentException: Could not resolve placeholder ‘name’ in value “${name}”
I searched many posts saying that I should pay attention to the application scanning my folder and corresponding subfolders. Many people step on the pit in this place, but my problem is not here
code
@RestController
public class HelloController {
@Value(value = "${name}")
private String name;
@RequestMapping("/hello")
public String hello(){
System.out.println(name);
return "hello Spring Boot !";
}
}
Add the annotation to read the configuration file on hellocontroller
@PropertySource(value = "classpath:application.yaml")
That solved the problem