2012-08-30 37 views
0

我想運行JasperReport的樣品演示,所以我下載的文件,但是當我輸入我的windows下面的7命令行according to the Jasperreport documentation目標「跑」不存在於該項目「燒烤」

C:\jasperreports-4.7.0\demo\samples\barbecue>ant run 

我得到了以下錯誤:

Target "run" does not exist in the project "barbecue" .

那麼可能是什麼問題?

::已更新:: 我在CMD輸入ant –p後我得到了以下內容: -

C:\jasperreports-4.7.0\demo\samples\barbecue>ant -p 
Buildfile: C:\jasperreports-4.7.0\demo\samples\barbecue\build.xml 
Shows how barcodes could be included in reports using the Barbecue component. 
Main targets: 

clean   Deletes all the generated files. 
compile  Compiles the XML report design and produces the .jasper file. 
csv   Generates a CSV version of the report by converting the .jrprint 
file. 
decompile  Decompiles a .jasper file into a .jrxml file. 
docx   Generates a DOCX version of the report by converting the .jrprin 
t file. 
fill   Fills the compiled report design with data and produces the .jrp 
rint file. 
html   Generates an HTML version of the report by converting the .jrpri 
nt file. 
javac   Compiles the java source files of the test application. 
jxl   Generates an XLS version of the report by converting the .jrprin 
t file using the JExcelApi library. 
ods   Generates an ODS version of the report by converting the .jrprin 
t file. 
odt   Generates an ODT version of the report by converting the .jrprin 
t file. 
pdf   Generates a PDF version of the report by converting the .jrprint 
file. 
pptx   Generates a PPTX version of the report by converting the .jrprin 
t file. 
print   Sends the report in the .jrprint file to the printer. 
rtf   Generates an RTF version of the report by converting the .jrprin 
t file. 
test   Runs the sample. 
view   Launches the report viewer to preview the report stored in the . 
jrprint file. 
viewDesign  Launches the design viewer to preview the compiled report design 
. 
viewDesignXml Launches the design viewer to preview the XML report design. 
viewXml  Launches the report viewer to preview the generated report store 
d in an XML file. 
writeApi  Generates a .java version of the report by converting the .jrxml 
file. 
writeApiXml Generates a .jrxml version of the report by executing the API ve 
rsion of the report design. 
xhtml   Generates an XHTML version of the report by converting the .jrpr 
int file. 
xls   Generates an XLS version of the report by converting the .jrprin 
t file using the POI library. 
xlsx   Generates an XLSX version of the report by converting the .jrpri 
nt file. 
xml   Generates an XML version of the report by converting the .jrprin 
t file. 
xmlEmbed  Generates an XML version of the report by converting the .jrprin 
t file. 
Default target: test 

::::: UPDATED2 ::::: 我對於類型ant test圖表演示,但問題依然存在: -

C:\jasperreports-4.7.0\demo\samples\charts>ant test 
Buildfile: C:\jasperreports-4.7.0\demo\samples\charts\build.xml 

test: 
    [echo] =================================== 
    [echo] Charts Sample 
    [echo] =================================== 

clean: 

clean-sample: 

javac: 

javac: 
    [mkdir] Created dir: C:\jasperreports-4.7.0\demo\samples\charts\build\classe 
s 
    [javac] C:\jasperreports-4.7.0\demo\samples\build.xml:41: warning: 'includea 
ntruntime' was not set, defaulting to build.sysclasspath=last; set to false for 
repeatable builds 
    [javac] Compiling 2 source files to C:\jasperreports-4.7.0\demo\samples\char 
ts\build\classes 
    [javac] warning: [options] bootstrap class path not set in conjunction with 
-source 1.6 
    [javac] Note: C:\jasperreports-4.7.0\demo\samples\charts\src\ChartsApp.java 
uses unchecked or unsafe operations. 
    [javac] Note: Recompile with -Xlint:unchecked for details. 
    [javac] 1 warning 
    [copy] Copied 5 empty directories to 5 empty directories under C:\jasperrep 
orts-4.7.0\demo\samples\charts\build\classes 

compile: 

compile: 
    [mkdir] Created dir: C:\jasperreports-4.7.0\demo\samples\charts\build\report 
s 
     [jrc] Compiling 24 report design files. 
     [jrc] File : C:\jasperreports-4.7.0\demo\samples\charts\reports\MultipleAx 
isChartReport.jrxml ... OK. 
     [jrc] File : C:\jasperreports-4.7.0\demo\samples\charts\reports\XYBarChart 
TimePeriodReport.jrxml ... OK. 
     [jrc] File : C:\jasperreports-4.7.0\demo\samples\charts\reports\XYAreaChar 
