I need that if the person typing "c" should run the examples in C + +, if the person type "j" should run the Java examples.
But:
1- Does not recognize when I type “c” or “j”, if I type "j", he makes executeC, if I choose "c" also makes executeC not entering this executeJava. Then changed to a numerical value, where if I type 3 - executeC, if I type 4 - executeJava. So if I type 3 it accesses the directory C:\Portico\portico-1.0.2\examples\cpp\cpp13 and processes executeC, 2- If I type 4 it accesses the directory C:\Portico\portico-1.0.2\examples\java\hla13, but does not run, simply ends.
See what i do in the command prompt
C:\Portico\portico-1.0.2\exec>executePortico.bat main
Choose (J)ava or (C)++: 3
C:\Portico\portico-1.0.2\examples\cpp\cpp13\main.exe
Pressione qualquer tecla para continuar. . .
Created Federation
Joined Federation as exampleFederate
Successfully registered sync point: ReadyToRun
C:\Portico\portico-1.0.2\exec>executePortico.bat java-hla13
Choose (J)ava or (C)++: 4
C:\Portico\portico-1.0.2\examples\java\hla13\java-hla13.jar
Pressione qualquer tecla para continuar. . .
Terminated - Normal
C:\Portico\portico-1.0.2\exec>
See my code please:
@echo off
rem ###########################
rem # implementation/version #
rem ###########################
rem ################################
rem # check command line arguments #
rem ################################
:checkargs
if "%0"=="" goto usage
if "%1"=="" goto usage
set /p language=Por favor escolha a linguagem (J)ava or (C)++:
if %language%==3 goto execC
if %language%==4 goto execJ
rem #######################
rem # test for JAVA_HOME #
rem #######################
set JAVA=java
set JAVAC=javac
set JAR=jar
if "%JAVA_HOME%"=="" goto nojava
set JAVA="%JAVA_HOME%\bin\java"
set JAVAC="%JAVA_HOME%\bin\javac"
set JAR="%JAVA_HOME%\bin\jar"
goto rtihometest
:nojava
echo ERROR Your JAVA_HOME environment variable is not set!
goto usage
rem #######################
rem # test for RTI_HOME #
rem #######################
:rtihometest
:execC
call C:\Portico\portico-1.0.2\etc\confvarsC.bat
if "%RTI_HOME%"=="" goto nortihome
if not "%RTI_HOME%"=="" goto executeC
goto End
:execJ
call C:\Portico\portico-1.0.2\etc\confvarsJ.bat
if "%RTI_HOME%"=="" goto nortihome
if not "%RTI_HOME%"=="" goto executeJava
goto End
:nortihome
echo ERROR Your JAVA_HOME environment variable is not set!
goto usage
############################################
### (target) execute #######################
############################################
:executeC
set PATH=%JAVA_HOME%\jre\bin\client;%RTI_HOME%\bin;%PATH%
set RTI_FEDDIR=C:\Portico\portico-1.0.2\examples\cpp\cpp13
set EXEC=C:\Portico\portico-1.0.2\examples\cpp\cpp13\
echo %EXEC%%1.exe
pause
"%EXEC%%1.exe"
goto finish
:executeJava
set PATH=PATH=%RTI_HOME%\include\ng6;%RTI_HOME%\lib;%RTI_HOME%\bin;%JAVA_HOME%\bin;%PATH%
set ClassPath=%RTI_HOME%\lib\portico.jar
set RTI_FEDDIR=C:\Portico\portico-1.0.2\examples\java\hla13
set EXECUTA=C:\Portico\portico-1.0.2\examples\java\hla13\
echo %EXECUTA%%java-hla13.jar
pause
"%EXECUTA%%java-hla13.jar"
goto finish
:usage
echo usage: executePortico.bat [model] [nome modelo]
goto err
:err
echo Terminated - Error
goto end
:finish
echo Terminated - Normal
:end