Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

macsig

macrumors regular
Original poster
Oct 27, 2006
236
0
Marina del Rey, CA
Hi Guys, I apology about my ignorance but I'm not a "terminal guy".
I need to use iReport so I have downloaded it but now I need to execute the sh file in order to start it. I have tried several options but I have alway some kind of error:

-bash: iReport.sh: command not found
-bash: ./iReport.sh: /bin/bash^M: bad interpreter: No such file or directory

and so on ...

Could someone explain to me how I can execute this sh file?

Thanks and have a nice day!
 

fuzorsilverbolt

macrumors member
May 19, 2008
37
0
oho ohohohooooo !!!!!!!

Raises hand! ohoh oh! i know it.

You have the wrong line return endings in that text file.

Go through the entire text file in iReport.sh and delete every occurance of ^M from the end of every line that it occurs. Save the file then try to execute it.

Also what I like to do is to press enter before the first character in the text file then delete the new return I entered because the shebang is very picky in terminals. The shebang line is the first line in *nix scripts that start with #!

such as #!/usr/bin/perl or #!/bin/bash

The ^M happens when a text file is saved on a *nix box then not converted for the macintosh's text file line endings.

Also if your system complains that it can't find bash change the shebang line to #!/bin/sh

Most importanly, make sure that shebang line is buried on the top line of the text file starting at the first character.
 

macsig

macrumors regular
Original poster
Oct 27, 2006
236
0
Marina del Rey, CA
Assuming the iReport.sh shell is in the current directory, try this:

sh iReport.sh

Thanks for your reply

I have pointed the terminal to the folder where I have iReport.sh and I typed "sh iReport.sh" as you can see below but I have an other error.

Macintosh-2:iReport sig$ sh iReport.sh
: command not found
: No such file or directoryin
iReport.sh: line 4: ./startup.sh: No such file or directory
: command not found

Am I missing something?

Thanks again
 

Krevnik

macrumors 601
Sep 8, 2003
4,100
1,309
Thanks for your reply

I have pointed the terminal to the folder where I have iReport.sh and I typed "sh iReport.sh" as you can see below but I have an other error.

Macintosh-2:iReport sig$ sh iReport.sh
: command not found
: No such file or directoryin
iReport.sh: line 4: ./startup.sh: No such file or directory
: command not found

Am I missing something?

Thanks again

Yes, a file called startup.sh. :p
 

macsig

macrumors regular
Original poster
Oct 27, 2006
236
0
Marina del Rey, CA
Thanks Yellow, I will definitely read that paper but now could you please give me a summary of that? I need just to start iReport quickly.

Thank you so much and Have a nice day.
 

kg9ov

macrumors member
Feb 12, 2005
73
0
In front of a computer...
Raises hand! ohoh oh! i know it.

You have the wrong line return endings in that text file.

Go through the entire text file in iReport.sh and delete every occurance of ^M from the end of every line that it occurs. Save the file then try to execute it.

Waaaayyy to much work. Work smarter not harder. There are many ways to do this... here's one (assuming the file is using DOS line endings (CRLF) as suggested in your post and you want to convert it to UNIX style line endings (LF)):

make a backup copy of your file
Code:
cp -p iReport.sh iReport.sh.orig
remove all of the carriage returns from the file and put the result in a new file
Code:
cat iReport.sh | tr -d '\r' > iReport.sh.new
move the new file into place with the original name
Code:
mv iReport.sh.new iReport.sh


-Tony
 

yellow

Moderator emeritus
Oct 21, 2003
16,018
6
Portland, OR
I think there's something else at fault here..

The iReports.sh shell script simply calls the startup.sh shell script thusly:

Code:
#!/bin/bash

cd $(dirname $0)/bin
./startup.sh $*

The startup.sh is this:

Code:
#! /bin/sh


