Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8262867
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T03:54:00+00:00 2026-06-08T03:54:00+00:00

public static void main(String args[]) throws IOException { Process p = Runtime.getRuntime().exec(java E:/workspace/JNIProgram/src/JNIProgram.class); }

  • 0
public static void main(String args[]) throws IOException
{
    Process p = Runtime.getRuntime().exec("java E:/workspace/JNIProgram/src/JNIProgram.class");
}   

so I have this code and am trying to run the JNIProgram.class file however the program gets terminated instantly without doing its job (which is to create a new txt file and write to it)

So what am I doing wrong

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T03:54:02+00:00Added an answer on June 8, 2026 at 3:54 am

    The java command expects a Java class name, not a filename.

    So the command java E:/workspace/JNIProgram/src/JNIProgram.class is wrong. If you try this manually from a command prompt window you’ll get an error message.

    The command should be something like this:

    java -cp E:\workspace\JNIProgram\src JNIProgram
    

    Note: What’s after the -cp option is the classpath, and after that the fully-qualified class name (which is just JNIProgram, if the class is not in a package).

    First make sure that you can run the command manually from the command line before you make it work from another Java program.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

import java.io.*; public class TerminateWhen { public static void main(String args[]) throws IOException {
public static void main(String[] args) throws IOException, URISyntaxException,TransformerException { TransformerFactory factory = TransformerFactory.newInstance(); String
import java.io.*; import java.util.*; public class Readfilm { public static void main(String[] args) throws
Code:public class duplicate { public static void main(String[] args)throws IOException { System.out.println(Enter words separated
My code is as such: public static void main(String args[]) throws IOException { String
I have a problem with this code public static void main(String[] args) throws IOException,
public class readBin { public static void main(String[] args) throws IOException{ long time1 =
public static void main(String[] args) throws IOException { String st3[]=new String[]{сто, двести, триста, sdf,
This is my code... class info{ public static void main (String[]args) throws IOException{ char
class Test { public static void main(String[] args) throws Exception { Test t =

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.