?
Solved

Opening Altova Authentic with filename as parameter

Posted on 2005-03-30
17
Medium Priority
?
298 Views
Last Modified: 2010-03-31
Hi Experts,

I would like to open Altova Authentic from my JBuilder Java application. Altova Authentic is a software tool that enables me to view the xml file's data.

I have an xml file name stored in a variable.

For example: String x = "newNodes.xml"

I would like to open Altova Authentic using this string variable. I have seen previous sample code such as:

Runtime.getRunTime().exec(start ("yourdocument.doc"));

I presume the '.doc' is what opens the word document, however, with a '.xml' extension, it is obvious the Windows environment is not sure what program to open the filename with. This is where my problem lies.

Any help much appreciated!

0
Comment
Question by:dev-ngps7
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 11
  • 6
17 Comments
 
LVL 35

Expert Comment

by:TimYates
ID: 13661294
Runtime.getRuntime().exec( "start C:\\Progra~1\\altova.exe C:\\newNodes.xml" );

should do it...

you may need to read inputstream if the program spits out any text...

0
 
LVL 35

Expert Comment

by:TimYates
ID: 13661303
and assuming you are on windows...

Change "C:\\Progra~1\\altova.exe" to the actual path of the "Altova Authentic" executable

and change "C:\\newNodes.xml" to the actual path of your XML file...
0
 

Author Comment

by:dev-ngps7
ID: 13661438
import java.lang.Runtime;

// absoluteFilename is string containing location of xml file

Runtime.getRuntime().exec( "start C:/Program Files/Altova/Authentic2005/" + absoluteFileName);

Errors as you said it might,

"java.io.IOException: CreateProcess: start C:/Program Files/Altova/Authentic2005/D:\KnowledgeBaseProject2\Knowledgebase/Content/kb00007.xml error=2 caught; Class: DataHandler, Method: processEntryNode"

Doesn't mean much to me though :o(
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
LVL 35

Expert Comment

by:TimYates
ID: 13661485
errr...  you will need to use Windows slashes (like I did), and include the filename for the application (like I did)

Runtime.getRuntime().exec( "start C:\\Progra~1\\Altova\\Authentic2005\\Authentic.exe " + absoluteFileName ) ;

or something...
0
 

Author Comment

by:dev-ngps7
ID: 13661663
All to no avail................

Runtime.getRuntime().exec( "start C:\\Progra~1\\Altova\\Authentic2005\\authentic.exe " + "/" + absoluteFileName);

Runtime.getRuntime().exec( "start C:\\Progra~1\\Altova\\Authentic2005\\AUTHENTIC.exe " + "/" + absoluteFileName);

Runtime.getRuntime().exec( "start C:\\Program Files\\Altova\\Authentic2005\\authentic.exe" + "/" + absoluteFileName);

Runtime.getRuntime().exec("C:\\Progra~1\\Altova\\Authentic2005\\AUTHENTIC.exe" + "/" + absoluteFileName);

Runtime.getRuntime().exec("C:\\Program Files\\Altova\\Authentic2005\\authentic.exe" + "/" + absoluteFileName);

0
 
LVL 35

Expert Comment

by:TimYates
ID: 13661671
Runtime.getRuntime().exec( "start C:\\Progra~1\\Altova\\Authentic2005\\authentic.exe " + absoluteFileName);

what is absoluteFileName?
0
 
LVL 35

Expert Comment

by:TimYates
ID: 13661686
Actually, try:

    Runtime.getRuntime().exec( "cmd /c start \"C:\\Progra~1\\Altova\\Authentic2005\\authentic.exe\" \"" + absoluteFileName + "\"" ) ;

make sure absoluteFileName has windows style slashes, etc...
0
 
LVL 35

Expert Comment

by:TimYates
ID: 13661692
Or, try:

    Runtime.getRuntime().exec( "cmd /c start \"C:\\Program Files\\Altova\\Authentic2005\\authentic.exe\" \"" + absoluteFileName + "\"" ) ;
