나는 그것을 내 보내면 실행 가능한 항아리 인 Eclipse에서 Java 프로젝트를 만들었습니다.
내 프로젝트의 구조 :
내 프로젝트를 실행 가능한 jar로 내보낼 때 종속성을 패키지화하는 방법을 묻고 lib 폴더에 넣도록 선택합니다. 따라서 내보낼 때 실행 가능한 jar를 내보내고 Referenced 라이브러리에있는 5 개의 jar만이되기를 원하는 종속 jar 파일이있는 하위 폴더를 만듭니다.
이것은 내보내기 창입니다.
이것은 내 실행 가능한 항아리를 만든 다음 다른 항아리와 함께 _lib 폴더를 만듭니다.
이것은 잘 작동하지만 첫 번째 이미지에서 볼 수 있듯이 tomcat lib의 일부 jar 파일이 내 프로젝트에서 사용되기 때문에 Tomcat lib 라이브러리도 포함했습니다.
The problem is that when I export, all the jar files in the tomcat lib get exported to my sub lib folder which I do not want.
Basically I want to deploy my runnable to a server witch will get the dependent jar files from the sub directory lib only those 5 jar files in image (Referenced Libraries). Tomcat is installed on the server so it should point to tomcats lib to get the rest of the jars.
Want my project to use the generated lib folder and then the tomcat lib.
Hope it makes sense what I am trying to ask.
Using Eclipse and java 1.7. developing on windows, deploying to linux running the application via command line on linux box.
What I have done to get this working is on the linux side to start the java runable class another way by specifying the classpath this will give the class you are trying to run the ability to first check the folders that you specify. So in my example instead of executing my app on the linux box with the following :
nohup java -jar /usr/local/P6/StockListShunter/StockListShunter.jar &
I did the following and specified the Class path lib that java should check for .jar file dependencies :
nohup java -classpath :/usr/mylib1/*:/usr/StockListShunter_lib/*:/usr/share/lib/*: stockListShunter.Shunter &
Notice I specified 3 libraries java should check when running my runable class, mylib1,StockListShunter_lib and lib.
After you specified the classpath you will see you need to specify your java class witch will be your main method class. In my example it is stockListShunter.Shunter
where stockListShunter is my package name.
실행하려는 클래스가 클래스 경로에 지정한 jar 파일 중 하나에 포함되어 있는지 확인해야합니다. 그렇지 않으면 클래스를 찾을 수 없으며 오류가 발생합니다. Error: Could not find or load main class stockListShunter.Shunter
따라서 명령을 실행하면 프로세스가 시작되고 내 프로그램은 루프에 있으므로 프로세스는 내가 죽일 때까지 살아있을 것입니다. 프로그램이 활성 상태 여야하는 경우 다음 명령을 실행하여 실행 중인지 확인할 수 있습니다.
ps aux | grep stockListShunter.Shunter
stockListShunter.Shunter
메인 클래스 이름은 어디에 있습니까 ? 명령에 stockListShunter.Shunter가있는 모든 프로세스가 표시되어야합니다.
루프에있는 것과 같은 프로세스를 종료하려면 다음 명령을 실행할 수 있습니다.
pkill -f 'java.*stockListShunter.Shunter'
다시 stockListShunter.Shunter
메인 클래스 이름은 어디에 있습니까 ? 이것은 당신의 자바 프로세스를 죽일 것입니다.
이것이 미래에 도움이 될 수 있기를 바랍니다.
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다