相关疑难解决方法(0)

如何在Windows 7上设置java_home?

我在控制面板的"系统"中找到了环境变量,并创建了两个新变量,一个用于用户变量,另一个用于系统变量.两者都被命名为JAVA_HOME,两者都指向

C:\太阳\ SDK\JDK\BIN

但由于某种原因,我在运行Java命令时仍会遇到以下错误...

BUILD FAILED
C:\Users\Derek\Desktop\eclipse\eclipse\glassfish\setup.xml:161: The following error  occurred while executing this line:
C:\Users\Derek\Desktop\eclipse\eclipse\glassfish\setup.xml:141: The following error occurred while executing this line:
C:\Users\Derek\Desktop\eclipse\eclipse\glassfish\setup.xml:137: Please set java.home to a JDK installation

Total time: 1 second
C:\Users\Derek\Desktop\eclipse\eclipse\glassfish>lib\ant\bin\ant -f setup.xml
Unable to locate tools.jar. Expected to find it in C:\Program Files\Java\jre6\lib\tools.jar
Buildfile: setup.xml
Run Code Online (Sandbox Code Playgroud)

我该如何解决这个问题?

java java-home system-variable windows-7

415
推荐指数
12
解决办法
153万
查看次数

无法用Spring + Maven退出代码1来执行java

我是Spring/Maven的新手,我正在学习本教程: 使用Spring MVC提供Web内容.

每次我跑mvn spring-boot:run,我都会收到这个错误:

Failed to execute goal org.springframework.boot:spring-boot-maven-plugin:1.5.2.RELEASE:run (default-cli) on project gs-serving-web-content: Could not exec java: Application finished with exit code: 1 ->

我试图添加classpath,试图运行mvn install clean spring-boot:run,做了很多其他人在堆栈流程中建议的类似情况,花了超过8小时 - 没用.

这是我的主要课程Application.java:

package hello;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;

@SpringBootApplication
public class Application {

    public static void main(String[] args) throws Exception{
        SpringApplication.run(Application.class, args);
    }
}
Run Code Online (Sandbox Code Playgroud)

这是我的GreeetingController.java班级:

package hello;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;

@Controller
public class GreetingController {

    @RequestMapping("/greeting") …
Run Code Online (Sandbox Code Playgroud)

java spring spring-mvc maven

5
推荐指数
3
解决办法
1万
查看次数