i want to embed an open source editor to my java desktop application. But i am not sure yet how to do it. I got jnlp web start and jar file to import library.
The program which will be imported is like below.
In fact i just need internal frames but if it is too completed i can embed whole program too.
I think about 3 options but don't know which one really works and which one is better.
Run jnlp webstart in java code
Run jar file in java code(non-executable jar)
Import jar and use its api (This is really what i need but i m not sure how to do this. I debugged the code to understand which frame works how but i have no experience about it and i found it very complicated)
Any advices how to solve this problem ?
Thanks,
Bilal
The picture just shows the view but there's more behind. You can't just embed the internal frames into you application and use the editors functionality. You'll need all the model, controller, support, ... classes too.
You may be lucky, that the main frame is just a simple container and you can "replace" it with your own container. But I not too optimistic. I don't think, that the editor has an API that allows integrating the internal frames into another container. So Option 3 would be the best but I think it's out of reach. Is it a common editor? Maybe more help is possible if you just tell us its name.
Related
It is as simple as an application that can update itself.
More specific, maybe a launcher that loads a jar file from the web and replaces it with the current jar.
The approach that I want is:
A launcher which is coded in Java.
That launcher overall uses classloader e.t.c.
I want to keep the data from the previous jar. Maybe the data from the previous jar are written on a .txt file and pass them to the new one? (If possible)
I have no clue about classloader or any direction to follow.
So my question is "How can i use classloader to create an auto-update Java application?".
P.S. I want java web start to be the last choice. Some lines of code would help me very much.
Edit: I understand completely what are you saying in theory. What i am looking for is specific links or code which i can take as reference.
The question isn't a duplicate because i can't find links or code but theory.
You can use the URLClassLoader to load a jar file from an URL. Mind, URLs may also be local files, and I'd recommend that you download the jar file locally before loading it in, instead of loading it directly from the web. The reason for this is that you want the application to remain usable, even if the user cannot reach your server.
However, I'd also recommend against taking this approach. What if you want to update the launcher? It's better to download a seperate updater application from the main application, launch the seperate updater application, have that kill the main application and update it.
I have a client who has a java based game which he wants to make available online (at the moment it is desktop version which he had to install). He asked me whether I can embed it into a webpage. After trying for several days still no joy. Can you please point me to the right direction. It have fives jar files(executable jar file) and a folder called lib which has five more jar files. Now I don't know whether it is possible to embed the game using applet/object tag. Can you please point me what to look at when dealing with these jar files.
..at the moment it is desktop version which he had to install..
Launch it from a link using Java Web Start. It might be necessary to digitally sign the Jars (what does the app. do?).
Note that a 'desktop application' would typically be coded using a JFrame, whereas the equivalent top-level container for embedding is a JApplet. A frame cannot simply be embedded in a web page.
As the rest of the problems mentioned, you'll need to be a lot more specific about what you tried and the results of those attempts, or find some psychic helpers.
I have written an android application. I would like to be able to customize the app programmatically. For example, change logos/titles within the application.
Assume I have a simple web server that displays a form with fields to input text, upload images etc. Upon submission of this form, I would like to generate an apk file available for download for the user.
Is there a way to script eclipse to achieve this? Is that even where I should be looking? If anyone has done something like this, (or have some ideas), please let me know!
Thanks
Is there a way to script eclipse to achieve this?
Possibly, but I doubt it.
Is that even where I should be looking?
Use Ant. Make a copy of some master project, make your adjustments from the entered data, and run the appropriate ant tasks (e.g., ant release build) to create the APK.
We have put together a system that creates multiple, customised APKs from a single body of source code. The system is not in a state where we can make it available (although we may open source it at some point) but the general structure is described here.
Having said that, the system you describe in your question is much more dynamic than what we need. We only need to create a few (~10) different variants. It strikes me that what you're trying to do would be better solved by having a single APK together with a configuration file. Your webserver would generate the configuration file, not the APK.
I made a simple command-line based game in java, only two classes (using Eclipse). But I was wondering how I can make this into a usable application for anyone, without running it through eclipse (ie send it to someone who knows nothing about java but would still be able to play the game)? Thanks!
You want to create a runnable jar file.
Eclipse has an option for this in the "Export" menu. For more options, search for "executable jar file" here or on Google.
You want to make sure that you also include any jar files your code depends on as well (Eclipse can also do that for you).
Users will be able to start this by double-clicking on the file on most platforms. If you need better integration (such as a custom icon), you will need to bundle it up further into an OS-specific executable. But for starters, a simple runnable jar works fine.
send it to someone who knows nothing about java
You need to get them to at least install the Java runtime on their machine (if it is not already there).
Just to be clear, "command-line" and "knows nothing about java" are probably not going to work very well for you given that:
java is OS agnostic, therefore, if you send (presumably) a jar file to say...your grandma and she has a mac and you have a PC chances are her getting it to work is not going to be "out of the box easy" so to speak.
Left with this, I think you have a couple choices...first off, you do need to package your classes - a runnable jar will work fine. Aside from that, you will most likely have to build OS specific scripts (batch scripts for Windows, shell scripts for unix, etc.) and you will have to hand these out with your jar file. That being said, the intended user will still need to have java installed, and the batch scripts themselves are not likely to be trivial endeavors.
Your next option would be to use JNLP. However, I don't think JNLP has a command line mode, so you will likely have to simulate a console with something like a JTextArea.
As far as I see it, your last option it to use one of the many products (not sure if there are any free ones) that package java into native code. I think Exe4j is one such example - but, like I said, I am not sure if there are any free ones and I am not sure how hard they are to use.
Best of luck, and if you can't get your jar to work you should probably move that to its own question.
I am working on a large undocumented application written in swing/awt. I have to make changes to it and i need to find out what class a form belongs to when i open it. Is there a way to do this via eclipse?
For example: I open the application and to do something with the app such that some frame opens. How do i find out the class of that form? Can this be done through eclipse?
I know i can comb trough the logic but this is a very laborious and largely ineffective process, chunks of the logic are either in jar files or obfuscated.
Thanks.
For figuring out how a given Swing frame is put together, I have found Swing Explorer to be VERY helpful.
https://swingexplorer.dev.java.net/
After installing the Eclipse plugin, note that you need to "Run as ->" to invoke Swing Explorer properly.
I don't know if this is what you need, but maybe you should try searching(MainMenu-->Search) your entire Project for the specific Window title (String) that comes up with this particular window.