Smith
Smith

Reputation: 148

Java command not found in Airflow

Hi have successfully installed airflow in window system using Linux subsytem.

I have already intsalled java and set its home path in enviroment variable. usually i can run any java program from the command line.

I am try to run java program using airflow code. but i am getting error java command is not found.

The below code i am using for airflow.

import airflow
from airflow import DAG
from airflow.operators.bash_operator import BashOperator
from datetime import datetime
import os
import sys



args = {
  'owner': 'airflow',
  'start_date': datetime(2017, 1, 27),
  'provide_context': True
}
d = datetime(2019, 9, 1)


dag = DAG('usgs', start_date = d, schedule_interval = '@daily', default_args = args)

t_main = BashOperator(
  task_id = 'usgs_fetch',
  dag = dag,
  bash_command = 'java -jar /mnt/D/testProjects/reporting_platform/classes/artifacts/reporting_platform_jar/pp_platform.jar'
  )

please help here i am new in airflow scheduler.

Upvotes: 2

Views: 1254

Answers (1)

Smith
Smith

Reputation: 148

Hi i am writing answer to my question, i have to install java as well on linux subsystem of windows.

also need to set the JAVA_HOME in linux subsystem.

Thanks

Upvotes: 1

Related Questions