Java and START in Batch

Discussion forum for all Windows batch related topics.

Moderator: DosItHelp

Post Reply
Message
Author
YaYaBinks3
Posts: 7
Joined: 04 Aug 2012 10:02

Java and START in Batch

#1 Post by YaYaBinks3 » 04 Aug 2012 10:06

Hello all!
I'm trying to start a jar file using the java command, I'm planning on making an exe file that runs and runs a batch file that THEN runs a batch file thats inside the jarfile's folder.

Batch file 1:

Code: Select all

@echo off 
cls
START /B C:\Users\BillyV\AppData\Roaming\.techniclauncher\RunTekkit.bat
EXIT


Batch file 2:

Code: Select all

@ECHO OFF
java -Xmx1024M -Xms1024M -jar technic-launcher.jar
EXIT


It's extremely simple, but yet, it doesn't work. BF2 works when I double click it.
It throws

Code: Select all

Unable to access jarfile technic-launcher.jar
.
Why? And can anyone help?

aGerman
Expert
Posts: 4722
Joined: 22 Jan 2010 18:01
Location: Germany

Re: Java and START in Batch

#2 Post by aGerman » 04 Aug 2012 12:36

BF2 inherits the working directory from BF1. Begin the 2nd BF with line

Code: Select all

@echo off &cd /d "%~dp0"

to change the working directory.

BTW: Forget about all EXIT commands and change your START line instead

Code: Select all

START "" /B cmd /c "%appdata%\.techniclauncher\RunTekkit.bat"


Regards
aGerman

YaYaBinks3
Posts: 7
Joined: 04 Aug 2012 10:02

Re: Java and START in Batch

#3 Post by YaYaBinks3 » 05 Aug 2012 01:59

Thanks. I'll try this when I have access to a computer.
I use my EXIT command because I'm going to use iexpress.exe and make an exe file to open batch file 1 (which is put in the temp file) to run batch file 2. Then I can pin the exe to my start menu and use it like that.

YaYaBinks3
Posts: 7
Joined: 04 Aug 2012 10:02

Re: Java and START in Batch

#4 Post by YaYaBinks3 » 05 Aug 2012 02:18

Thanks. It SORT of worked.
It comes up with all the Java help... why?

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Java and START in Batch

#5 Post by foxidrive » 05 Aug 2012 03:46

The java command has a syntax error or the file cannot be found in the working directory.

That is usually when the help screen is displayed.

YaYaBinks3
Posts: 7
Joined: 04 Aug 2012 10:02

Re: Java and START in Batch

#6 Post by YaYaBinks3 » 05 Aug 2012 03:54

How do I fix it?

Code: Select all

@echo off &cd /d "%~dp0"
java -cp .;technic-launcher.jar
PAUSE


That's bat file 2

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Java and START in Batch

#7 Post by foxidrive » 05 Aug 2012 05:03

YaYaBinks3 wrote:How do I fix it?

Code: Select all

java -cp .;technic-launcher.jar



That line looks wrong.

YaYaBinks3
Posts: 7
Joined: 04 Aug 2012 10:02

Re: Java and START in Batch

#8 Post by YaYaBinks3 » 05 Aug 2012 06:19

Then how do I fix that :|

foxidrive
Expert
Posts: 6031
Joined: 10 Feb 2012 02:20

Re: Java and START in Batch

#9 Post by foxidrive » 05 Aug 2012 07:26

Read the help in the java.exe

YaYaBinks3
Posts: 7
Joined: 04 Aug 2012 10:02

Re: Java and START in Batch

#10 Post by YaYaBinks3 » 06 Aug 2012 01:12

Fixed.
Thanks you guys. Now I can make an exe which runs a bat (from a temp file) and then starts a java. The old exe broke! I can change the icon of the exe too :D

Post Reply