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 6119657
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T15:34:42+00:00 2026-05-23T15:34:42+00:00

I have a Java application and a NSIS script . I need to run

  • 0

I have a Java application and a NSIS script. I need to run the NSIS script via Java code at runtime. I know the following code is used for runtime execution.

Process p = Runtime.getRuntime().exec();

My problem is i don’t know how to execute my script with in exec(). if anyone please tells me how I use this script with in my exe.

My NSIS script is:

OutFile "Your ComputerName.exe"
Name "Your ComputerName"
Caption "ComputerName"
XPStyle "on"

Function .onInit
  ReadRegStr $0 HKLM "System\CurrentControlSet\Control\ComputerName\ActiveComputerName" "ComputerName"
  StrCmp $0 "" win9x
  StrCpy $1 $0 4 3
  MessageBox MB_OK "Your ComputerName : $0" 
  Goto done
win9x:
  ReadRegStr $0 HKLM "System\CurrentControlSet\Control\ComputerName\ComputerName" "ComputerName"
  StrCpy $1 $0 4 3
  MessageBox MB_OK "Your ComputerName : $0" 
done:
  Quit ; placed here so we quit the installer; we dont need the other pages for this example.
FunctionEnd

Section "-boo"
;
SectionEnd

; rest of script

Thanks in Advance..

Hi i use the following java code:

import java.io.IOException;


public class SampleClass {

    /**
     * @param args
     */
    Process p;
    public static void main(String[] args) {
        // TODO Auto-generated method stub
        Runtime r=Runtime.getRuntime();
        try {
            r.exec("makensis.exe myscript.nsi");
        } catch (IOException e) {
            // TODO Auto-generated catch block
            e.printStackTrace();
        }
    }

}

and my NSIS script is same as above, while i’m executing i got the following error,\

java.io.IOException: Cannot run program "makensis.exe": CreateProcess error=2, The system cannot find the file specified
    at java.lang.ProcessBuilder.start(Unknown Source)
    at java.lang.Runtime.exec(Unknown Source)
    at java.lang.Runtime.exec(Unknown Source)
    at java.lang.Runtime.exec(Unknown Source)
    at SampleClass.main(SampleClass.java:14)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
    at java.lang.ProcessImpl.create(Native Method)
    at java.lang.ProcessImpl.<init>(Unknown Source)
    at java.lang.ProcessImpl.start(Unknown Source)
    ... 5 more

Why it happens how to resolve this error?????

  • 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-05-23T15:34:43+00:00Added an answer on May 23, 2026 at 3:34 pm

    I’m not familiar with NSIS script, but quick Googling showed me I can run the NSIS script like this in command prompt:makensis.exe myscript.nsi

    So in java you can do this:

     Process p = Runtime.getRuntime().exec("makensis.exe myscript.nsi")
    

    then you can use p to get the stdout and stderr text of the execution result. For this to work though you have to make sure makensis.exe is under the directory in your PATH environmental variable.

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

Sidebar

Related Questions

I have a java application in which i need to run the commands as
I have a java application I need to pass some info to a C++
I have a Java application which needs to be audited (so obviously I need
I have Java application which adds JTextFields @ runtime to JPanel. Basically user clicks
I have a Java application that uses a C++ DLL via JNI. A few
I have a java application running on linux machine. I run the java application
I have a Java application that is leaking memory. I know which objects are
I have a Java application that launches an external process (Internet Explorer) using ProcessBuilder.
I have a java application that can be run as a JFrame or as
I have a Java application that has a line of code that says: String

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.