• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

importing one desktop application in other

 
abhishek rathur
Ranch Hand
Posts: 66
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
i have created two individual desktop application,i want to import one desktop application in another.
help me!
 
Mohamed Sanaulla
Saloon Keeper
Pie
Posts: 3159
33
Google App Engine Java Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
abhishek rathur wrote:i have created two individual desktop application,i want to import one desktop application in another.
help me!

Do you mean you want to:
Link one application to another? OR
Use the code available in One of the application?

As far as I know you cannot import applications, but you can import the packages. For that you would have to have a jar of your application and then include it in the classpath of other application.
 
abhishek rathur
Ranch Hand
Posts: 66
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok if we can not import application,is there any method with the help of which we can invoke other application, what i mean is, in first application i will write a code that will invoke other application.
 
Mohamed Sanaulla
Saloon Keeper
Pie
Posts: 3159
33
Google App Engine Java Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
abhishek rathur wrote:ok if we can not import application,is there any method with the help of which we can invoke other application, what i mean is, in first application i will write a code that will invoke other application.

You can have a look at ProcessBuilder class to see how you can invoke external applications. Also there's Runtime.exec(), but I would like you to read this article before proceeding.
 
Maneesh Godbole
Saloon Keeper
Posts: 10976
11
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
FirstApp.main ?
 
Mohamed Sanaulla
Saloon Keeper
Pie
Posts: 3159
33
Google App Engine Java Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maneesh Godbole wrote:FirstApp.main ?

So this means OP would have to import the FirstApp package?
 
Maneesh Godbole
Saloon Keeper
Posts: 10976
11
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Mohamed Sanaulla wrote:
Maneesh Godbole wrote:FirstApp.main ?

So this means OP would have to import the FirstApp package?

The FirstApp I was referring to, I was imagining a packaged jar file, whose main class was FirstApp.java
If this jar is on the class path, one can definitely invoke FirstApp.main()

 
Mohamed Sanaulla
Saloon Keeper
Pie
Posts: 3159
33
Google App Engine Java Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Maneesh Godbole wrote:
Mohamed Sanaulla wrote:
Maneesh Godbole wrote:FirstApp.main ?

So this means OP would have to import the FirstApp package?

The FirstApp I was referring to, I was imagining a packaged jar file, whose main class was FirstApp.java
If this jar is on the class path, one can definitely invoke FirstApp.main()



Oh yeah, that was what I was thinking of (when I meant having the Jar on the Classpath). And better than what I suggested later on- Using ProcessBuilder/Runtime.exec().
 
abhishek rathur
Ranch Hand
Posts: 66
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

You can have a look at ProcessBuilder class to see how you can invoke external applications. Also there's Runtime.exec(), but I would like you to read this article before proceeding.

but i am not creating any exc file,its two individual desktop application.
 
Maneesh Godbole
Saloon Keeper
Posts: 10976
11
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Did you try invoking FirsAppMainClass.main ?
 
Mohamed Sanaulla
Saloon Keeper
Pie
Posts: 3159
33
Google App Engine Java Ruby
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
abhishek rathur wrote:
but i am not creating any exc file,its two individual desktop application.


Please try what Maneesh suggested few posts back.
 
abhishek rathur
Ranch Hand
Posts: 66
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi maneesh
i have created two simple java application hello1 and hello2, i have created jar file of hello1 and added that jar file in the hello2 lib and then wrote filename(of_hello1).main(); but its not executing as per required.
 
Maneesh Godbole
Saloon Keeper
Posts: 10976
11
Android Eclipse IDE Google Web Toolkit Java Mac Ubuntu
 
abhishek rathur
Ranch Hand
Posts: 66
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yeah, i added my jar file to C:\j2sdk\jre\lib\ext but still its showing error
 
Rob Spoor
Sheriff
Pie
Posts: 20396
47
Chrome Eclipse IDE Java Windows
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Unless the main method is programmed to use varargs you need to provide a String[] with the command line arguments. In case you don't need any simply provide an empty array (new String[0]).
 
abhishek rathur
Ranch Hand
Posts: 66
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thanks rob prime ,its working
but its not the actual problem, it was just a testing which i was doing, the actual thing is i want to import one desktop application in other,is this possible this way.
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You need to tell us what you mean by "import one desktop application in other" - it's not a phrase that has a generally accepted meaning.
 
abhishek rathur
Ranch Hand
Posts: 66
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
look its simple, two individual desktop application are there,i want to invoke 2nd desktop application from 1st desktop application.
Suppose if i click a button on 1st desktop application it will invoke the 2nd desktop application.i need to know is this possible
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
By "invoke", do you mean that you want to start the second application? If so, then Runtime.exec and ProcessBuilder have already been mentioned.

Or should the other application do something? That could still be accommodated by passing command-line arguments to it.
 
abhishek rathur
Ranch Hand
Posts: 66
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
ok so first i have to create a exec file,of my applications,right.can you throw more light on that.
 
Ulf Dittmer
Rancher
Pie
Posts: 42966
73
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not necessarily. Did you read the article Mohamed linked to? If not, start with that. If you did read it, were you successful in trying the technique?
 
abhishek rathur
Ranch Hand
Posts: 66
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
yeah, i am trying. what i am trying to do,two application are there app1 and app2,i created the jar file of app2 and added it in the lib folder of app1,and also to the class file.
i created a button in appl1, and in event of the appl1 button i am calling app2.main()

but its not working.
 
abhishek rathur
Ranch Hand
Posts: 66
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Eureka ('');

its working,but for simple desktop application now i have to check it for database based desktop application.
 
abhishek rathur
Ranch Hand
Posts: 66
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thank you guys
for all your help.
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic