Asked  9 Months ago    Answers:  5   Viewed   6 times

I want to run batch file (similar to Windows) on Mac OS X to run a jar file, after search I found it run batch script.

I am not getting proper link from where I can take help. How can I create this?

 Answers

4

You could create a shell script and run it with Terminal.

For example:

#!/bin/sh
java -jar path/to/jar/file.jar

To run it you need to set up the right user permission, so do chmod u+x script-name then run with ./script-name

Wednesday, September 22, 2021
 
Joel
 
5

This is a limitation of the file system, not of the Java API. According to the format specification HFS+ only stores timestamps to a granularity of one second.

Tuesday, August 24, 2021
 
2

The current directory is not normally included in your $PATH on a *nix operating system like OS X; to execute a program in the current directory, precede it with the path to the current directory (.):

$ ./emulator
Wednesday, October 6, 2021
 
Erebus
 
5

This snippet will search the current PATH for java.exe, and print out where it was found:

for /f %%j in ("java.exe") do @echo.%%~dp$PATH:j

On my system this gives me

C:WINDOWSsystem32

Using this you can set JAVA_HOME as follows:

@echo off

for /f %%j in ("java.exe") do (
    set JAVA_HOME=%%~dp$PATH:j
)

if %JAVA_HOME%.==. (
    @echo java.exe not found
) else (
    @echo JAVA_HOME = %JAVA_HOME%
)
Saturday, October 9, 2021
 
Noctis
 
1

I have looked into the manual and the command includes two more parameters, pulse on and pulse off. It's also well explained here: How to program cash drawer to open. So the command is ESC p m t1 t2, where m is relating to connector pin, and t1, t2 are high/low times. You send only ESC p 0 (x1bx70x00), while you should do eg. ESC p 0 25 250 (x1bx70x00x19xfa)

copy /b is perfectly valid way of sending your control commands to the printer and it should work.

Just make sure that your file does include proper hex sequence using any hex editor.

Hope this helps

Edit: link to technical manual

Edit: To get command sequence encoded in file (long but easy):
1. Get Notepad++
2. Check you have Converter installed under plugins. If not, find and install it
3. Create new file in Notepad++
4. Select ANSI under encoding
5. Enter 1b700019fa

6. Select(highlight) string you entered (or select all with Ctl-A)
7. Go to plugins->Converter-> HEX --> ASCII
8. You should see garbled output (with letter p inside). Save
9. Send your file to printer.

Saturday, December 4, 2021
 
Only authorized users can answer the question. Please sign in first, or register a free account.
Not the answer you're looking for? Browse other questions tagged :