[PYTHON] Jupyter Study Note_002

How to compile and run Java on Google colab

This can be achieved by following the steps below.

--Connect to Google colab and connect to Google drive

test1.py


#Mount google drive
from google.colab import drive
drive.mount('/content/drive')

--Processing until sample source execution

test2.py


#Set the current directory
import os
import shutil
os.chdir('/content/drive/My Drive/Java_sample')
path_name = os.getcwd()

#Upload the source and copy it to the specified folder
file_name = '/HelloWorld.java'
path_all = path_name + file_name
print(path_all)
shutil.copy(file_name, path_name)

#Compile and run Java source with commands
!javac HelloWorld.java
!java HelloWorld

--The two are separated for testing by a mechanism called a cell. (Implementation result) 実施結果

Recommended Posts

Jupyter Study Note_002
Jupyter Study Note_003
Jupyter Study Note_007
Jupyter Study Note_005
Python study note_002
Jupyter study notes_006
Python study note_004
Python study note_003
Jupyter study notes_008
Jupyter study notes_004
Jupyter study notes_001
Note
Note
Note
[WIP] Fluent Python Study Note
Study Note 9_Install Jenkins on CentOS7
Django note 4
pyenv note
Jupyter begins
Jupyter Tips 4
GroupBy Note
Jupyter nbextensions
Jupyter Tips 5
"Python Machine Learning Programming" Summary Note (Jupyter)
Jupyter Tips 3
argparse note
Django Note 5
Note: Python
Ansible Note
Jupyter installation
Jupyter tricks
Python note
Django Note 1
direnv note
Django note 3
Django note 2
[Note] RepresenterError
Install and set Jupyter Notebook to create a study note creation environment [Mac]