태그별 글 목록: 자바

Visual Studio Code에서 JAVA Compile

Language Support for Java(TM) by Red Hat File -> Open Folder New File name.java 로 파일 생성 View -> Integrated Terminal 직접 컴파일, 실행할 수 있음. 디버거가 필요하다면… Debug -> Start Debugging Java Debugger 설치도 가능.

더 읽기 »

Apache Struts: 정말 간단한 로그인 구현(Struts 2.0.14)

간단한 로그인 구현. 먼저 UserVo.java 생성 CREATE TABLE user ( id varchar(25) NOT NULL, pw varchar(45) NOT NULL, PRIMARY KEY (id) ) ENGINE=InnoDB DEFAULT CHARSET=utf8 (데이터베이스에는 위와 같이 생성한다. 미리 id, pw를 적절히 넣어 두자.) UserDao.java 를 만들어서, 추후에 myBatis(iBatis)에서 매핑된 쿼리의 결과를 객체로 저장(리스트가 아니기 대문에 queryForObject()를 사용하면 된다.) User.xml을 만들어서 DB 쿼리 결과를 저장. SqlMapConfig.xml에서 새로 추가한 User.xml …

더 읽기 »

Apache Struts: Action Class(Struts 2.0.14)

도서: http://www.yes24.com/24/goods/3533040 액션 클래스 액션 클래스는 스트럿츠 2가 액션을 실행하기 위한 엔트리 포인트이다. 기본 액션 메소드는 묵시적으로 execute()로 지정되 있다. execute() 메서드의 리턴 값인 문자열(String)은 액션 실행이 끝난 후 어떤 리절트를 실행할지를 결정하기 위해 사용된다. 액션 메소드가 반환하는 이 문자열 값을 ‘리절트 코드’라 부른다. 위 에에서는 execute() 메소드가 message 변수에 “Hello World!”란 메시지를 설정하고 난 후 “success”를 반환 값으로 되돌린다. …

더 읽기 »

Apache Struts: Hello World!(Struts 2.0.14)

https://archive.apache.org/dist/struts/binaries/ 에서 struts-2.0.14-all.zip 파일을 내려받는다.(엄청 오래 걸림 -_-;;) commons-logging-1.0.4.jar freemarker-2.3.8.jar ognl-2.6.11.jar struts2-core-2.0.14.jar xwork-2.0.7.jar 파일을 미리 다른 곳에 빼놓는다. Dynamic Web Project 만들기 이름을 적고, 다음 web.xml 만들기 /WebContent/WEB-INF/lib 폴더에 위에서 선택한 파일을 붙여 넣는다. web.xml에 필터를 등록함. <?xml version="1.0" encoding="UTF-8"?> <web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://xmlns.jcp.org/xml/ns/javaee" xsi:schemaLocation="http://xmlns.jcp.org/xml/ns/javaee http://xmlns.jcp.org/xml/ns/javaee/web-app_3_1.xsd" id="WebApp_ID" version="3.1"> <display-name>HelloWorld</display-name> <welcome-file-list> <welcome-file>index.html</welcome-file> <welcome-file>index.htm</welcome-file> <welcome-file>index.jsp</welcome-file> <welcome-file>default.html</welcome-file> <welcome-file>default.htm</welcome-file> <welcome-file>default.jsp</welcome-file> </welcome-file-list> <filter> <filter-name>struts2</filter-name> <filter-class>org.apache.struts2.dispatcher.FilterDispatcher</filter-class> </filter> …

더 읽기 »

Java: 원격 서버에 소스코드 배포하고 실행하기(Git, Github, Maven)

https://www.youtube.com/watch?v=N8iLAuAo-Qw 소스코드를 원격서버에 배포 : 참고하여 진행함 먼저 Git 설치 확인 git –version 저장소 clone 주소 복사. 디렉터리를 만들고… git clone 잘 들어왔다. maven 패키지 확인 maven 패키지 설치(관련글: https://www.mkyong.com/maven/how-to-install-maven-in-ubuntu/ ) 버전 확인. mvn clean package (빌드를 위해 필요한 자료를 다운로드) 처음이라 2분 넘게 걸림. 다시 한 번 실행. 다운로드 과정이 없어 19초만에 끝남. 프로젝트의 .jar 파일이 같이 실행되어야 하므로.. …