0
 
LVL 35

Expert Comment

by:TimYates
ID: 13661695
is the program called "authentic.exe"?
0
 

Author Comment

by:dev-ngps7
ID: 13661723
Its called AUTHENTIC.exe but the following works below

Runtime.getRuntime().exec("C:\\Progra~1\\Altova\\Authentic2005\\authentic.exe"

This opens Authentic but when i add my filename string it errors

hmmmm, the filename is correct i have triple checked, strange.....
0
 
LVL 35

Expert Comment

by:TimYates
ID: 13661748
>> hmmmm, the filename is correct i have triple checked, strange.....

what is it?  Can you paste it here?
0
 

Author Comment

by:dev-ngps7
ID: 13661786
Sure,

D:\KnowledgeBaseProject2\Knowledgebase/Content/kb00002.xml


Tim, your last suggestion opened the xml file in explorer (my default browser) but not with Altova!

Runtime.getRuntime().exec( "cmd /c start \"C:\\Program Files\\Altova\\Authentic2005\\authentic.exe\" \"" + absoluteFileName + "\"" ) ;

So now i can open Altova with no xml file OR open the xml file with no Altova, nearly!!


0
 
LVL 35

Expert Comment

by:TimYates
ID: 13661930
>> D:\KnowledgeBaseProject2\Knowledgebase/Content/kb00002.xml

Try doing:

absoluteFileName = "D:\\KnowledgeBaseProject2\\Knowledgebase\\Content\\kb00002.xml" ;
Runtime.getRuntime().exec( "cmd /c start \"C:\\Program Files\\Altova\\Authentic2005\\authentic.exe\" \"" + absoluteFileName + "\"" ) ;
0
 

Author Comment

by:dev-ngps7
ID: 13662006
Tried that and another idea, both listed below, only shows xml file in explorer still

absoluteFileName = "D:\\KnowledgeBaseProject2\\Knowledgebase\\Content\\" + getNewFileName();

absoluteFileName = "D:/KnowledgeBaseProject2/Knowledgebase/Content/" + getNewFileName();

// run twice using both code snippets above

Runtime.getRuntime().exec( "cmd /c start \"C:\\Program Files\\Altova\\Authentic2005\\authentic.exe\" \"" + absoluteFileName + "\"" ) ;
0
 
LVL 35

Accepted Solution

by:
TimYates earned 1000 total points
ID: 13662043
Ok... try:

// This is correct...  as it has to be in Windows format
absoluteFileName = "D:\\KnowledgeBaseProject2\\Knowledgebase\\Content\\" + getNewFileName();
Runtime.getRuntime().exec( "C:\\Progra~1\\Altova\\Authentic2005\\authentic.exe " + absoluteFileName ) ;
0
 

Author Comment

by:dev-ngps7
ID: 13662097
WOW! Cheers TimYates, i think between us there were about 20 combinations tried, but we got there in the end!

Thanx :)
0
 
LVL 35

Expert Comment

by:TimYates
ID: 13662138
hehehe :-)

Glad we got it sorted in the end!!  Soz it wasn't quicker, but I can't test it at my end as I'm on linux :-(

Yay!

Good luck with it all!! :-)

Tim
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java contains several comparison operators (e.g., <, <=, >, >=, ==, !=) that allow you to compare primitive values. However, these operators cannot be used to compare the contents of objects. Interface Comparable is used to allow objects of a cl…
Java functions are among the best things for programmers to work with as Java sites can be very easy to read and prepare. Java especially simplifies many processes in the coding industry as it helps integrate many forms of technology and different d…
This video teaches viewers about errors in exception handling.
This tutorial will introduce the viewer to VisualVM for the Java platform application. This video explains an example program and covers the Overview, Monitor, and Heap Dump tabs.
Suggested Courses
Course of the Month14 days, 4 hours left to enroll

800 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question