I try to prepare bat file to sign apk file with signapk.jar
The syntax of this program is:
java -jar signapk.jar testkey.x509.pem testkey.pk8 <update.apk> <update_signed.apk>
My script looks like this:
java -jar "%~dp0%\SignApk\signapk.jar" "%~dp0%\SignApk\testkey.x509.pem" "%~dp0%\SignApk\testkey.pk8" "%~dp0%\SignApk\%ApkName%.apk" "%~dp0%\SignApk\%ApkName%_sign.apk"
When I execute the script I receive a message "Unable to access jarfile {update_signed.apk}", java "thinks" that is also a jar file and tries to run it..
Someone can help me how to pass arguments to jar file ?
Thanks.
The -jar variant of the Java command line does only process a single JAR file, so your error message is not related to that.
Your error message is most likely created by the signapk application: You should try the direct command (with no batch wrapper, without the argument variables and especially without special characters or space in the path or the arguments or relative naming - do a cd into the SignApk dir first).
If that works, you can work backwards to find where the escaping has failed you.
BTW: if this is the tool, you need to specify a sign command as well:
java -jar signapk.jar -c sign.pem -k sign.p8 sign your.apk
Related
I am vaguely familiar with batch. Super light knowledge. Anyways, I have this program that runs in a command line mode (it happens to render minecraft maps).
It is normally used by opening cmd, and typing mapcrafter.exe -c config.config -j 8 which runs the exe, specifies the config file, and runs the job with 8 threads.
One thing I wanted to do was put all of this in a batch file so I didn't have to type everything in every time I wanted to re-render it. It looked like:
start cmd.exe /K mapcrafter.exe --config "config.config" --jobs 8
This worked great, when the batch file was in the same directory as the exe.
Anyways, what I don't know how to do is to:
Start command prompt
change directory (cd) to the folder containing the .exe
Run the .exe with the two (-c -j) parameters
I want to do all of this in one batch file, and I want it to keep the command prompt window open, since the .exe outputs errors and percent completion.
I'm lucky I was able to get the one-line batch file working, with my limited knowledge of batch. At this point, I'm out of ideas as to how I should approach this. Thank you in advance for any help you can offer!
Why don't you just create a batch file with
mapcrafter.exe --config "config.config" --jobs 8
The reason it doesn't work when it is not in the same directory is because your path variable doesn't have the location of mapcrafter. An easier way around would be to use full path something like
D:\MineCraft\mapcrafter.exe --config "config.config" --jobs 8
If you want to learn more about configuring PATH environment variable see
Adding directory to PATH Environment Variable in Windows
you could just make a shortcut of the .bat file and have that on your desktop or wherever you want it. here is Microsoft's support page on this http://support.microsoft.com/kb/140443
I'm trying to see samples of BlazeDs in my web brower as shown in the tutorial on this webpage.
After I have started tomcat i open the localhost link 8400/samples in my browser as shown below.After entering the url i get the following page in my browser..
After that i try to start the sample database according to the instructions given in a box at the starting of the webpage. After i run the specified command on my command prompt i get the following error message..
I can't seem to understand the error.Even though i have set the JAVA_HOME variable as follows still i am getting this error..
Is this error due to firewall problem? or something else??
Please Help..
java is not an internal command of cmd.exe.
As this command is without file extension and without full path, Windows searches first in current directory C:\blazeds\sampledb for java.* to find either java.com, java.exe, java.bat, java.cmd and some other file extensions.
The file extensions are defined in environment variable PATHEXT separated by semicolons which can be viewed in a command prompt window with command set PATHEXT
If there is no such file with file name java in current directory, Windows searches in all directories specified separated by semicolons in environment variable PATH. Entering just path or set path in a command prompt window results in a display of those directories. (set path lists the directories of PATH and the file extensions of PATHEXT as both environment variables start with the string "path".)
The environment variable JAVA_HOME is needed perhaps by the Java package itself and other applications, but is definitely not read by Windows to find an executable file with name java.
Search for the directory containing java.exe and append the directory of this file to PATH. On command line this can be done with:
PATH=%PATH%;Full path to directory containing java
Do not enter double quotes even if the full path to directory containing java.exe contains 1 or more space characters.
Or you run the java application with the command line
"Full path to directory\java.exe" -cp hsqldb.jar org.hsqldb.Server
I am using windows XP operating system and cygwin is installed in my C drive.
I need to login to cygwin directly to my directory path which contains a makefile and also a bash script called build.sh in the same directory. So i modified the original cygwin.bat file and added the line as shown below.
#echo off
C:
chdir C:\cygwin\bin
bash --login "/cygdrive/E/scheme_31july/build/build.sh"
When i double click on this bat file i could see my script executing but not on cygwin shell but on windows cmd shell as a result I get errors for "make" command like "No rule to make target" as make comes bundled with cygwin.
And when I explicitly login to cygwin using default cygwin.bat file and execute my script by giving following commands in cygwin shell the script executes without errors.
Basically I want to write a bat file so that I can keep it anywhere in my PC and instead of manually openeing the cygwin prompt and typing commands like:
$ cd /cygdrive/E/scheme_31july/build/
$ sh build.sh
it should happen automatically. I sit possible to do so.
Regards,
Harshit
No rule to make target sounds more like make being executed in the wrong directory. make itself seems to be available and running as intended.
Try this:
bash --login -c "cd /cygdrive/E/scheme_31july/build/ && sh build.sh"
This should start a --login session (which should give you access to all the settings and tools you'd expect in a cygwin prompt environment), then execute the given shell command, which is the cd and sh you asked for. You could also write those two lines to a separate script file, and pass the name of that to bash instead of the full path to build.sh.
You could also try to cd into C:\scheme_31july\build in the bat file and then execute bash from there. Not sure whether bash will try to change path upon entering the login session. You can try whether things work without the --login, both for this approach and the one above.
#echo off
C:
cd C:\scheme_31july\build
C:\cygwin\bin\bash.exe ./build.sh
I'm not sure whether you want the session to turn interactive after that or not. In the above case, bash will terminate after the script completed, and might even close the window. You might have to add a read into build.sh to avoid that. If you want bash to turn interactive after executing some command, you can try using the --rcfile option of bash to execute some commands and then turn interactive.
I'm setting up Jenkins on Windows to take care of the builds for a Windows project I've been working on. Until now, I've just been building locally. I've got a batch file that performs the build, which ends up generating some msi installers.
Some of the projects contain post builds steps that run batch files. The arguments to the batch files sometimes contain spaces. This isn't a problem when I run my build batch file from the command prompt.
However, Jenkins seems to have a problem with this - I get errors such as
"File not found: C:\Program"
I'm puzzled as to why the error happens when Jenkins triggers the batch, but not when I run it manually - any ideas?
For arguments that include spaces, wrap them in double quotes. Example:
WRONG: PROCESS_FILE.EXE C:\Program Files\This File.txt
CORRECT: PROCESS_FILE.EXE "C:\Program FIles\This File.txt"
As Jason mention, you need to pass your arguments and paths with quotes.
Also, check the build log and see which type of quotes you're using. Depending on where it's being passed you may need single or double quotes, or some sort of escape character.
If you want to look at the actual batch file that Jenkins runs for your external commands or pre/post build events, check the build log and load up the temporary batch file in an editor to see what it actually looks like. Sometimes this is necessary to debug your build.
when i tried to run jar file from netbeans it works fine but when i try to run by command prompt it gives me exexeption in thread error but when i check my task manager it shows the javaw.exe is running..............what it exactly and why this error comes only in command prompt?
compile your application with:
>javac -jar example.jar ClassName.java
Run:
>java -jar example.jar ClassName
Can you please paste the exception that you get.
When running from command line, you have make sure that classpath for your program is set properly.
Make user that you have set the main-class in your manifest file of you jar.