Hamilton-Jacobi equation with a second-order Lagrangian The Hamilton-Jacobi equation is:
\begin{equation}
H\left(q,\frac{\partial S}{\partial q},t\right)+\frac{\partial S}{\partial t}~=~0,
\end{equation}
where $S$ is Hamilton's principal function.
If we take a second-order $L$ such that $$L=L(\{q_j,\dot{q}_j,\ddot{q}_j\},t),$$ does the Hamilton-Jacobi equation change, or we could always consider that $\displaystyle\frac{\partial S}{\partial t}=-H$?
 A: I) Let us suppress explicit time dependence $t$ from the notation in the following. Let there be given a second-order Lagrangian
$$L(q,v,a); \tag{1}$$ 
where $q^i$ are positions, $v^i$ are velocities, $a^i$ are accelerations, and where $i\in\{1,\ldots,n\}$. 
II) We would like to find the corresponding Ostrogradsky Hamiltonian formulation. Let us for simplicity assume that the Hessian
$$ H_{ij}~=~\frac{\partial^2L}{\partial a^i\partial a^j} \tag{2}$$
is invertible.$^1$ Then the Ostrogradsky Hamiltonian is defined as
$$ H(Q,P)~:=~ p_iv^i + \sup_a\left(\pi_i a^i-L(q,v,a)\right) ,\tag{3}$$  
where we have introduced the collective notation
$$Q^I~=~\{q^i;v^i\},\qquad  P_I~=~\{p_i;\pi_i\},\qquad 
I~\in~\{1,\ldots,2n\}.\tag{4} $$
III) In the spirit of my Phys.SE answer here, we introduce an extended Lagrangian$^2$
$$ L_E(Q,\dot{Q},P,a)~:=~p_i(\dot{q}^i-v^i)+\pi_i(\dot{v}^i-a^i)+L(q,v,a)\tag{5}$$
If we integrate out $P_I$, $v^i$ and $a^i$ in the extended Lagrangian (5), we get back the Lagrangian itself
$$ L(q,\dot{q},\ddot{q})\tag{6} .$$
If we only integrate out $a^i$ in the extended Lagrangian (5), we get the Ostrogradsky Hamiltonian Lagrangian
$$ L_H(Q,\dot{Q},P)~:=~P_I\dot{Q}^I - H(Q,P).\tag{7}$$
This implies that the higher-order Euler-Lagrange (EL) equations of (5) is equivalent to a standard Hamilton's equations in $Q^I$ and $P_I$! In other words, in the non-singular case (2), we can re-use the standard Hamilton-Jacobi (HJ) theory for this case! The only difference is that the phase space (4) is twice as big.
--
$^1$ If the Hessian matrix is singular, there will appear constraints, and the Hamiltonian formulation and the Hamilton-Jacobi theory become modified as a result.
$^2$ If we vary  the extended Lagrangian (5) wrt. to $a^i$ and $v^i$, we get the Ostrogradsky momenta
$$ \pi_i~\approx~\frac{\partial L}{\partial a^i} ,\tag{8} $$
and
$$ p_i ~\approx~\frac{\partial L}{\partial v^i}- \dot{\pi}_i~\approx~\frac{\partial L}{\partial v^i}- \frac{d}{dt}\frac{\partial L}{\partial a^i} ,\tag{9} $$
respectively. [The $\approx$ sign means equality modulo equations of motion.]