# add the libraries to the IREPORT_CLASSPATH.
# EXEDIR is the directory where this executable is.
EXEDIR=${0%/*}
DIRLIBS=${EXEDIR}/../lib/*.jar
for i in ${DIRLIBS}
do
  if [ -z "$IREPORT_CLASSPATH" ] ; then
    IREPORT_CLASSPATH=$i
  else
    IREPORT_CLASSPATH="$i":$IREPORT_CLASSPATH
  fi
done

DIRLIBS=${EXEDIR}/../lib/*.zip
for i in ${DIRLIBS}
do
  if [ -z "$IREPORT_CLASSPATH" ] ; then
    IREPORT_CLASSPATH=$i
  else
    IREPORT_CLASSPATH="$i":$IREPORT_CLASSPATH
  fi
done

IREPORT_CLASSPATH="${EXEDIR}/../classes":"${EXEDIR}/../fonts":$IREPORT_CLASSPATH
cd ..
IREPORT_HOME=$(pwd)
cd bin
#echo $IREPORT_HOME

java -classpath "$IREPORT_CLASSPATH:$CLASSPATH" -Direport.home=$IREPORT_HOME -Djava.security.policy=$IREPORT_HOME/policy.all it.businesslogic.ireport.gui.MainFrame "$@"
"

Seems to me the OP is missing some important stuff..
 

primes

macrumors newbie
Jun 4, 2008
8
0
May not just be a line ending problem...

I agree with yellow...the download is about 45MB and there is a lot of stuff besides these two small shell scripts. Installation information is not too helpful but there looks like there is an entire book on ireport (but you are in a hurry).
 

macsig

macrumors regular
Original poster
Oct 27, 2006
236
0
Marina del Rey, CA
Thanks guys,
SOLVED, I have downloaded once again it and now the simple sh iReport sh works.
The first time I have downloaded the zip version but now I have tried the tar.gz one.


Have a nice day!
 

yellow

Moderator emeritus
Oct 21, 2003
16,018
6
Portland, OR
Shouldn't it work?

As far as I can tell, no.

Assuming we're talking about the same thing, then it seems to me you have some pieces missing here. I have no idea what, however.

Do you have JasperReports installed and running?

iReport is the most popular visual reporting tool for JasperReports (Java reporting library) and JasperServer (reporting server). You can manage charts, images, subreports, etc. Data sources: JDBC, TableModels, JavaBeans, XML, Hibernate, CSV etc. Output
 

lee1210

macrumors 68040
Jan 10, 2005
3,182
3
Dallas, TX
The difference, as alluded to earlier, was probably that the zip version was intended for windows systems and the .tar.gz version intended for unix-like systems, hence the difference in EOL sequences.

-Lee
 

shravee

macrumors newbie
Sep 24, 2009
3
0
need help to run iReport

need help to run my iReport
1. unzipped iReport-0.3.0.tar.gz

2. ./iReport.sh
received error as follows.

[root@hydhtc50655d iReport-0.3.0]# ./iReport.sh
./iReport.sh: ./startup.sh: /bin/sh^M: bad interpreter: No such file or directory
[root@hydhtc50655d iReport-0.3.0]#


------------------------------------------
CONTENT WITHIN THE iReport.sh

#!/bin/sh

cd ./bin
./startup.sh "$@"

---------------------------------------------


--------------------------------------------------------------
CONTENT WITHIN THE startup.sh file

#!/bin/sh
# add the libraries to the IREPORT_CLASSPATH.
# EXEDIR is the directory where this executable is.
EXEDIR=${0%/*}
DIRLIBS=${EXEDIR}/../lib/*.jar
for i in ${DIRLIBS}
do
if [ -z "$IREPORT_CLASSPATH" ] ; then
IREPORT_CLASSPATH=$i
else
IREPORT_CLASSPATH="$i":$IREPORT_CLASSPATH
fi
done

DIRLIBS=${EXEDIR}/../lib/*.zip
for i in ${DIRLIBS}
do
if [ -z "$IREPORT_CLASSPATH" ] ; then
IREPORT_CLASSPATH=$i
else
IREPORT_CLASSPATH="$i":$IREPORT_CLASSPATH
fi
done

IREPORT_CLASSPATH="${EXEDIR}/../classes":$IREPORT_CLASSPATH

java -classpath "$IREPORT_CLASSPATH:$CLASSPATH" it.businesslogic.ireport.gui.MainFrame "$@"

------------------------------------------------------------------------


i am using the iREport for the first time. acc to the manual i have also copied the tools.jar from the JDk 1.6 of mine to the lib directory of iReport.

still i dont know how to use iReport.

plz guide.................

regards
shravee.
 

shravee

macrumors newbie
Sep 24, 2009
3
0
aditional information for a new query

when i entered sh startup.sh i received the foll error


[root@hydhtc50655d bin]# sh startup.sh
'tartup.sh: line 7: syntax error near unexpected token `do
'tartup.sh: line 7: `do
[root@hydhtc50655d bin]#


opened the file and removed all the whitespaces.

then the above error moved on 14 line and then to 22 line and finally it ended up to unexpected end of file


now my script file looks like this.
---------------------------------------------------------------------------------------------------------------------------
#!/bin/sh
# add the libraries to the IREPORT_CLASSPATH.
# EXEDIR is the directory where this executable is.
EXEDIR=${0%/*}
DIRLIBS=${EXEDIR}/../lib/*.jar
for i in ${DIRLIBS}
do if [ -z "$IREPORT_CLASSPATH" ] ; then
IREPORT_CLASSPATH=$i
else
IREPORT_CLASSPATH="$i":$IREPORT_CLASSPATH
fi
done
DIRLIBS=${EXEDIR}/../lib/*.zip
for i in ${DIRLIBS}
do if[ -z "$IREPORT_CLASSPATH" ] ; then
IREPORT_CLASSPATH=$i
else
IREPORT_CLASSPATH="$i":$IREPORT_CLASSPATH
fi
done
IREPORT_CLASSPATH="${EXEDIR}/../classes":$IREPORT_CLASSPATH
java -classpath "$IREPORT_CLASSPATH:$CLASSPATH" it.businesslogic.ireport.gui.MainFrame"$@"
~
~
~
-------------------------------------------------------------------------------------------------------------------------

now when i run sh startup.sh i get a new error..........

[root@hydhtc50655d bin]# sh startup.sh
startup.sh: line 23: syntax error: unexpected end of file
[root@hydhtc50655d bin]#


so i think i have to do something with the last line.........
 

MarcD

macrumors newbie
Oct 18, 2009
1
0
Hey everyone,

I'm having a similar problem. The file is called runme.sh and this is what it contains:

java -mx128m -ms64m -Djava.library.path="./lib/" -cp .:lib/liquidlnf.jar:lib/rover.jar:lib/data.jar:lib/jme.jar:lib/jme-awt.jar:lib/jme-effects.jar:lib/jme-model.jar:lib/physicsSystem.jar:lib/jme-sound.jar:lib/jme-terrain.jar:lib/lwjgl.jar:lib/osgi.jar:lib/runtime.jar: org.cinera.rover.RoverRun logToFile

I have tried the suggestions given to the OP in Terminal to no avail.

The program is called RoverRun - just a little offroad driving game.

Thanks in advance
 

chown33

Moderator
Staff member
Aug 9, 2009
10,747
8,421
A sea of green
Hey everyone,

I'm having a similar problem.

0. Similar to what? Are you getting a syntax error near unexpected token 'do'? An unexpected end-of-file? Copy and paste the exact error message you're getting. If you're not getting an error message, then say that. "Similar" is too vague to answer.

1. Please edit your post and enclose your code inside CODE tags. Can't tell what the actual code is, because it's line-wrapping. Since line-endings are significant to the shell, it's only guesswork what the code is intended to mean. Debugging by guesswork is rarely fruitful.

2. Where did you get this shell script? Be specific. Give a URL.

3. What kind of Mac are you running it on? Intel, PPC? Which OS version? Be specific.

4. It might be worth reading the following:

http://www.cocoadev.com/index.pl?HowToAskQuestions

http://www.mikeash.com/getting_answers.html
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.