터미널과 직접 상호 작용하지 않고 .java 파일/응용 프로그램을 컴파일하고 실행하는 프로세스를 자동화 할 수있는 AppleScript 온라인을 찾았습니다. 터미널을 사용하여 컴파일하고 실행하는 방법을 알고 있지만 Windows 용 TextPad 에서처럼 BBEdit에서 직접 컴파일하거나 실행할 때 훨씬 편리합니다. 모든 파일에 대해 프로젝트를 만들고 싶지 않기 때문에 IDE를 사용하지 않을 것입니다. BBEdit .java 파일을 컴파일하는 Applescript가 올바르게 경로를 설정하지 못합니다.
-- BBE Java Compiler v0.1
--
-- IMPORTANT:
-- You need to change the Java version to the version you want to use!
-- This is defined in "term_compile" below,
-- and currently set to 1.6
--
-- nanotux.com
tell application "BBEdit"
set the_file to file of text document 1
end tell
set AppleScript's text item delimiters to ":"
set source_file to the last text item of (the_file as string)
set compiled_file to text 1 thru -6 of source_file
tell application "Finder"
set the_folder to container of the_file as alias
end tell
tell application "Terminal"
activate
-- clear the current terminal window
set term_clear to "clear "
-- cd to the folder containing your file
set term_cd to "cd " & (quoted form of POSIX path of the_folder)
-- compile the .java file with a choosen version of Java
set term_compile to "javac -source 1.7 " & source_file
-- ^^ change to your Java version!
tell application "Terminal"
if (count windows) is 0 then
do script term_cd
do script term_clear in the front window
do script term_compile in the front window
else
do script term_cd in the front window
do script term_clear in the front window
do script term_compile in the front window
end if
activate
end tell
end tell
내가 1.7 Java 버전을 변경,하지만 난 기본적으로 파일의 경로가 올바르지 않은 것을 말하고, 내가 생각하는 것이 오류를 받고 있어요 : 여기 내가 찾은 스크립트입니다. 참고로, 여기에 내가받은 오류의 실제 사진이 있습니다.
은 언제나, 어떤 조언을 많이 감사합니다.
감사합니다.
편집 :
가오류 매킨토시 HD "파일 \의«클래스 ctnr»할 수 없습니다": 사용자 : userwitheld : 문서 : 학교 : 2013 년 가을이 내가 애플 스크립트 오류 로그에 무엇을 얻을 : CINS 136 : S08 : MyType.java \ "를 입력 별칭으로." 파일의«클래스 ctnr의»에서 수 -1700 "매킨토시 HD : 사용자 : userwitheld : 서류 : 학교 : CINS 136 : S08 : 2013 가을 MyType.java"별명에