tReport.jrxml ... OK. 
     [jrc] File : C:\jasperreports-4.7.0\demo\samples\charts\reports\Pie3DChart 
Report.jrxml ... OK. 
     [jrc] File : C:\jasperreports-4.7.0\demo\samples\charts\reports\StackedBar 
3DChartReport.jrxml ... OK. 
     [jrc] File : C:\jasperreports-4.7.0\demo\samples\charts\reports\MeterChart 
Report.jrxml ... OK. 
     [jrc] File : C:\jasperreports-4.7.0\demo\samples\charts\reports\XYBarChart 
Report.jrxml ... OK. 
     [jrc] File : C:\jasperreports-4.7.0\demo\samples\charts\reports\StackedAre 
aChartReport.jrxml ... OK. 
     [jrc] File : C:\jasperreports-4.7.0\demo\samples\charts\reports\Candlestic 
kChartReport.jrxml ... OK. 
     [jrc] File : C:\jasperreports-4.7.0\demo\samples\charts\reports\HighLowCha 
rtReport.jrxml ... OK. 
     [jrc] File : C:\jasperreports-4.7.0\demo\samples\charts\reports\XYLineChar 
tReport.jrxml ... OK. 
     [jrc] File : C:\jasperreports-4.7.0\demo\samples\charts\reports\BubbleChar 
tReport.jrxml ... OK. 
     [jrc] File : C:\jasperreports-4.7.0\demo\samples\charts\reports\Thermomete 
rChartReport.jrxml ... OK. 
     [jrc] File : C:\jasperreports-4.7.0\demo\samples\charts\reports\StackedBar 
ChartReport.jrxml ... OK. 
     [jrc] File : C:\jasperreports-4.7.0\demo\samples\charts\reports\ScatterCha 
rtReport.jrxml ... OK. 
     [jrc] File : C:\jasperreports-4.7.0\demo\samples\charts\reports\TimeSeries 
ChartReport.jrxml ... OK. 
     [jrc] File : C:\jasperreports-4.7.0\demo\samples\charts\reports\SubDataset 
ChartReport.jrxml ... OK. 
     [jrc] File : C:\jasperreports-4.7.0\demo\samples\charts\reports\AreaChartR 
eport.jrxml ... OK. 
     [jrc] File : C:\jasperreports-4.7.0\demo\samples\charts\reports\LineChartR 
eport.jrxml ... OK. 
     [jrc] File : C:\jasperreports-4.7.0\demo\samples\charts\reports\XYBarChart 
TimeSeriesReport.jrxml ... OK. 
     [jrc] File : C:\jasperreports-4.7.0\demo\samples\charts\reports\GanttChart 
Report.jrxml ... OK. 
     [jrc] File : C:\jasperreports-4.7.0\demo\samples\charts\reports\PieChartRe 
port.jrxml ... OK. 
     [jrc] File : C:\jasperreports-4.7.0\demo\samples\charts\reports\Bar3DChart 
Report.jrxml ... OK. 
     [jrc] File : C:\jasperreports-4.7.0\demo\samples\charts\reports\BarChartRe 
port.jrxml ... OK. 

test: 
    [java] net.sf.jasperreports.engine.JRException: java.sql.SQLException: sock 
et creation error 
    [java]  at net.sf.jasperreports.engine.util.AbstractSampleApp.getDemoHsq 
ldbConnection(AbstractSampleApp.java:158) 
    [java]  at ChartsApp.fill(ChartsApp.java:83) 
    [java]  at ChartsApp.test(ChartsApp.java:63) 
    [java]  at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method) 
    [java]  at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAcces 
sorImpl.java:57) 
    [java]  at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMet 
hodAccessorImpl.java:43) 
    [java]  at java.lang.reflect.Method.invoke(Method.java:601) 
    [java]  at net.sf.jasperreports.engine.util.AbstractSampleApp.executeTas 
k(AbstractSampleApp.java:94) 
    [java]  at net.sf.jasperreports.engine.util.AbstractSampleApp.main(Abstr 
actSampleApp.java:179) 
    [java]  at ChartsApp.main(ChartsApp.java:54) 
    [java] Caused by: java.sql.SQLException: socket creation error 
    [java]  at org.hsqldb.jdbc.Util.sqlException(Unknown Source) 
    [java]  at org.hsqldb.jdbc.jdbcConnection.<init>(Unknown Source) 
    [java]  at org.hsqldb.jdbcDriver.getConnection(Unknown Source) 
    [java]  at org.hsqldb.jdbcDriver.connect(Unknown Source) 
    [java]  at java.sql.DriverManager.getConnection(DriverManager.java:579) 
    [java]  at java.sql.DriverManager.getConnection(DriverManager.java:221) 
    [java]  at net.sf.jasperreports.engine.util.AbstractSampleApp.getDemoHsq 
