Programs that want to be packaged with exe4j use javaw to run - exe4j

How to set exe4j to use javaW to execute the program?
I tried to use the GUI Application and still use java to run the program, which will cause my program to not execute normally.If you try to rename javaw to java, you will get an environment error.

exe4j creates launchers that use JNI to create the JVM. They do no call java or javaw. An exe4j launcher in console mode behaves similarly to java and an exe4j launcher in GUI mode behaves similarly to javaw.

Related

how to start code server terminal with chroot?

I have a code server that runs on Android with termux, for university reasons, there are times when I must share my vscode environment and I would not like to expose my entire system and personal files through the terminal.
So I was wondering if it was possible to expose a terminal from an alpine distro with chroot (prrot in the case of termux) by default every time code server opens a terminal
After some time reading the vscode config, I realized that you can use the shell option to force it to start inside with alpine and not expose my files, nor my android system with termux
"terminal.integrated.shell.linux":"/data/data/com.termux/files/usr/bin/startalpine"

VS Code GDB debugging doesn't work in integrated terminal, but it works in external terminal

I'm on windows 10 and have set up C debugging in VS code using MinGW. In the launch.json file, if I set "externalConsole": true" then everything works as expected, and I can debug properly. However if it is set to "externalConsole": false", then the integrated VS code terminal tries to run:
"cmd /C "c:\Users\16479\.vscode\extensions\ms-vscode.cpptools-1.1.3\debugAdapters\bin\WindowsDebugLauncher.exe --stdin=Microsoft-MIEngine-In-iphorouu.0fb --stdout=Microsoft-MIEngine-Out-10cbyjg3.wkd --stderr=Microsoft-MIEngine-Error-pj3ilqfq.afl --pid=Microsoft-MIEngine-Pid-k5ph25ah.bz2 --dbgExe=C:\MinGW\bin\gdb.exe --interpreter=mi "
and it outputs
The system cannot find the path specified.
Which makes sense because I've never heard of cmd being a thing in a terminal. But it is something you can run in the Windows Run tool to open a command prompt. So it seems like VS code is trying to run the same command it used to open the external terminal, but it isn't working in the integrated terminal.
This is just my theory I'm not an expert, but if anyone knows anything about this or has a solution to let me debug in the integrated terminal it would be much appreciated.
To fix this I set the default shell to Powershell instead of Command Prompt in VS code.

solr not writing logs when it runs not from its main folder

When I run solr using
java -jar "C:\solr\example\start.jar"
It writes logs to C:\solr\example\logs.
When I run it using
java -Dsolr.solr.home="C:\solr\example\solr"
-Djetty.home="C:\solr\example"
-Djetty.logs="C:\solr\example\logs"
-jar "C:\solr\example\
start.jar"
it writes logs only if I run it from
C:\solr\example>
any other folder - logs are not written.
This is important as I need to run it as a service later (using nssm)
What should I change?
As you have discovered, the Jetty-hosted example distributed with Solr must be started in the example directory to function properly. Try creating a batch file that changes to the directory then invokes Java, like this:
C:
cd C:\solr\example\
java -Dsolr.solr.home="C:\solr\example\solr"
-Djetty.home="C:\solr\example"
-Djetty.logs="C:\solr\example\logs"
-jar "C:\solr\example\
Then have NSSM run the batch file instead of java.
Both answers should work for you.
You could set it up using apache Tomcat as opposed to the Jetty instance Solr comes with. Tomcat which comes standard with a startup.bat batch file that you use to start your server

Keeping a C Command line app running in Mac Application Bundle

I'm in the process of writing a compiled C application which uses the system() function to launch a Java .jar file:
int main() {
system("java -jar MyJar.jar");
return 0;
}
I successfully wrapped this up in a clickable app bundle, however, when I double click it, the application exits immediately before it has a chance to launch the jar. However it works perfectly when I run the compiled C code from the command line.
Any insight would be appreciated!
Scott
The reason the application exits immediately is because of the following line:
return 0;
You would want to use exec instead of system. With exec, your program gets replaced by the Java process and never gets a chance to reach the return 0; line. However, it's much easier to just replace the entire C progrma with a shell script:
#!/bin/sh
exec java -jar MyJar.jar
As written, there is no drawback to this approach that I can think of. The C program already spawns a shell process (that's what system does), so why not start out with a shell process in the first place?
Lots of application bundles use shell scripts to do things like this.

In a MacRuby app for distribution, how can you launch an NSTask that invokes a Ruby script with macruby?

I have a MacRuby app, and after the app launches, I would like to launch a second process using an NSTask. The second process is a Ruby script bundled with the app. I would like to launch it using the MacRuby macruby interpreter that gets compiled into the app bundle. How can I do that?
First, remove the .rb extension from the ruby script, otherwise if you compile the macruby project using macruby_deploy, it will be compiled to rbo file. The script file should have this as its first line:
#!/usr/bin/env ruby
Make sure the script will be copied to Resources folder.
Then create and call a NSTask:
path = NSBundle.mainBundle.pathForResource('test', ofType:nil)
task = NSTask.alloc.init
task.setLaunchPath(path)
task.launch
Well, have you tried just calling NSTask?
NSTask.launchedTaskWithLaunchPath('script.rb', nil)
Then click around in Xcode to make sure that script.rb is in place during execution.

Resources