
24 N.J. Super. 209 (1953)
94 A.2d 207
IN THE MATTER OF THE APPLICATION OF JOHN ROBILOTTO FOR A WRIT OF HABEAS CORPUS.
Superior Court of New Jersey, Appellate Division.
Argued December 22, 1952.
Decided January 16, 1953.
*210 Before Judges EASTWOOD, GOLDMANN and FRANCIS.
Mr. James A. Major argued the cause for appellant John Robilotto (Mr. Joseph H. Gaudielle, attorney).
Mr. Ellis M. Kopp, Deputy Attorney-General, argued the cause for the State of New Jersey (Mr. Harry L. Towe, Acting Prosecutor of Bergen County, attorney).
PER CURIAM.
At the September 1951 session the Bergen County grand jury returned an indictment against John Doe, Richard Roe, Harry Hoe, Joseph Doe and John Roe, charging them with the murder of one, William Moretti. On July 21, 1952 the State applied to a county judge of that county for leave to amend the indictment to substitute the name of John Robilotto, alias Johnny Roberts, alias Johnny Richards, in the place of Joseph Doe. The motion was granted and the court orally instructed a deputy county clerk to strike out the name of Joseph Doe in ink and insert Robilotto's name.
Subsequently Robilotto was extradited from the State of New York, and on August 1, 1952 he was arraigned in the Superior Court, Bergen County. There he entered a plea of not guilty and reserved the right to move to dismiss the indictment.
On August 19, 1952 a motion to dismiss was made to a county judge other than the one who permitted the amendment of the indictment. This judge deemed it inappropriate to review the action of his colleague, who was on vacation at the time, so he denied the motion exclusively on that ground, thus leaving the avenue open for the presentation of the matter *211 to the appropriate judge. Instead of pursuing that course, an application was made to this court for leave to appeal. The application was denied on September 8, 1952 because the order had made no determination of the merits of the motion to dismiss the indictment and consequently there was nothing from which an appeal could be taken.
During the oral argument of the application we informed counsel that the way was open for him to present the attack upon the indictment to the judge who granted amendment. During the same argument we inquired of the prosecutor if there was anything which stood in the way of re-submitting the complaint to the grand jury and seeking a new indictment. And we were informed that there was not.
In any event, no such motion to dismiss was made by Robilotto, nor did the prosecutor seek a new indictment. Instead, a writ of habeas corpus was sought and obtained from the assignment judge in an effort to review the validity of the indictment, and of the order granting the amendment, on the theory that the custody was illegal. On September 11, 1952, after argument, the writ was discharged but Robilotto was ordered released on $25,000 bail.
The record presently before us does not disclose the reason for the release on bail. However, we were advised on the oral argument that at the habeas corpus proceeding the prosecutor deemed it inadvisable to make such disclosure of his evidence as would demonstrate that Robilotto was not bailable within the meaning of Rule 2:9-1.
Robilotto now appeals from the dismissal of the writ of habeas corpus.
At the outset it should be pointed out that the extraordinary writ of habeas corpus cannot be used to accomplish the purpose sought here. Under Rule 2:5-3(a) and (b) the validity of an indictment is to be tested by a motion to dismiss, and the orderly administration of the criminal law requires that it be done in that manner. The writ of habeas corpus is not designed as a substitute for routine and completely adequate rules of practice. Nor is it designed *212 to serve the office of an appeal. In re Davis, 107 N.J. Eq. 160, 170 (Ch. 1930); Johnson v. Hoy, 227 U.S. 245, 33 S.Ct. 240, 57 L.Ed. 497 (1913); 25 Am. Jur., Habeas Corpus, sec. 17, 20.
In In re Davis, supra, the Chancellor said:
"The writ of habeas corpus lies where imprisonment is illegal and no other remedy is available to secure release therefrom. As in the case of other extraordinary prerogative writs, the writ of habeas corpus will not ordinarily be granted where there is another adequate remedy by appeal or writ of error or otherwise. 29 Corp. Jur. 17. While want of jurisdiction is ground for relief by habeas corpus, this is subject to the rules as to discretion in the issuance of the writ and the rule against interference with pending proceedings where there is an adequate remedy by trial and appeal or error in ordinary course. Where the court has general jurisdiction of the cause and the person, error in the determination of the questions of law or fact upon which its jurisdiction in the particular case depends, is error in the exercise of jurisdiction, and in accordance with the general rule, affords no grounds for habeas corpus. Ibid. 32 Where an attempt has been made to charge an offense of a kind over which the court has jurisdiction, mere inartificiality in pleading or defects or irregularities in, or insufficiency of, indictment, information or complaint constitute no ground for relief by habeas corpus, because under such circumstances the detention is not without jurisdiction and is therefore not illegal although it may be erroneous. Relief for error or irregularity must be had by appeal, writ of error or other proceedings for review, or by application to the trial court in which the charge is pending."
Moreover, in the present state of the proceedings, no appeal will lie from the order of the assignment judge. The office of the writ of habeas corpus is to secure the release of the applicant from custody. State v. Cynkowski, 19 N.J. Super. 243, 249 (App. Div. 1952). Having accomplished its purpose to the advantage of the prisoner, it has spent itself. A person accused of crime, who is on bail, is not imprisoned or restrained of his liberty, so as to justify resort to habeas corpus. Stallings v. Splain, 253 U.S. 339, 40 S.Ct. 537, 64 L.ed. 940 (1920); Annotation 14 A.L.R. 344; 25 Am. Jur., Habeas Corpus, sec. 24; and cf. In re Markus, 104 N.J. Eq. 513 (Ch. 1929).
*213 Further, attention is called to the fact that an order adverse to an accused who attacks an indictment as invalid is not a final order or judgment. Consequently no appeal is permitted as a matter of right. Rules 4:2-1, 2:5-3(b) (6) (a).
For these reasons the appeal is dismissed.
