[英]After setting classpath and path using batch file, still throws errors “Can not find or load main class”
Ever since I moved the location of the file, the batch file doesn't seem to want to find the class path. 自从我移动文件的位置以来,批处理文件似乎就不想找到类路径。 I've tried
set path="C:\\Program Files\\Java\\jdk1.8.0_131\\bin";
我试过
set path="C:\\Program Files\\Java\\jdk1.8.0_131\\bin";
and set classpath="C:\\Program Files\\Java\\jdk1.8.0_131\\lib"
. 并
set classpath="C:\\Program Files\\Java\\jdk1.8.0_131\\lib"
。
Here's the batch file: 这是批处理文件:
@echo off
color 3
title Run Java File
set path="C:\Program Files\Java\jdk1.8.0_131\bin";
set classpath="C:\Program Files\Java\jdk1.8.0_131\lib";
cd C:\Users\user\Documents\Java Test Files\Matthew C\src\calculator
javac Math.java
java Math
pause
and the calculator.java file is just a simple "Hello World" type program - which works within a built-in compiler that I use - that is Eclipse. 而calculator.java文件只是一个简单的“ Hello World”类型程序,它在我使用的内置编译器中运行,即Eclipse。
Does anyone know why this doesn't work? 有谁知道为什么这不起作用? I've tried searching multiple answers in and out of Stackoverflow, and none of them seemed to have worked for me.
我试图在Stackoverflow内外搜索多个答案,但似乎没有一个对我有用。 Thanks!
谢谢!
Here's a few things to try... 这里有一些尝试的方法...
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.