더 읽기 »

launch4j: create executable Java program(Java Swing project)

http://launch4j.sourceforge.net/ 에서 3.9버전을 다운로드했음. Launch4j 3.9 완료. Launch4j 3.9는 잠시 최소화해 놓습니다. Eclipse에서 백업하기 원하는 프로젝트 -> Run As -> Run Configurations… Java Application에서 어떤 이름으로 Run Configuration이 저장되어 있는지 보면 됩니다. Eclipse에서 File -> Export run을 검색해서 Runnable JAR file 선택 Launch configuration에서 프로젝트를 선택, Export destination에 .jar 파일을 만들기 원하는 위치를 지정해준다. OK 만들어진 .jar 파일을 실행하면… 프로그램이 …

더 읽기 »

Java Web Project: Open source Calendar software

Java Planner 자바, JSP, 톰캣, MySQL 활용한 오픈소스 캘린더 홈페이지: http://javaplanner.com/index.html 데모: http://javaplanner.com/live-demos.html 기능: http://javaplanner.com/features.html 가격: http://javaplanner.com/license.html 문서: http://javaplanner.com/docs/index.html 기타 링크: http://xx707xx.tistory.com/category/JSP (튜토리얼) http://blog.javaplanner.com/java-calendar-video-tutorial/ (동영상 튜토리얼!) ZK Calendar 캘린더 외에도 다양한 제품이 존재하는 ZK Framework 기반 캘린더. ZK Framework은 웹 및 모바일 애플리케이션 구축을 위한 생산성이 높은 오픈 소스의 자바 웹 프레임워크임. 홈페이지: https://www.zkoss.org/product/zkcalendar 문서: https://www.zkoss.org/wiki/ZK_Calendar_Essentials 데모: https://www.zkoss.org/zkcalendardemo/ 다운로드: https://github.com/zkoss/zkcalendar/releases …

더 읽기 »

Apache Tomcat 8.0 설치 + Eclipse 연결

이번에는 JSP, Servlet 사용을 위한 Tomcat 8.0 + Eclipse 연계 방법을 알아봄. http://tomcat.apache.org/download-80.cgi 에서 Windows Service Installer 다운로드(8.0.x) next I Agree Next 포트 확인 후 Next Next Install Run Apache Tomcat… 조금 기다립니다. 알림 영역의 Apache Tomcat 9.0 아이콘을 더블클릭. 서비스를 중지합니다. Eclipse에서 Window -> Open Perspective -> Other… Java EE를 선택, OK Window -> Preferences Runtime Environments Apache Tomcat …

더 읽기 »

JAVA: Eclipse 첫 사용

프로젝트 단위의 제대로 된 자바 프로그래밍을 할 때 사용 Open Perspective -> JAVA를 선택 우측상단에 Java 개발버튼보임 자바 프로젝트 만들기 JRE 버전 등을 선택 가능 자바 라이브러리들. Add External JARs를 눌러 외부 프레임워크를 추가할 때가 있다.   프로젝트가 만들어짐 클래스 추가 Finish를 눌러 진행   파일이 만들어짐.   소스코드에서 Source -> Generate Constructors from Superclass…   기본값대로 OK   기본 …

더 읽기 »

JAVA: 진법과 자료형

class CharToCode { public static void main(String[] args) { char ch=’A’; // char ch=65; int code = (int)ch; // ch to int type   System.out.printf(“%c=%d(%#X)%n”, ch, code, code);   char hch=’a’;// 97; System.out.printf(“%c=%d(%#X)%n”, hch, (int)hch, (int)hch); } } // find the korean windows     class OverflowEx { public static void main(String[] args) { short sMin = -32768; short sMax …

더 읽기 »