ldbConnection(AbstractSampleApp.java:150) 
    [java]  ... 9 more 

BUILD SUCCESSFUL 
Total time: 8 seconds 

C:\jasperreports-4.7.0\demo\samples\charts>ant run 
Buildfile: C:\jasperreports-4.7.0\demo\samples\charts\build.xml 

BUILD FAILED 
Target "run" does not exist in the project "charts". 

Total time: 0 seconds 

回答

2

您應該運行ant test用於運行示例的命令(清除,編譯和生成所有格式的報告:xls,pdf等)。

對於查看報表JRViewer你應該運行ant view命令。

的結果(輸出)ant test將是:

d:\java\jasperreports-4.5.1\demo\samples\barbecue>ant test 
Buildfile: d:\java\jasperreports-4.5.1\demo\samples\barbecue\build.xml 

test: 
    [echo] =================================== 
    [echo] Barbecue Sample 
    [echo] =================================== 

clean: 

clean-sample: 

javac: 

javac: 
    [mkdir] Created dir: d:\java\jasperreports-4.5.1\demo\samples\barbecue\build 
\classes 
    [javac] d:\java\jasperreports-4.5.1\demo\samples\build.xml:41: warning: 'inc 
ludeantruntime' was not set, defaulting to build.sysclasspath=last; set to false 
for repeatable builds 
    [javac] Compiling 1 source file to d:\java\jasperreports-4.5.1\demo\samples\ 
barbecue\build\classes 

compile: 

compile: 
    [mkdir] Created dir: d:\java\jasperreports-4.5.1\demo\samples\barbecue\build 
\reports 
     [jrc] Compiling 1 report design files. 
     [jrc] File : d:\java\jasperreports-4.5.1\demo\samples\barbecue\reports\Bar 
becueReport.jrxml ... OK. 

test: 
    [java] Filling time : 3198 
    [java] PDF creation time : 993 
    [java] XML creation time : 224 
    [java] XML creation time : 44 
    [java] HTML creation time : 109 
    [java] RTF creation time : 98 
    [java] XLS creation time : 364 
    [java] XLS creation time : 248 
    [java] CSV creation time : 6 
    [java] ODT creation time : 95 
    [java] ODS creation time : 12 
    [java] DOCX creation time : 183 
    [java] XLSX creation time : 103 
    [java] PPTX creation time : 74 
    [java] XHTML creation time : 56 

BUILD SUCCESSFUL 
Total time: 13 seconds 

net.sf.jasperreports.engine.JRException: java.sql.SQLException: sock et creation error異常反應:

您嘗試啓動樣本使用連接到HSQLDB服務器。對於啓動DB,您應該從demo/hsqldb文件夾運行ant runServer命令。

有關詳細信息如何運行樣本您可以閱讀this post

+0

感謝您的回覆,,我試過了螞蟻測試但同樣的問題將繼續。看到我的第二個更新我的原始問題。 –

+0

不,我沒有其中任何一個。 –

+0

您應該首先啓動數據庫 - 我已經添加了如何運行它的信息。 –

3

Java的錯誤是像一場車禍。一輛車會撞到另一輛,導致第一輛車照進路燈。路燈倒下,撞上一輛爆炸的汽油卡車。

最後,你有毀滅,火災和死亡。然而,整件事情開始了,因爲司機太忙了發短信,並沒有停在停車標誌。

你有錯誤消息的長長的名單,但重要的是那些在最開始:

net.sf.jasperreports.engine.JRException: java.sql.SQLException: socket creation error 
    [java]  at net.sf.jasperreports.engine.util.AbstractSampleApp.getDemoHsqldbConnection(AbstractSampleApp.java:158) 

這是一個套接字創建錯誤

此錯誤似乎指出您無法連接到服務器或數據庫。

而且,就我所能得到的這一點而言。我真的不知道賈斯珀,但我確實找到了this。這對你有幫助嗎?

是否有應該運行的服務器,或者需要連接的數據庫沒有創建?你有沒有防止連接到服務器/數據庫的防火牆? (我傾向於數據庫的問題,因爲我也看到有關HSQLDBSQL在錯誤消息中的東西。

我想你不是一個Java開發人員,因爲你似乎被螞蟻迷惑,它是build.xml有沒有人可以幫助你呢?如果可以的話,看看build.xml看看目標測試正在做什麼,它運行着一個Java命令,你可以嘗試運行那個命令在Ant之外有時候會給你多一點信息

相關問題