使用jfinal-undertow部署项目出现:找不到或无法加载主类

1.png

2.png


运行start.bat后的错误代码

E:\eclipse-workspace\jfinal01\target\jfinal01-release\jfinal01>锘緻echo off

'锘緻echo' 不是内部或外部命令,也不是可运行的程序

或批处理文件。


E:\eclipse-workspace\jfinal01\target\jfinal01-release\jfinal01>rem -------------

------------------------------------------------------------


E:\eclipse-workspace\jfinal01\target\jfinal01-release\jfinal01>rem


E:\eclipse-workspace\jfinal01\target\jfinal01-release\jfinal01>rem 浣跨敤璇存槑

锛?


E:\eclipse-workspace\jfinal01\target\jfinal01-release\jfinal01>rem


E:\eclipse-workspace\jfinal01\target\jfinal01-release\jfinal01>rem 1: 璇ヨ剼鏈

敤浜庡埆鐨勯」鐩椂鍙渶瑕佷慨鏀?MAIN_CLASS 鍗冲彲杩愯


E:\eclipse-workspace\jfinal01\target\jfinal01-release\jfinal01>rem


E:\eclipse-workspace\jfinal01\target\jfinal01-release\jfinal01>rem 2: JAVA_OPTS

鍙€氳繃 -D 浼犲叆 undertow.port 涓?undertow.host 杩欑被鍙傛暟瑕嗙洊


E:\eclipse-workspace\jfinal01\target\jfinal01-release\jfinal01>rem    閰嶇疆鏂囦

欢涓殑鐩稿悓鍊兼澶栬繕鏈?undertow.resourcePath, undertow.ioThreads


E:\eclipse-workspace\jfinal01\target\jfinal01-release\jfinal01>rem    undertow.w

orkerThreads 鍏变簲涓弬鏁板彲閫氳繃 -D 杩涜浼犲叆


E:\eclipse-workspace\jfinal01\target\jfinal01-release\jfinal01>rem


E:\eclipse-workspace\jfinal01\target\jfinal01-release\jfinal01>rem 3: JAVA_OPTS

鍙紶鍏ユ爣鍑嗙殑 java 鍛戒护琛屽弬鏁?渚嬪 -Xms256m -Xmx1024m 杩欑被甯哥敤鍙

傛暟


E:\eclipse-workspace\jfinal01\target\jfinal01-release\jfinal01>rem


E:\eclipse-workspace\jfinal01\target\jfinal01-release\jfinal01>rem


E:\eclipse-workspace\jfinal01\target\jfinal01-release\jfinal01>rem -------------

------------------------------------------------------------


E:\eclipse-workspace\jfinal01\target\jfinal01-release\jfinal01>setlocal   & push

d


E:\eclipse-workspace\jfinal01\target\jfinal01-release\jfinal01>rem 鍚姩鍏ュ彛

绫?璇ヨ剼鏈枃浠剁敤浜庡埆鐨勯」鐩椂瑕佹敼杩欓噷


E:\eclipse-workspace\jfinal01\target\jfinal01-release\jfinal01>set MAIN_CLASS=co

nfig1.DemoConfig


E:\eclipse-workspace\jfinal01\target\jfinal01-release\jfinal01>rem Java 鍛戒护琛

屽弬鏁?鏍规嵁闇€瑕佸紑鍚笅闈㈢殑閰嶇疆,鏀规垚鑷繁闇€瑕佺殑,娉ㄦ剰绛夊彿鍓嶅

悗涓嶈兘鏈夌┖鏍?


E:\eclipse-workspace\jfinal01\target\jfinal01-release\jfinal01>rem set "JAVA_OPT

S=-Xms256m -Xmx1024m -Dundertow.port=80 -Dundertow.host=0.0.0.0"


E:\eclipse-workspace\jfinal01\target\jfinal01-release\jfinal01>rem set "JAVA_OPT

S=-Dundertow.port=80 -Dundertow.host=0.0.0.0"


E:\eclipse-workspace\jfinal01\target\jfinal01-release\jfinal01>set APP_BASE_PATH

=E:\eclipse-workspace\jfinal01\target\jfinal01-release\jfinal01\


E:\eclipse-workspace\jfinal01\target\jfinal01-release\jfinal01>set CP=E:\eclipse

-workspace\jfinal01\target\jfinal01-release\jfinal01\config;E:\eclipse-workspace

\jfinal01\target\jfinal01-release\jfinal01\lib\*


E:\eclipse-workspace\jfinal01\target\jfinal01-release\jfinal01>java -Xverify:non

e  -cp E:\eclipse-workspace\jfinal01\target\jfinal01-release\jfinal01\config;E:\

eclipse-workspace\jfinal01\target\jfinal01-release\jfinal01\lib\* config1.DemoCo

nfig

错误: 找不到或无法加载主类 config1.DemoConfig


E:\eclipse-workspace\jfinal01\target\jfinal01-release\jfinal01>endlocal   & popd



E:\eclipse-workspace\jfinal01\target\jfinal01-release\jfinal01>pause

请按任意键继续. . .


评论区

JFinal

2020-02-28 17:23

文档中有过强调说明,你的启动脚本的换行字符被你自己改动过, windows 下需要 "\r\n", 而不能是 "\n"

注意看文档脚本无法使用问题:
https://jfinal.com/doc/1-5

yuwen01

2020-02-29 09:18

@JFinal 波总,我查看了启动脚本,里面换行符都是两个字符,但是还是启动不了,错误: 找不到或无法加载主类 config1.DemoConfig

JFinal

2020-02-29 11:32

@yuwen01 检查打出来的那个 "主jar包" 中是否有 config1 目录,以及该目录下是否存在 DemoConfig.class 文件

yuwen01

2020-02-29 15:53

@JFinal 波主,我查看了E:\eclipse-workspace\jfinal01\target\jfinal01-release\jfinal01\lib下面,没有发现主jar包jfinal01-4.8.jar,这可能是什么原因导致的?

JFinal

2020-02-29 17:01

@yuwen01 pom.xml 配置不对, 注意参考首页的 jfinal demo 中的 pom.xml 配置

yuwen01

2020-02-29 17:20

@JFinal 波总您好!因为回复限制代码粘贴,我另外开了一个反馈,非常感谢波总指点迷津!