Jump to content
We've recently updated our Privacy Statement, available here ×

Using from runnable jar file ... ?


2005 IR Help

Recommended Posts

By: GodSend - godsend25

Using from runnable jar file ... ?

2004-03-12 10:29

I have an interesting situation. For development I have succesfully implimented Jasper Reports (Yahoo!).

 

On my client machines I would like to install an SDK, and copy over the completed project as a runnable jar containing all the images,xml, and jar files needed for the program.

 

So far I have not had a problem untill trying to use Jasper. Typically I unjar the file and copy the entire path into the applications root (therefor I dont have to play with the client computers Classpath) in an uncompressed directory structure.

 

I get the following error now :

 

java.io.IOException: CreateProcess: javac -classpath run.jar C:DriverManagerBa

sicReport.java error=2

at java.lang.Win32Process.create(Native Method)

at java.lang.Win32Process.<init>(Unknown Source)

at java.lang.Runtime.execInternal(Native Method)

at java.lang.Runtime.exec(Unknown Source)

at java.lang.Runtime.exec(Unknown Source)

at java.lang.Runtime.exec(Unknown Source)

at dori.jasper.engine.design.JRJavacCompiler.compileClass(JRJavacCompile

r.java:102)

at dori.jasper.engine.design.JRAbstractJavaCompiler.compileReport(JRAbst

ractJavaCompiler.java:151)

at dori.jasper.engine.design.JRDefaultCompiler.compileReport(JRDefaultCo

mpiler.java:136)

at dori.jasper.engine.JasperCompileManager.compileReport(JasperCompileMa

nager.java:196)

at dori.jasper.engine.JasperManager.compileReport(JasperManager.java:982

)

at RemarksReport.actionPerformed(RemarksReport.java:96)

 

 

The file I am running is

 

c:DriverManagerrun.jar

 

and is run using the following batch file

 

cd

cd DriverManager

java.exe -jar run.jat

 

Ive been using this method for many months to ease end user install, but now its failing me. Please help.

 

 

 

 

 

 

 

 

By: GodSend - godsend25

RE: Using from runnable jar file ... ?

2004-03-12 10:30

I should also note that I have no problems running the unjarred version on my development computer (as well as the jared version, but on the development machine I have the entire classpath environment setup....)..

 

 

 

 

By: Nikos Kalogridis - arjman

RE: Using from runnable jar file ... ?

2004-03-14 12:42

try including the path of your java.exe file in the path environment variable.

It should solve your problem

 

 

 

 

By: Nikos Kalogridis - arjman

RE: Using from runnable jar file ... ?

2004-03-14 12:47

sorry what I wanted to say was javac.exe not java.exe error=2 means file not found.

probably because it does not exist on your client machines. Try using precompiled versions of your reports if you dont want to install the sdk on your client machines

 

 

 

 

By: GodSend - godsend25

RE: Using from runnable jar file ... ?

2004-03-15 06:26

Thanks guys, Brain fart there. I dident have a JDK on the client machine (just a JRE).

 

Now heres a question. Can you display standard reports in such a way that the Client computer does not need javac.exe ? I am using the following code ..

 

JasperDesign jasperDesign = JasperManager.loadXmlDesign("c:\DriverManager\remarks.xml");

JasperReport jasperReport = JasperManager.compileReport(jasperDesign);

 

Map parameters = new HashMap();

parameters.put("Title", "Remarks for " + d_.toString());

parameters.put("id", d_.getMarkelId());

parameters.put("name",d_.toString());

parameters.put("start", startDate.getText());

parameters.put("end",endDate.getText());

 

JasperPrint jasperPrint = JasperManager.fillReport(jasperReport, parameters, McArthurDriverManager.dbConnections.con_markel);

 

 

JasperViewer.viewReport(jasperPrint, false);

 

 

 

 

By: Nikos Kalogridis - arjman

RE: Using from runnable jar file ... ?

2004-03-15 10:42

Run the following with your choice of parameter flavour to your development machine

JasperManager.compileReportToFile

then take the produced file and put it on the client machines. And put the code you have without the first two lines:

 

Map parameters = new HashMap();

parameters.put("Title", "Remarks for " + d_.toString());

parameters.put("id", d_.getMarkelId());

parameters.put("name",d_.toString());

parameters.put("start", startDate.getText());

parameters.put("end",endDate.getText());

 

JasperPrint jasperPrint = JasperManager.fillReport("<path to your compiled report file>", parameters, McArthurDriverManager.dbConnections.con_markel);

 

JasperViewer.viewReport(jasperPrint, false);

Link to comment
Share on other sites

  • Replies 0
  • Created
  • Last Reply

Top Posters In This Topic

Popular Days

Top Posters In This Topic

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×
×
  • Create New...