전체 글
-
자바코드는 어떻게 실행되는가? <2>언어/자바 2023. 12. 18. 17:30
앞의 글에서 연결되는 글입니다. JDK와 JRE의 다른 점을 체감할 수 있는 예제를 살펴볼 것입니다. 결론 JDK를 설치하면 JRE + javac를 비롯한 개발에 필요한 많은 것들이 함께 설치되어 코드 작성과 컴파일 실행이 모두가능. JRE만 설치하면 실행환경만 설치되기 때문에 컴파일이나 다른 개발에 필요한 작업들을 할 수가 없다. JDK와 JRE를 어떻게 다른가? 이전 글에서 알아봤던 JDK와 JRE를 직접 설치해보고, 어디에 설치되는지? 어떤 모습인지 확인해보자. 다음과 같은 시나리오로 가지고 진행해보자. 1. 자바가 설치되어있지 않은 나의 컴퓨터에서 자바 코드를 작성한다. 2. 작성된 코드가 정상 실행되는지 확인한다. 3. 친구의 컴퓨터에도 자바가 설치되어있지 않다. 4. 자바로 작성된 코드를 친구..
-
자바코드는 어떻게 실행되는가? <1>언어/자바 2023. 12. 18. 16:49
1. 자바 코드 실행시켜보기 일단 작성된 자바코드가 어떻게 실행되는지 살펴보겠습니다 우선 NewWorld.java 파일을 생성하고 NewWorld class를 만들었습니다 자바 코드를 실행시키려면 bytecode의 형태가 되어야하니까 컴파일러를 이용해서 bytecode를 만들어보겠습니다 javac NewWorld.java 명령어를 실행시키니, NewWorld.class 파일이 생성되었습니다 기계어 같은 모습일 것이라 생각했는데, 생각보다 기존 코드랑 크게 다르지 않은 것 같은 byte-code입니다. 이제 class 파일을 jvm에 넘겨주면 실행될 것이라고 생각했는데, 쉽게 되지 않습니다.. (파일의 확장자명을 빼고 실행시키니 작동하는군요.. java NewWorld ) 2. 자바 컴포넌트 그럼 이제 조..
-
She # bang !CS/시스템 프로그래밍 2023. 12. 17. 00:10
자주 눈에 보이지만 그냥 써야되나보다 하고 지나갔던 것을 짚어봅니다. 스프링 프로젝트를 설치하는 스크립트를 작성하다가 의문이 들어서 찾아보게 되었습니다. 1. Shebang이란? 스크립트 파일 맨 첫줄에 적는 이건 뭐지? 주석인가? #!/usr/bin/env bash 우선 이 줄의 명칭은 shebang입니다. 왜냐하면 #! 으로 시작하기 때문입니다~ 커뮤니티에서 #을 she 혹은 hash 라고 부르고 !을 bang이라고 부르는 것에서 유래한다고 하네요. 2. 역할 해당 파일이 어떤 실행기를 통해서 실행되어야하는지를 명시하는 역할입니다. 한번 자세하게 살펴볼까요? /usr/bin/env bash 잘은 모르겠지만 env 하면 환경변수 관련 내용일 것 같은 느낌입니다. 위 경로에 가보면 실제로 env라는 실행..
-
명령어 idea . 으로 intellij 실행이 안될 때기타/IDE 2023. 12. 16. 16:58
이번 이슈는 기존에 설치되어있는 intellij 2022 버전을 터미널에서 idea로 실행가능하게 설정해두었는데, 그것을 잊고 2023 버전을 새로 받으면서 idea로 실행이 안되었던 이슈입니다 ㅎㅎㅎ 검색으로 toolbox를 사용해야 터미널에서 실행이 된다고 하는 글들을 보아서 바로 toolbox를 설치했습니다. ( 하지만 toolbox 없어도 사용 터미널 실행가능) https://www.jetbrains.com/help/idea/working-with-the-ide-features-from-command-line.html#toolbox 링크 따라서 세팅하고 idea . 을 실행했는데 아래와 같은 에러를 줍니다. /Applications/IntelliJ-ce.app cannot be opend ......
-
Tree 란?CS/자료구조 2023. 10. 28. 20:13
요즘 프로그래밍을 공부하는 사람들을 만나면, 다들 '자료구조 = 코딩테스트 준비' 라는 생각을 하고 있는 것 같습니다. 저는 수학에 사칙연산이 기본이라면, 코드를 작성할 때는 자료구조가 그 역할을 한다고 생각하는데요. 일하면서 트리에 익숙하지 않아서 고생했던 적들이 있어서, 트리에 관한 글을 써보려고 합니다. 1. Tree 란? 트리는 노드(Node)와 간선(Edge)로 이루어져있고, 순환이 존재하지 않는 계층적 자료 구조입니다. 간단하게 생각해보면, 트리는 이름에서 알 수 있듯이 나무를 뒤집어 놓은 모양입니다. 하나씩 살펴보면, 노드(Node)를 가지가 뻗어져 나오는 마디라고 생각하고 간선(Edge)을 마디라고 생각하면 좋을 것 같네요. 그리고 순환이 존재하지 않는다는 것은 노드가 자기 자신을 다시 방..
-
프로세스와 스레드의 실행 방식CS/운영체제 2023. 10. 22. 16:51
글을 시작하기에 앞서, 이 글은 유튜브 영상을 기반으로 학습을 위해 정리한 글이라는 점 말씀드립니다. 더 정확하고 알찬 설명은 아래의 영상을 보시기를 권해드립니다. 쉬운코드 - 프로세스, 스레드, 멀티태스킹, 멀티스레딩, 멀티프로세싱, 멀티프로그래밍, 이 모든 것을 한 방에 깔끔하게 설명합니다!! 콘텐츠 퀄리티 만족하실 겁니다! https://www.youtube.com/watch?v=QmtYKZC0lMU&list=PLcXyemr8ZeoQOtSUjwaer0VMJSMfa-9G-&ab_channel=%EC%89%AC%EC%9A%B4%EC%BD%94%EB%93%9C "컴퓨터를 사용한다"는 문장의 뜻 우리가 컴퓨터를 사용한다고 하면 대개 컴퓨터에 설치되어있는 프로그램을 사용하는 것을 이야기한다. 위 문장을 행동..
-
1. 동시성과 병렬성책/7가지 동시성 모델 2023. 10. 22. 13:55
1. 동시성과 동시성 프로그래밍 저는 새로운 용어를 만나면 우선 영어 사전에서 뜻을 찾아보는 것을 좋아합니다. Concurrency the fact of two or more events or circumstances happening or existing at the same time. "the unfortunate concurrency of both high debt and high unemployment" "한 순간에 두개 이상의 이벤트가 존재하는 것" 이라고 이야기하고 있네요. 현실 세계에서는 한 순간에 두개 이상의 이벤트가 존재하는 것이 아주 당연한 일이겠지만, 컴퓨터(CPU)의 입장에서 생각해보면 어떨까요? 우선 컴퓨터가 1코어 CPU를 가지고 있다고 가정한다면, 컴퓨터 입장에서는 불가능한 일..